Blog

Magento Adding New Category Attribute Without Creating Module

For adding extra attribute to category you need to add below script to your magento root folder and execute it from the URL i.e. http://yoururl/add_category_attribute.php [php] require_once “app/Mage.php”; Mage::app()->setCurrentStore(Mage::getModel(‘core/store’)->load(Mage_Core_Model_App::ADMIN_STORE_ID)); $installer = new Mage_Sales_Model_Mysql4_Setup; // change details below: $attribute = array( ‘type’ => ‘varchar’, ‘label’=> ‘Your attribute label’, ‘input’ => ‘text’, ...

Read More

Magento Display Cross-Selling products on product detail page

Some time we need to display cross sell products on product page, you can use the code below to display cross sell products. [php] <?php if($_crossSellProducts = $_product->getCrossSellProducts()): ?> <div class="topproducts_containter"> <div class="topsellerTitle">TOP <?php echo strtoupper(Mage::getModel(‘catalog/layer’)->getCurrentCategory()->getName()); ?> PRODUCTS</div> <?php foreach ($_crossSellProducts as $_item): ?> <?php $_item = Mage::getModel(‘catalog/product’)->load($_item->getId()); ?> <div ...

Read More

Manipulate collections of products in Magento

Retrieve a collection of products [php] $Products = Mage :: getResourceModel (‘catalog/product_collection’); / * Or * / $Products = Mage :: getModel (‘catalog/product’)->GetCollection(); [/php] Selecting a specific attribute [php] $Products = Mage::getResourceModel(‘catalog/product_collection’) ->AddAttributeToSelect(‘name’) ->AddAttributeToSelect(‘weight’); [/php] Selecting all attributes [php] $Products = Mage::getResourceModel (‘catalog / product_collection’) -> AddAttributeToSelect (‘*’); [/php] Filters ...

Read More