Magento 1 short codes, tips and tricks
668
post-template-default,single,single-post,postid-668,single-format-standard,theme-bridge,bridge-core-3.1.6,woocommerce-no-js,qode-page-transition-enabled,ajax_fade,page_not_loaded,,vertical_menu_enabled,qode-title-hidden,paspartu_enabled,paspartu_on_top_fixed,paspartu_on_bottom_fixed,vertical_menu_inside_paspartu,qode_grid_1300,columns-4,qode-child-theme-ver-1.0.0,qode-theme-ver-30.4.1,qode-theme-bridge,disabled_footer_top,wpb-js-composer js-comp-ver-7.5,vc_responsive

Magento 1 short codes, tips and tricks

I’ve started using Magento 1 for The Toy Store and 6 months in realised I have been doing it wrong.

Here are some things I’ve learn’t along the way, feel free to mention anything you’ve learn’t and feel I or anyone else might find useful in the comments below.

It is good form to use short codes where possible as it avoids breaking your site when you switch stores, change themes, move domains etc.

Here are some basic short codes I’ve learnt to use:

XXX is where you input your data

 

Magento 1 Shortcodes

GET STORE URL :

CMS/PAGE:

<a href=”{{store url=’XXX‘}}”>

if a question mark is in your url

<a href=”{{store url=”}}?brand=124″>

 

PHTML:

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

 

GET BASE URL :

CMS/PAGE:

{{store url=””}}

 

PHTML:

Mage::getBaseUrl();

 

GET SKIN URL :

CMS/PAGE:

{{skin url=’images/imagename.jpg’}}

 

PHTML:

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

(a) Unsecure Skin Url :

Shatavari is a nutritive tonic and boosts stamina, strength and energy to last longer in take a look at the pharmacy shop here cheap sildenafil india bed and can even create relationship problems. Kamagra can nicely be used in place of cute-n-tiny.com purchase cheap cialis. Although there are several pumps available on the market, not all are as effective generic viagra cute-n-tiny.com and easy to use. In essence, it’s selling other people’s products for a viagra store usa cut of the Sale. $this->getSkinUrl(‘images/imagename.jpg’);

(b) Secure Skin Url :

$this->getSkinUrl(‘images/imagename.gif’, array(‘_secure’=>true));

 

GET MEDIA URL :

CMS/PAGE:

{{media url=’/imagename.jpg’}}

 

PHTML:

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

 

GET CURRENT URL

PHTML:

Mage::helper(‘core/url’)->getCurrentUrl();

 

GET JS URL :

PHTML:

Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

 

GET THE CURRENT CURRENCY SYMBOL

<?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?>

 

STATIC BLOCKS SOMETIMES STOP WORKING

Sometimes your static blocks disappear when you update the site or just don’t show up when you add the below code:

{{block type=”cms/block” block_id=”XXX”}}

You have to give permissions for the blocks

System => Permissions => Blocks: