search
top

Website ID from Store Group ID in Magento

Hello All, I am posting here code for fetching website information from Store Group Id. Also useful code showing relations between Stores, Groups and Websites. < ?php $store_id = 1; //your required store Id will go here $store_model = Mage::getModel('core/store'); //store model $store_group_model = Mage::getModel('core/store_group'); //store group model $website_model = Mage::getModel('core/website');...
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

Display Random Products in Magento

Hello, I have explained the method for displaying random products below: <?php //below code to written in file which extends the product block $collection = Mage::getResourceModel('catalog/product_collection'); Mage::getModel('catalog/layer')->prepareProductCollection($collection); $collection->getSelect()->order('rand()'); $collection->addStoreFilter();...
read more

FAQ section in the Store

Hello All, I have been asked many questions regarding the products in my store. So I sorted out the most frequently asked questions and made a FAQ section in the store. Hope its useful to all my visitors. You can directly visit the section at Decrypt Web Store FAQ Thanks
read more

Useful code in Magento

I am listing here the codes useful in Magento Magento Home URL - Mage::getBaseUrl(); Magento Home Directory - Mage::getBaseDir(); URL of a file in the skin directory - $this->getSkinUrl(‘images/myfile.png’); // in a template or Block - Mage::getDesign()->getSkinUrl(‘images/myfile.png’); // from anywhere Format a price value - Mage::helper(‘core’)->formatPrice($amount); Get...
read more

Magento Essentials

I am listing below important variable used in Magento. <?php echo Mage::app()->getFrontController()->getRequest()->getHttpHost(); //displays host name echo Mage::getBaseDir(); //gives physical path of the sites root directory echo $this->getSkinURL(); //gives relative path of the sites default skin folder echo Mage::getBaseURL(); //gives relative path of the site echo...
read more

top