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"/>
</customer_myships_index>

4. craete controller and block file in below location

app/code/core/mage/customer/block/test.php

add code in block file
class Mage_Customer_Block_Test extends Mage_Core_Block_Template
{
    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('customer/test.phtml');
       
    }
}
app/code/core/mage/customer/controllers/TestControler.php

add code in testcontroller
class Mage_Customer_TestController extends Mage_Core_Controller_Front_Action
{
  
    public function indexAction()
    {
        $this->loadLayout();
        $this->getLayout()->getBlock('content')->append(
            $this->getLayout()->createBlock('customer/test')
        );    
        $this->renderLayout();
       
       
          
      
    }
   
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>   
   
</div>


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

find

<?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; ?>%
            </span>
        </p>
    <?php endif; ?>
<?php // Discount percent output end ?>

Create Home Page with CategroyProducts and Breadcums


<reference name="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo> <label>Home</label>  <title>Home</title>  <link>/</link>   </crumbInfo>
        </action>  
</reference>
<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>
<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"/>
 </block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name><count>5</count></action>
</block>
 </reference>

Friday 5 April 2013

Extension for Vertical Navigation

http://www.magentocommerce.com/magento-connect/Rico+Neitzel/extension/763/vertical-navigation-with-css-classes

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

http://www.magentocommerce.com/knowledge-base/entry/turning-on-off-magentos-content-blocks

<remove name="left.permanent.callout" />  <!--the dog-->
   <
remove name="right.permanent.callout" />  <!--back to school-->
   <
remove name="catalog.compare.sidebar" />  <!--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" />