search
top

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

Get child categories in Magento

Hello All, I am writing here a script for getting all the child categories of the required category id <?php $category_model = Mage::getModel('catalog/category'); //get category model $_category = $category_model->load($categoryid); //$categoryid for which the child categories to be found $all_child_categories = $category_model->getResource()->getAllChildren($_category);...
read more

Category Name Magento

Hello all, I am writing here the code for getting category information of the known category id. <?php $catagory_model = Mage::getModel('catalog/category'); $categories = $catagory_model->load($id); // where $id will be the known category id if(!empty($categories)) { echo 'category name->'.$categories->getName(); //get category name echo 'category image...
read more

Category Tree Magento

Hello all, I am listing here the method to display Category Tree, you can further modify the script for getting products etc. This can be written in any phtml file, but its a better practice to make a model for this. <?php $cat_mod = Mage::getModel('catalog/category'); $_main_categories=$this->getStoreCategories(); if ($_main_categories): foreach ($_main_categories as $_main_category): ...
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