Activecodewar was founded by Shahid Mehmood. I am the owner of this blog and working as web developer from last 6 years. I have started to work on magento back in June 2009 and found it very interesting tool to build ecommerce websites. As you will know (if you are magento developer) that it's not easy tool to use, only PHP is not enough to understand it, you need to have full understanding of magento as well.

    Error:Username invalid or requires authentication

How to get child categories under parent one

Posted Date: January 13, 2011

You can use the following code to get child categories under parent one:

Remove Decimal Points from Price

Posted Date: December 30, 2010

Step 1:
Change the following file to remove the decimal points:

Lib/Zend/Currency.php

In the “toCurrency” function add the following line:
$options['precision'] = 0;
Step 2:
Change the following price to round the price:
app/code/core/Mage/Core/Model/Store.php
Change the method “roundPrice” to the round the prices in product listing and view pages like this:
return round(ceil($price), 0);

Please let me know if you have any questions

get image url in magento

Posted Date: December 23, 2010

Use the following code to get the magento image url:

echo $this->getSkinUrl(’images/flag.jpg’);

if $this object is not available then you can use the following code to get the image path:

echo Mage::getDesign()->getSkinUrl(’images/flag.jpg’);

Reset admin password of magento

Posted Date: December 8, 2010

Have you ever forget the Magento admin password and wanted to reset?

Enable Free Shipping Promotion Code

Posted Date: November 29, 2010

I was looking the way to create Free Shipping promotion code and came to know that there is no way in magento. I searched and found the very nice solution, which may help someone else as well.

So, I searched and found the very good solution to create the promotion code which can work just like any other promotion code, but for that you need to modify your code.

How to get store information

Posted Date: October 19, 2010

You can get the store id, store code, store name, website id etc. through following ways:
Get store data
Mage::app()->getStore();
Store Id
Mage::app()->getStore()->getStoreId();
Store code
Mage::app()->getStore()->getCode();
Website Id
Mage::app()->getStore()->getWebsiteId();
Store Name
Mage::app()->getStore()->getName();
Is Active
Mage::app()->getStore()->getIsActive();
Store Home Url
Mage::app()->getStore()->getHomeUrl();

How to add quantity field on catalog / product listing page

Posted Date: February 3, 2010

I just managed to find some time to write a small module which will help you if you want to add quantity text box on your catalog / product listing page.
As lot of users were asking about it, so I thought it would be very good to share it with other users.
So, let’s do it [...]

How to run magnto outside platform and get product collection query

Posted Date: February 1, 2010

Yesterday I was trying to find out that how to run magento outside platform and found out very nice little code and also how you can get the query of product collection or any other table using the following code:

<?php
getCollection();
$collection->addAttributeToSelect(’status’);
$collection->addAttributeToSelect(’orig_price’);
echo $collection->getSelect(); // This line will print the query for the above collection
?>

Hope this code [...]

How to override sales block and model

Posted Date: January 27, 2010

I was just working on the Sales module to override block and model classes.

I though it would be very good to share it with others as well.

How to add attribute to ALL attribute sets

Posted Date: January 25, 2010

Most of the time I face a problem to add a attribute to all attribute sets…Which is very time consuming job.
So, I wrote a little script which can help you a lot to add a attribute to all attribute sets immediately, just run the following sql command and you are done

INSERT INTO `eav_entity_attribute` [...]