$layer = Mage::getSingleton(‘catalog/layer’);$_category = $layer->getCurrentCategory();$currentCategoryId= $_category->getId();
4x Masonry Grid
In PHTML<?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘yourblockid’)->toHtml(); ?> IN CMS{{block type=”cms/block” block_id=”yourblockid“}}
$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 Base Url :{{store url=””}}Get Skin Url :{{skin url=’images/imagename.jpg’}}Get Media Url :{{media url=’/imagename.jpg’}}Get Store Url : {{store url=’mypage.html’}}
For database connection$write = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);$qry=”Select * from tablename”;$execute=$write->query($qry);$fetch=$execute->fetch() To get the Row Count $count=$execute->rowCount();
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();
In ADMIN end System -> Configuration->General->Design Click on “Design” in the left side menu and open the “Header” section Change…
In Catalog.xmlPlease Comment following code <!–<reference name=”left”><block type=”catalog/layer_view” name=”catalog.leftnav” after=”currency” template=”catalog/layer/view.phtml”/> </reference> –>
Recent studies have shown that in the near future (by 2014) more people will use mobile devices ( iPod, iPhone,…
In this tutorial, we will introduce the coding of Magento in the form of a “Hello World”-style module. The goal…
Currency In Dropdown format In page.xml add the Block if not exist <block type=”directory/currency” name=”currency” as=”currency” template=”directory/currency.phtml”/> Template File /app/design/frontend/template/Your_Interface/YOUR-TEMPLATE-NAME/template/directory/currency.phtml…
My Account/app/design/frontend/Your-Interface/Your-Theme/layout/customer.xml My cart and Checkout/app/design/frontend/Your-Interface/Your-Theme/layout/checkout.xml My Wishlist/app/design/frontend/Your-Interface/Your-Theme/layout/wishlist.xml
$order_id = 100; //order id goes here$_order = Mage::getModel(‘sales/order’)->load($order_id); $_cctype = ”;if(!empty($_order)){ $_cctype = $_order->getPayment()->getCcTypeName();}echo $_cctype;
If local.xml does not exist,create it /you_theme/layout/ and add the following code Ctalog.xml{{block type=”catalog/navigation” name=”catalog.topnav” template=”catalog/navigation/top.phtml”}}
Delete the locks files from var/locks or Delete var folder and create it again and give 777 premission then tried…
You can get the current page URL and it’s parameters (if any) by using getCurrentUrl() method in Magento. Below code…
Here, you will see how to create Catalog Price Rule in Magento through code. Catalog Rules are applied on products…
Create Order Below is the php code to create an order in magento. It requires a valid customer account with…
The more popular the platform is the more it is talked about. As online merchant “spinning in eCommerce circles” you…
Create the Home Products file In my theme I created a copy of the list.phtml called home_list.phtml /app/design/frontend/base/theme156/template/catalog/productShow the file…
Sometimes we need to check the current host name in magento. Here is the function that returns the hostname of…
irst of All before writting about the best seller products in magento. Here is the file you can use to…
While testing, use only the credit card numbers listed here. Other numbers produce an error.Expiration Date must be a valid date…
Sometimes we need to show thumbnail image for custom attribute in magento admin grid. As we might know it is…