Posts

Showing posts from January, 2015

To Get the Magento backend Value

###To add a field in backend and to get the backend value in magento### Step1: If you want to add any custom field goto the etc/system.xml file of that module and add it.(you can just copy paste the any block and change the name of that block) Step2: Now your copied field will display on the backend,place some value and save it. Step3: Now  search Your assign value in the data base,you will find the value in core_config_data example: I have  placed the input value as 42721212 database in core_config_data table: cloudzoom/general/zoom_width     42721212 Step 4: To get the value use helper,Search the helper model in the file and use getCfg() to get the value here $h=Mage::getStoreConfig('cloudzoom/general/zoom_width ',Mage::app()->getStore()); or $h=Mage::getStoreConfig('cloudzoom/general/zoom_width'); echo $h;            

Cms Page and Static Block Magento

{{block type="core/template" template="page/home_ban.phtml"}} // to call the phtml file in cms page or static block {{block type="catalog/product_list" category_id="254" template="catalog/product/list1.phtml"}} //to call the product listing page on home page with category id (make a duplicate of list.phtml and rename as list1.phtml) {{block type="catalog/product_list" category_id="4871" template="catalog/product/list2.phtml"}} //to call the product listing page on home page with category id (make a duplicate of list.phtml and rename as list1.phtml) <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('testmenu')->toHtml() ?>//to call the static block in php file

To Get the Distinct Product from Two Categories

<?php $_cat = new Mage_Catalog_Block_Navigation(); $curent_cat = $_cat->getCurrentCategory(); $curent_cat_id = $curent_cat->getId(); function getCategoryCount($cid,$bid){ $productss = Mage::getModel('catalog/product')->getCollection()     ->joinField('category_id_1', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left')     ->joinField('category_id_2', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left')     ->addAttributeToFilter('category_id_1', array('eq' => $cid))     ->addAttributeToFilter('category_id_2', array('eq' => $bid));     echo count($productss); } $currentUrl = Mage::helper('core/url')->getCurrentUrl(); ?> <div class="block_listing">     <div class="block block-layered-nav">         <div class=...

Responsive Switch "Responsive Design" or "Desktop view"

Step 1: Download and reference responsive-switch.min.js in the <head> of your responsive website's HTML code.         <script src="http://filzhut.net/projects/responsive-switch/static/scripts/libs/responsive-switch.min.js"></script> Step 2: Add the following link to your website:         <a href="#" class="rs-link" data-link-desktop="Switch to desktop version" data-link-responsive="Switch to responsive / mobile version"></a> Done.