Skip to main content

Posts

Showing posts from June, 2014

Display Related Product In view.phtml

Follow the below steps to display related products. 1. Open catalog.xml, found in app/design/frontend/default/YOURTEMPLATE/layout/ 2. In catalog.xml find the catalog_product_view section, around line 220. In the section, remove or comment out: <block type= “catalog/product_list_related”  name= “catalog.product.related”  before= “-” template = “catalog/product/list/related.phtml” /> and replace with: <reference name= “content” > <block type= “catalog/product_view”  name= “product.info”   template = “catalog/product/view.phtml” > <block type= “catalog/product_list_related”  name= “catalog.product.related”  as= “related” template = “catalog/product/list/related.phtml” /> </block> </reference> 3. Now in your catalog/product/view.phtml you can print out the related products using <?php echo $ this ->getChildHtml( ‘related’ ); ?> To edit the look of that list, edit catalog/product/list/related.p

Product Image is missing when open product page from backend

put all sku in update_missing_image.csv with header sku Like :  sku             1             2 put that csv file in root folder of magento Create a file with the name  update_missing_images.php and put this file into root dir of magento Put following code in same file <?php /**  * @author      MagePsycho <info@magepsycho.com>  * @website     http://www.magepsycho.com  * @category    Export / Import  */ $mageFilename = 'app/Mage.php'; require_once $mageFilename; Mage::setIsDeveloperMode(true); ini_set('display_errors', 1); umask(0); Mage::app('admin'); Mage::register('isSecureArea', 1); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); set_time_limit(0); ini_set('memory_limit','1024M'); /***************** UTILITY FUNCTIONS ********************/ function _log($message, $file = 'update_missing_images.log'){     Mage::log($message, null, $file); } function _getIndex($fiel

Identify Home page in Magento

<?php $routeName = Mage::app()->getRequest()->getRouteName(); $identifier = Mage::getSingleton('cms/page')->getIdentifier(); if($routeName == 'cms' && $identifier == 'home') { echo 'You are in Homepage!'; } else { echo 'You are NOT in Homepage!'; } ?>

Insert Data from excel into database

<?php //your database connection here... //$_POST["Import"]   this is data which you want to insert $sql=''; if(isset($_POST["Import"])) { $filename=$_FILES["file_product"]["tmp_name"]; $type=$_FILES["file_product"]["type"]; //print_r($_FILES);  if($_FILES["file_product"]["size"] > 0) {   $file = fopen($filename, "r"); while (($emapData = fgetcsv($file, 50000, ",")) !== FALSE) {  if($emapData[0]!="")  {   $t=mysql_escape_string(trim($emapData[2]));   $t1=strlen($t);   $city=mysql_escape_string(trim($emapData[7]));   $city1=strlen($city);   $state=mysql_escape_string(trim($emapData[8]));   $state1=strlen($state);   $zip=mysql_escape_string(trim($emapData[9]));   $zip1=strlen($zip);   $sql=rtrim($sql,','); $sql ="insert into yourtable (phone_no, firstname, lastnam

Add Rating Star in product in magento

Step :1   Go to app/design/frontend/base/default/template/catalog/product/view.phtml   In the  view .phtml  file find the following code  <?php //echo $this->getReviewsSummaryHtml($_product, false, true)?> Replace with this code:  <?php echo $this->getReviewsSummaryHtml( $_product, 'short' )?>

ADD “HOME” LINK IN MAGENTO TOP NAVIGATION MENU

design/frontend/default/yourtheme/template/page/html/topmenu.phtml /*design/frontend/default/yourtheme/template/catalog/navigation/top.phtml*/ replace following code to:- <?php $_menu = $this ->getHtml( 'level-top' ) ?> <?php if ( $_menu ): ?> <div class = "nav-container" >      <ul id= "nav" >           <!-- HOME BUTTON HACK -->          <?php $_anyActive = false; foreach ( $this ->getStoreCategories() as $_category ) { $_anyActive = $_anyActive || $this ->isCategoryActive( $_category ); } ?>          <li class = "<?php echo !$_anyActive ? 'active' : '' ?>" ><a href= "<?php echo $this->getUrl('')?>" ><?php echo $this ->__( 'Home' ) ?></a></li>          <!-- HOME BUTTON HACK -->          <?php echo $_menu ?>      </ul> </div> <?php endif ?>