Skip to main content

Posts

Combine products of 2 categories in to one category I created 4 categories. Category 1, 2 , 3, 4 all have 50 + 50 + 50 + 50 products, I created category 5 and category 6 , I want to add products of "category 1 & 2" to Category 5 I want to add products of "category 3 & 4" to Category 6. below is the solution for this in magento site. $category1Id = 1; $category2Id = 2; $category5Id = 5; //get the category instances $category1 = Mage::getModel('catalog/category')->load($category1Id); $category2 = Mage::getModel('catalog/category')->load($category2Id); $category5 = Mage::getModel('catalog/category')->load($category5Id); //get products from the first 2 categories $category1Products = $category1->getProductsPosition(); $category2Products = $category2->getProductsPosition(); //merge the products into one big array $merged = array_merge($category1Products, $category2Products); //assigned the merged products t...

get Active shipping methods and payment methods

Active Shipping methods $activeCarriers = Mage::getSingleton('shipping/config')->getActiveCarriers();             // $allCarriers = array();             foreach ($activeCarriers as $carrierCode => $carrierModel) {                 $allCarriers[$carrierCode] = array('value' =>  Mage::getStoreConfig('carriers/' . $carrierCode . '/title'), 'label' => Mage::getStoreConfig('carriers/' . $carrierCode . '/title')); Or ( $allCarriers[$carrierCode] = array('value' =>  $carrierCode,  'label' => Mage::getStoreConfig('carriers/' . $carrierCode . '/title'));             }             return $allCarriers; Active Payment methods $payments = Mage::getSingleton('payment/config')->getActiveMethods();             $payMethods = array();         ...

get product group names and attribute set name by loading attbute set id

get product group names and attribute set name by loading attbute set id $product = Mage::getModel('catalog/product')->load(16);        //attribute set model.         $model = Mage::getModel('eav/entity_attribute_set');        // product attribute set id.         $attributeSetId = $product->getAttributeSetId();         $attributeSet = $model->load($attributeSetId);          // This is attribute set name.         $attributeSetName = $attributeSet->getAttributeSetName(); $groups = Mage::getModel('eav/entity_attribute_group') ->getResourceCollection() ->setAttributeSetFilter($attributeSetId) ->setSortOrder() ->load(); foreach ($groups as $group)  echo $groupName          = $group->getAttributeGroupName(); }

order cancel from front end

if you want cancel order from front end create module like this app/etc/modules/<Namespace_Modulename>.xml <config>     <modules>         <Namespace_CustomerOrderCancel>             <active>true</active>             <codePool>community</codePool>             <depends>                 <Mage_Sales />             </depends>         </ Namespace _CustomerOrderCancel>     </modules> </config> app/community/Namespace/Modulename           ------controllers           -------etc           -------Helper if you want cancel button in history page (myorder) need override block file Mage_Sales_Block_Orde...