Skip to content

Instantly share code, notes, and snippets.

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name

Magento Layout Snippets

Add JavaScript to page

First approach: page.xml - you can add something like

<action method="addJs"><script>path/to/my/file.js</script></action>

Common

Magento : Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url

Get Url in phtml files

  1. Get Base Url :
	Mage::getBaseUrl();
@manojiksula
manojiksula / linux.md
Created December 26, 2014 10:27
Linux Commands

Linux Commands

Database

/* Creating A Backup of database in gz format */

mysqldump -u root -p dbname | gzip -9 > dbname.sql.gz

/* Restore database in gz format in mysql */

@manojiksula
manojiksula / magento.md
Last active September 28, 2023 12:49
Magento Code Snippet

Base Url acording to request http or https

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB,array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()));

Check if Secure URL is enabled in Frontend

if (Mage::app()->getStore()->isFrontUrlSecure()) {
    echo 'Secure URL is enabled in Frontend';
} else {
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
http://stackoverflow.com/questions/8309076/how-to-create-a-site-store-and-view-programatically-in-magento
//#addWebsite
/** @var $website Mage_Core_Model_Website */
$website = Mage::getModel('core/website');
$website->setCode('<your_website_code_here>')
->setName('<your_website_name>')
->save();
//#addStoreGroup
/** @var $storeGroup Mage_Core_Model_Store_Group */
@manojiksula
manojiksula / Tabbed Content with jQuery and CSS.markdown
Created October 28, 2015 09:12
Tabbed Content with jQuery and CSS
@manojiksula
manojiksula / gist:1bec2f467a6f170da1b2
Created January 13, 2016 09:04 — forked from bigsnarfdude/gist:4fba5f1ac11f3829f5d6
elasticsearch 1.4.2 on ubuntu 14
### Install OpenJDK
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Download and Install ElasticSearch
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.2.deb
sudo dpkg -i elasticsearch-1.4.2.deb
@manojiksula
manojiksula / es.sh
Created January 13, 2016 09:05 — forked from hasantayyar/es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.deb
sudo dpkg -i elasticsearch-0.90.9.deb