Magento Themes and Magento Extensions

Setting the Default Currency for a User in Magento

Posted on May 22nd, 2013 | Posted by admin

Setting the Default Currency for a User in Magento
This won’t alter the base price in the system but it will set the start price for a user. Simply add this to the top of /template/directory/currency.phtml

$currentCurrency = $this->getCurrentCurrencyCode();

if(!isset($currentCurrency)) $currentCurrency = ‘NA’;

$currencies = array(“GBP”,”USD”,”EUR”);

if (in_array(strtoupper($_GET['cy']),$currencies)) {
if(strtoupper($_GET['cy']) != $currentCurrency)

Creating a Magento layout block

Posted on May 21st, 2013 | Posted by admin

Magento is a tricky beast to layout correctly. It makes use of not only template files and XML files to fit everything together. The documentation is a little vague (because they offer no support unless you buy the license), but by reading enough forums and blog posts (like this one), you can piece it together.

The goal

I’ve got a site design that has a “toolbar” that displays on all pages. It’s not in the sidebar and it’s not in the header. It’s inside the main content section, floating up at the top. I need to create the toolbar, and then put the Magento site search and Magento cart summary in that toolbar.

Magento – Programmatically Check If Module Is Enabled

Posted on May 19th, 2013 | Posted by admin

Magento – Programmatically Check If Module Is Enabled
To check if any specific module is enabled or not. This code check the config data of module and return bool.

Remember: Module name is case sensitive, so “Mage_Cms” will work but “mage_cms” will not.
How to use:
I used this code inside a controller. But this is not restricted with controller only, we can use it inside model, blocks or even in templates as well.

Magento Enterprise Tabs – How to select specific tab?

Posted on May 18th, 2013 | Posted by admin

Magento Enterprise Tabs – How to select specific tab?

This is how tab config looks in - catalog.xml

01 <block type="catalog/product_view_description" name="product.description"as="description" template="catalog/product/view/description.phtml">
02 <action method="addToParentGroup"><group>detailed_info</group></action>
03 <action method="setTitle" translate="value"><value>Product Details</value></action>
04 </block>
05 <block type="catalog/product_view_attributes" name="product.attributes"as="additional" template="catalog/product/view/attributes.phtml">
06 <action method="addToParentGroup"><group>detailed_info</group></action>
07 <action method="addToParentGroup"><group>detailed_info</group></action>
08 <action method="setTitle" translate="value"><value>Additional Information</value></action>
09 </block>
10 <block type="cms/block" name="payment_options_tab" as="payment_options_tab"template="catalog/product/view/custom_tab_content.phtml">
11 <action method="setBlockId"><block_id>payment_options_tab</block_id></action>
12 <action method="addToParentGroup"><group>detailed_info</group></action>
13 <action method="setTitle" translate="value"><value>Payment Options</value></action>
14 </block>
15 <block type="cms/block" name="shipping_calculator_tab"as="shipping_calculator_tab"template="catalog/product/view/custom_tab_content.phtml">
16 <action method="setBlockId"><block_id>shipping_calculator_tab</block_id></action>
17 <action method="addToParentGroup"><group>detailed_info</group></action>
18 <action method="setTitle" translate="value"><value>Shipping Calculator</value></action>
19 </block>

content of - custom_tab_content.phtml

Log all SQL queries in Magento

Posted on May 17th, 2013 | Posted by admin

In Varien_Db_Adapter_Pdo_Mysql

Magento : lib/varien/Db/Adapter/Pdo/Mysql.php
protected $_debug = true;
protected $_logAllQueries = true;

and (if nor already there) create the folder defined in

protected $_debugFile = ‘var/debug/sql.txt’;

Give read / write permission

Page 5 of 90« First...«34567»102030...Last »