Search This Blog

Wednesday, 30 May 2012

Downloadable zip files not working in Magento

If your product has ZIP file as downloadable link then you might have issues after downloading the zip files. Possible Error is "ZIP archive is corrupted".


To fix this issue make the following changes in your Magento .htaccess file

Replace
php_flag zlib.output_compression on

With 
# php_flag zlib.output_compression on

Enjoy :) 

Thursday, 24 May 2012

Magento product list AJAX scroll

This infinite Ajax scroll works great as expected for product lists. I really appreciate Pieter for his great work for free.

You can find more info and free extension at http://www.rapidcommerce.eu/blog/2012/05/magento-product-list-ajax-scroll/

It seems latest version available now at : http://www.rapidcommerce.eu/blog/2013/07/magento-product-list-ajax-scroll-v2-0/

Get a list of attribute options from Magento using attribute code

$attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'color');
if ($attribute->usesSource()) {
    $options = $attribute->getSource()->getAllOptions(false);
}

Change magento column count in products grid list for each category

Add the following code into "Custom Layout Update" field for the category that you want change the number of products for each row to be diaplyed

<reference name="product_list">
    <action method="setColumnCount"><count>4</count></action>
</reference>

Refresh the cache and try out !!!!!!!!!

Wednesday, 23 May 2012

Set Default filters for the Grid in Magento

To apply default filter for the grid view follow the instructions below:

Open your corresponding grid.php file and look for  the following
protected function _prepareCollection() {

Add the following line of code next to above code

$this->setDefaultFilter(array('featured'=>1));

 In above code ,  "featured" is the name of the field and 1 is the default value to be applied to filter. Also you can add any number of filter in the array with in setDefaultFilter function.




Friday, 18 May 2012

Add or Remove Javascripts for specific page in Magento

To Remove JS file:

Layout XML Head reference:
<action method="removeItem"><type>js</type><name>calendar/calendar.js</name></action>

OR

Block Class PHP:
$this->getLayout->getBlock('head')->removeItem('js', 'calendar/calendar.js');

To Add JS file:
$this->getLayout->getBlock('head')->addjs('abc/cdf.js');