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.

Custom Query and Fetch Results

Posted Date: August 10, 2009

$write = Mage::getSingleton(’core/resource’)->getConnection(’core_write’);
$readresult=$write->query(’SELECT * FROM country_reference ORDER BY name ASC’);
while ($row = $readresult->fetch() ) {
$countryData[] = $row;
}

Get Store Main Categories

Posted Date: August 9, 2009

// Get Main Categories

$helper = Mage::helper(’catalog/category’);
$collection = $helper->getStoreCategories(’name’, true, false);

foreach($collection as $cat){
echo $cat->getName() . ‘<br/>’;
}

Import categories into magento

Posted Date: August 6, 2009

Please follow the following link for complete guide (Although its not well compiled when I will get time I will write it step by step)
http://www.magentocommerce.com/boards/viewthread/26022/
Note: Don’t forget to go through with attach files which can help a lot.

Get All Manufacturer List

Posted Date: August 5, 2009

public function getManufacturers()
{
$product = Mage::getModel(’catalog/product’);
$attributes = Mage::getResourceModel(’eav/entity_attribute_collection’)
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter(’attribute_code’, ‘manufacturer’);
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
return $manufacturers;
}

Displaying Custom Attributes on Product View

Posted Date: August 5, 2009

Adding custom attributes to your product view is very easy. Adding them to the product listing (category pages) is much more difficult. You’ll need to create a custom module for that. In this post though, I’ll only be showing you how to add attributes to the product view page.
If it is a text field (textbox [...]