Monthly Archives: February 2012

Magneto Removal of "/" for Duplicate Link

For SEO reasons store owners will often want to standardise the URL generation in their Magento sometime duplicate link generate for the same page
Ex: will open the same page but why two link it is not standard for SEO purpose
So,for removing “/” from url we need to update changes in the following files

Firstly lets modify the getUrl() method to remove any trailing slashes in generated URLs. Copy the file app/code/core/Mage/Core/Block/Abstract.php to app/code/local/Mage/Core/Block/Abstract.php if it’s not there already.

Open app/code/local/Mage/Core/Block/Abstract.php and find the getUrl() method, it should just be one line of code that returns the requested URL:

return $this->_getUrlModel()->getUrl($route, $params);

Replace that line with the following:
$return_url = $this->_getUrlModel()->getUrl($route, $params);
if ($return_url != $this->getBaseUrl() && substr($return_url, -1) == ‘/’ && !Mage::getSingleton(‘admin/session’)->isLoggedIn()):
return substr($return_url, 0, -1);
return $return_url;

Next Copy the file app/code/core/Mage/Core/Model/Url.php to app/code/local/Mage/Core/Model/Url.php if it’s not there already.

Open app/code/local/Mage/Core/Model/Url.php and find the following:
if ($noSid !== true) {
A little further up the file the variable $noSid is initialised:
$noSid = null;

and change the if statement from:
if ($noSid !== true) {
if ($noSid === false) {

Open .htaccess and find the following rule:
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Immediately after this add the following lines:
RewriteCond %{request_method} ^GET$
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)$ %1 [L,R=301]

and when u open  it will redirect to so this will remove the duplication of links
Hope this will help you


Some time we required to show the NoIndex,Follow in some pages only like CMS page or category page

we can add the following code as per the page in there respective XML

Like we don’t want to show the Contacts us page in NOINDEX,FOLLOW

So open the contacts xml and add the code<reference name=”head”>

<action method=”setRobots”><value>NOINDEX,FOLLOW</value></action>


Just refresh that page and you will get the Page in NOINDEX

Hope this will help you…..

Magento Edit the Shipping and Handling in Cart

Easy way to Edit the Text “Shiping & Handling” in Cart

Open the file  app/code/core/Mage/Sales/Model/Quote/Address/Total/shipping.php

Copy in local folder app/code/local/Mage/Sales/Model/Quote/Address/Total/shipping.php

And search for the  function fetch ()

in that you can edit the text for the “Shipping & handling” to Shipping or Some thing


Hope this will Help You

Magneto add Manufacture in grid Column for Admin

Add the brand/manufacture in grid for admin
Just open the file \app\code\core\Mage\Adminhtml\Block\Catalog\Product\grid.php and
Paste in local folder app\code\local\Mage\Adminhtml\Block\Catalog\Product
and add the below code in  _prepareColumns( ) function

$manufacturer_items = Mage::getModel(‘eav/entity_attribute_option’)->getCollection()->setStoreFilter()->join(‘attribute’,’attribute.attribute_id=main_table.attribute_id’, ‘attribute_code’);
foreach ($manufacturer_items as $manufacturer_item) :
if ($manufacturer_item->getAttributeCode() == ‘manufacturer’)
$manufacturer_options[$manufacturer_item->getOptionId()] = $manufacturer_item->getValue();

‘header’=> Mage::helper(‘catalog’)->__(‘Manufacturer’),
‘width’ => ‘100px’,
‘type’  => ‘options’,
‘index’ => ‘manufacturer’,
‘options’ => $manufacturer_options

Note: Just replace the manufacture by your attribute ID

How to show the Exact search result in Magento

If you want to show the exact search reult for your products
Two things need to be changed1) In admin system->configuration->catalog->catlogsearch->Search Type
Make it as Like
2)Just copy the fulltex.php file  in local folder as given

and just replace the above code

foreach ($words as $word) {
$like[] = $helper->getCILike(‘s.data_index’, $word, array(‘position’ => ‘any’));
if ($like) {
$likeCond = ‘(‘ . join(‘ OR ‘, $like) . ‘)’;


foreach ($words as $word) {
$like[] = ‘`s`.`data_index` LIKE :likew’ . $likeI;
$bind[‘:likew’] = ‘%’ . $queryText . ‘%’;
if ($like) {
$likeCond = ‘(‘ . join(‘ AND ‘, $like) . ‘)’;

and clear the cache and reindex tha data from admin Hope this will help you