search
top

Specific Category Products Magento

Hello All, I am writing here the script to get product collection of a required category. For the below mentioned script we must have the category id for which the product collection is needed. <?php $catagory_model = Mage::getModel('catalog/category')->load($category_id); //where $category_id is the id of the category $collection = Mage::getResourceModel('catalog/product_collection'); $collection->addCategoryFilter($catagory_model);...
read more

Get cart products in Magento

Hello All, I am writing here a script for getting all the product’s id added into cart <?php $product_ids = Mage::getModel('checkout/cart')->getProductIds(); //get cart product ids print_r($product_ids); ?> Hope this is useful
read more

Get Products categories in Magento

Hello All, I am writing here the script to get category ids , for the given product. <?php $product_model = Mage::getModel('catalog/product'); //get product model $all_cats = array(); $product_model->reset(); $_product = $product_model->load($product_id); // $product_id is the given product id $all_cats = $product_model->getCategoryIds($_product); // all the...
read more

List of Email Templates in Magento

I am posting here the method to get the list of Email Templates which we make at admin end (Admin Panel -> System -> Transactional Emails) The below code to be written in Block file. <?php $template_info = array(); $template_collection = Mage::getResourceSingleton('core/email_template_collection'); if(!empty($template_collection)) { $cnt = 0; foreach($template_collection...
read more

Catalog Product Model

While working in Magento, you might have seen that there are various model defined like sales,catalog etc. I am writing here a script for working with catalog product model. <?php $model = Mage::getModel('catalog/product') //get product model //get product collection $collection = $model->getCollection() ->addStoreFilter() //store filter ->addAttributeToSelect('*')...
read more

Next Entries »

top