Magento - How to find if you are on homepage - getIsHomePage

Posted by Damodar Bashyal on July 31, 2012

 

Today I needed to exclude hot products and recently viewed products block from homepage, so I needed to find if the current page is homepage. The first block of code worked on header.phtml template but not in main page template, so I ended up using 2nd option.

If you need to check this on header.phtml template then use this code:

More»

Magento - How to assign a product to a Category and It's parent categories

Posted by Damodar Bashyal on July 12, 2012

 

We not only created a lot of new categories, we deleted a lot of old categories and renamed some of them as well. Now the issue was to correctly assigning products to appropriate categories. We were provided product csv with three columns (category,sku,category-code). category-code was for SAP admins, so they can update their inventory according to code. But we need other two columns only. Here is the shell script I wrote which runs smoothly and does the work for me :-)

More»

Magento - How to assign simple products to configurable programmatically?

Posted by Damodar Bashyal on July 10, 2012

 

Some of our simple products were not correctly assigned to a configurable product. And, some of them were visible independently in the front end. My task was to assign simple products to correct configurable product and make associated products to not visible individually. It was easy to find configurable product and associated simple products because of the SKU they had. All simple products had sku configurableSKU__*.

So after some trials this code worked for me.

More»