Uncategorized

Get Top 10 Products in Magento

$collection= Mage::getResourceModel(‘catalog/product_collection’)->addAttributeToSelect(‘*’)->setStoreId($storeId)->addStoreFilter($storeId)->setOrder(‘ordered_qty’, ’desc’)->setPageSize(10) ; foreach($collection as $product){$name=$product->getName();$productId=$product->getId();$price=$product->getPrice();}

Get Magento Urls in Phtml Page

Get Base Url :Mage::getBaseUrl();Get Store Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);Get Skin Url :Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);$this->getSkinUrl(‘images/imagename.jpg’);Get Media Url :Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);Get Js Url : Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);Get Current UrlMage::helper(‘core/url’)->getCurrentUrl();Get Home UrlMage::helper(‘core/url’)->getHomeUrl();

1 14 15 16 32