Magento Themes and Magento Extensions

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

Magento: Programmatically Modify Attribute Configuration

Posted on May 16th, 2013 | Posted by admin

Magento: Programmatically Modify Attribute Configuration

I was asked programmatically modify a product attribute so that it was no longer searchable, and make a different attribute searchable instead. I wrote up the code and put it on our database updater module to run as an upgrade script, but you could put it anywhere you want. To modify an attribute, you can do the following:

Get rid of ?__store=default from your Magento links

Posted on May 15th, 2013 | Posted by admin

If you’re like me, you make use of a lot of widget links within Magento, and those Widget links have a pesky habit of adding ?___store=default to the end of your URLs, which first of all don’t look nice and it certainly doesn’t help your optimisation efforts when it comes to SEO and ridding yourself of duplicate content.

This is a dead simple fix, and gives you peace of mind.

Simply copy the follow file: app/code/core/Mage/Catalog/Block/Widget/Link.php and paste it into app/code/local/Magento/Catalog/Block/Widget/Link.php

Then lines 89 – 92 need to be commented out. These lines look like this: (if it changes in future versions!)

Page 3 of 6«12345»...Last »