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.

Get All Products Of An Order

Posted Date: October 14, 2009

$order = Mage::getModel(’sales/order’)->load($order_id);
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
foreach ($items as $itemId => $item)
{
$name[] = $item->getName();
$unitPrice[]=$item->getPrice();
$sku[]=$item->getSku();
$ids[]=$item->getProductId();
$qty[]=$item->getQtyToInvoice();
}

Custom Account/Registration Fields

Posted Date: October 5, 2009

http://www.magentocommerce.com/wiki/custom_account/registration_fields

How to get currency symbol?

Posted Date: September 30, 2009

Here’s another way that might work for you:
Mage::app()->getLocale()->currency(Mage::app()->getStore()->
getCurrentCurrencyCode())->getSymbol()

or if you want to pass a certain currency code simply specify it:

Mage::app()->getLocale()->currency(’EUR’)->getSymbol()

How to add new db field where you can store values seperated by commas?

Posted Date: September 8, 2009

It took me some time to find out that how to do it
But believe me it was really easy, here you go:
Suppose if you are calling the following method in your controller:
$brands = Mage::getModel(’brands/brands’)->setData($data);
it means that you are calling the the brands.php in brands module model->Mysql4 folder.
Now in brands.php suppose we have category_ids field [...]

Get current url

Posted Date: September 1, 2009

This is a doozy but useful. Get the current URL anywhere in phtml or php files by using the core/url helper method.

$current_url = $this->helper(’core/url’)->getCurrentUrl();

How to add resource urls to CMS pages

Posted Date: August 23, 2009

Inside of magento cms pages
{{store direct_url=media}}

The given code snippet will produce http://www.example.com/media

Outside of magento cms pages
{{store direct_url=media/store/cms/brands/brand_logo.gif}}
The given code snippet will produce http://www.example.com/media/store/cms/brands/brand_logo.gif

Get image path

Posted Date: August 20, 2009

$this->getSkinUrl(’images/your_image_name.jpg’)
The code above would get the URL of the image “your_image_name.jpg” placed in your skin directory. Code works for both front and backend purposes. Hope it helps

Get base url in magento

Posted Date: August 17, 2009

<?php echo Mage::getBaseUrl(); ?>

How magento executes query?

Posted Date: August 12, 2009

Please go through with this tutorial:
http://framework.zend.com/manual/en/zend.db.select.html

Creating module/extention from start

Posted Date: August 11, 2009

Please follow this amazing link for tutorial:
http://t.wits.sg/2009/03/31/howto-repackageable-custom-extension-development-in-magento/