Thursday, 25 April 2013

Add qty box in custom option row Magento

Add qty box in custom option row:

By default Magneto only provide custom options without ant qty, if you want to customize with Qty then you must change in following files:
  1.       app\design\adminhtml\default\default\template\catalog\product\edit\options\type\select.phtml

·         Find the below code:
'<th class="type-sku"><?php echo Mage::helper('catalog')->__('SKU') ?></th>'+
Add these after just after
'<th class="type-qty"><?php echo Mage::helper('catalog')->__('Qty') ?></th>'+
·         Find the below code:
'<td><input type="text" class="input-text" name="product[options][{{id}}][values][{{select_id}}][sku]" value="{{sku}}"></td>'+
Add these after just after
'<td><input type="text" class="input-text" name="product[options][{{id}}][values][{{select_id}}][qty]" value="{{qty}}"></td>'+

  2.       app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php

·         Find the below code:

$value['sku'] = $this->htmlEscape($option->getSku());
Add these code  just after

$value['qty'] = $this->htmlEscape($option->getQty());

·         Find the below code:

'sku' => $this->htmlEscape($_value->getSku()),

Add these code  just after

'qty' => $this->htmlEscape($_value->getQty()),

   3.       Add field in “catalog_product_option_type_value” table

`qty` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Qty',

That’s all….

Monday, 22 April 2013

Add Custom link in my account page Magento

Add Additionla link in Customer Page

1. app/design/frontend/default/theam/layout/customer.xml

2. Add below code in    <customer_account translate="label"> handle left part

<action method="addLink" translate="label" module="customer"><name>test</name><path>customer/test/</path><label>My Test</label></action>

3. add below code in xml file

<customer_test_index translate="label">
    <label>Customer My Test</label>
     <update handle="customer_account"/>

4. craete controller and block file in below location


add code in block file
class Mage_Customer_Block_Test extends Mage_Core_Block_Template
    public function __construct()

add code in testcontroller
class Mage_Customer_TestController extends Mage_Core_Controller_Front_Action
    public function indexAction()
5. create file test.phtml in app/design/frontent/theme/customer/test.phtml

add code in file
<div class="page-title">
    <h1><?php echo $this->__('My Ships'); ?></h1>   

Now login from frontend and you show the test link add in your account page

Saturday, 6 April 2013

Add Discount Label on List page

Open app/design/frontend/yourpackage/yourtheme/template/catalog/product/price.phtml


<?php endif; /* if ($_finalPrice == $_price): */ ?>

add Just after this line

<?php // Discount percents output start ?>
    <?php if($_finalPrice < $_price): ?>
    <?php $_savePercent = 100 - round(($_finalPrice / $_price)*100); ?>
        <p class="special-price yousave">
            <span class="label"><?php echo $this->__('You Save:') ?></span>
            <span class="price">
                <?php echo $_savePercent; ?>%
    <?php endif; ?>
<?php // Discount percent output end ?>

Create Home Page with CategroyProducts and Breadcums

<reference name="breadcrumbs">
        <action method="addCrumb">
            <crumbInfo> <label>Home</label>  <title>Home</title>  <link>/</link>   </crumbInfo>
<reference name="left">
<block type="catalog/layer_view"  name="catalog.leftnav" after="home_left" template="catalog/layer/view.phtml"/>

 <action method="unsetChild"><alias>left.newsletter</alias></action>
<action method="unsetChild"><alias>left.permanent.callout</alias></action>
<reference name="content">
<block type="catalog/product_list" name="home" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>2</category_id></action>

<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<action method="setToolbarBlockName"><name>product_list_toolbar</name><count>5</count></action>

Friday, 5 April 2013

Extension for Vertical Navigation

Add shop by Block on Home Page

Add in Layout Updates

<reference name="left"> <block type="catalog/layer_view" before="-" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/> </reference>
go to  app/code/core/Mage/Catalog/Model/Layer/Filter and open item.php
and replace your getUrl() function to the following one
public function getUrl() { if ($this->getFilter() instanceof Mage_Catalog_Model_Layer_Filter_Category) { $category = Mage::getModel('catalog/category')->load($this->getValue()); return $category->getUrl(); } else { $query = array( $this->getFilter()->getRequestVar()=>$this->getValue(),Mage::getBlockSingleton('page/html_pager')->getPageVarName() => null // exclude current page from urls ); return Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$query)); } }

Remove Blocks in Magneto

<remove name="left.permanent.callout" />  <!--the dog-->
remove name="right.permanent.callout" />  <!--back to school-->
remove name="" />  <!--product compare-->
remove name="paypal.partner.right.logo" />  <!--paypal logo-->
remove name="cart_sidebar" /> <!--cart sidebar-->
remove name="left.reports.product.viewed" /> <!--recently viewed prod-->
remove name="right.reports.product.viewed" /> <!--recently viewed prod-->
remove name="right.reports.product.compared" /> <!--recently compared prod-->

<remove name="paypal.partner.right.logo" />

Thursday, 21 March 2013

Add category Slider With More/Less Functionality

Create  Category Slider with Less/More Functionality

Add Js and CSS

<link href="<?php echo $this->getSkinurl('css/overzichtstyle.css')?>" rel="stylesheet" type="text/css">

<script type="text/javascript" src="<?php echo $this->getSkinurl('js/jquery_002.js');?>"></script>

<script type="text/javascript" src="<?php echo $this->getSkinurl('js/jquery_004.js')?>"></script>

<script type="text/javascript" src="<?php echo $this->getSkinurl('js/expander.js')?>">

<script language="javascript" src="<?php echo $this->getSkinurl('js/seo.js')?>"></script>

Change category view.phtml

    $_helper    = $this->helper('catalog/output');
    $_category  = $this->getCurrentCategory();
    $_imgHtml   = '';
    if ($_imgUrl = $_category->getImageUrl()) {
        $_imgHtml = '<div class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" /></div>';
        $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
<div id="mm_seotextholder">
    <div id="mm_seotextcontent"> <?php if($_imgUrl): ?>
    <?php echo $_imgHtml ?>
<?php endif; ?>
      <h1><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1></h1>
              <?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
    <div class="category-description std">
        <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
    <?php endif; ?>
  <?php if($_imgHtml || $_helper->categoryAttribute($_category, $_description, 'description')):?>
  <!--<span id="mm_seoleesmeer">Lees meer</span>-->  
  <?php endif;?>

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

<?php if($this->isContentMode()): ?>
    <?php echo $this->getCmsBlockHtml() ?>

<?php elseif($this->isMixedMode()): ?>
    <?php echo $this->getCmsBlockHtml() ?>
    <?php echo $this->getProductListHtml() ?>

<?php else: ?>
    <?php echo $this->getProductListHtml() ?>
<?php endif; ?>

Create More Tabs in Product info Tabs on Product View page

Add map tab

Navigate to=>Theam=>Layout=>catalog.xml

Add below code

 <action method="addTab" translate="title" module="catalog"><alias>Location</alias><title>Location</title><block>core/template</block><template>catalog/product/map.phtml</template></action>

Add this code in map.phtml

<script src=""></script>
/* private variables */
var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();

/* function to initialize the map */
function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var mapOptions = {
        zoom: 10,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);

function codeAddress(address, title, imageURL) {
    geocoder.geocode({ 'address': address }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var marker = new google.maps.Marker({map: map,position: results[0].geometry.location,icon: imageURL,title: title});

            /* Set onclick popup */
var infowindow = new google.maps.InfoWindow({content: title});
google.maps.event.addListener(marker, 'click', function() {'map'), marker);});
        } else {
            alert('Geocode was not successful for the following reason: ' + status);

/* Geocoding based on latitude and longitude */
function codeLatLng(latlng, title, imageURL) {
    var latlngStr = latlng.split(',', 2);
    var lat = parseFloat(latlngStr[0]);
    var lng = parseFloat(latlngStr[1]);
    var latlng = new google.maps.LatLng(lat, lng);
    geocoder.geocode({ 'latLng': latlng }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            if (results[1]) {
                marker = new google.maps.Marker({position: latlng,map: map,icon: imageURL,title: title,content: title});

                /* Set onclick popup */
            var infowindow = new google.maps.InfoWindow({content: title});
google.maps.event.addListener(marker, 'click', function() {'map'), marker);});

            } else {
                alert('No results found');
        } else {
            alert('Geocoder failed due to: ' + status);
  <div id="map_canvas" style="height:500px;width:600px;"></div>

/* set  iconpath and the initiate the google map */
var iconPath = "";

/* Geocoding based on latitude and longitude */
codeLatLng('-33.971750, 150.894251', 'Glenfield NSW', iconPath + "icon2.png");


Tuesday, 19 March 2013

for website performance

<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">

Header set Cache-Control "max-age=604800,public"



<IfModule mod_headers.c>

  <FilesMatch "\.(js|css|xml|gz)$">

    Header append Vary: Accept-Encoding