Htaccess: How to redirect URL from www to non-www?

Posted by Damodar Bashyal on February 28, 2012

 

This is the universal code for redirection. First of all lets redirect from www to non-www with our .htaccess file.

#Use this for non-ssl URL redirection
<IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

More»

Magento Table rate: How to customise/override?

Posted by Damodar Bashyal on February 27, 2012

 

Our client is using table rate shipping method but he needed slightly modification on the default one. They want to set shipping price on the product level (optionally). So, if shipping is defined for the product then use that to calculate shipping of the order.

If the product is set as 'free' then exclude it's price from shipping. If it's left empty or set as 'default' then just use the rate from table. But if the product has custom shipping price, then add that on the shipping.

This is how I modified the magento's official table rate shipping module/extension.

First of all, go to Magento admin / Catalog / Attributes / Manage Attributes and add new attribute with Attribute code 'tn_table_rate' with input type 'Text Field' and label 'Shipping Cost'. Then add it to your Attribute Set.

More»

Magento - How to add new image upload field in Manage Categories

Posted by Damodar Bashyal on February 23, 2012

 

I needed an extra image field for a category so that i can use image uploaded there as background image on that category page. So, that clients can have special backgrounds on festive seasons and other special events.

Here I am just going to show how to add new field quickly and easily without breaking anything.

First login to PHPmyadmin and select the database. Then run below sql code and take a note of inserted ID, 969 was in my case.

More»