Change the ‘add to cart’ button to ‘view product’ in Magento on category page

So you’ve got your webshop with products with different sizes. The ‘add to cart’ button on the category page is sometimes a step too much, because you’ll have to choose a size first.

Changing the button to ‘view product’

Changing the button to ‘view product’ would be a better solution. Open the file list.phtml in: /app/design/frontend/default/{yourskin}/template/catalog/product .

About line 63 and about line 107 replace: <p><button type=”button” title=”<?php echo $this->__(‘Add to Cart’) ?>” onclick=”setLocation(‘<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><span><?php echo $this->__(‘Add to Cart’) ?></span></span></button></p>


<button type=”button” title=”<?php echo $this->__(‘Add to Cart’) ?>” onclick=”setLocation(‘<?php echo $_product->getProductUrl() ?>’)”><span><span>View product</span></span></button>

Magento – Detect if a customer/user is logged in

Ever wondered if it’s possible enabling special features in phtml for logged in clients? Yes, it’s possible. Just with a simple if/else statement.

if ($this->helper('customer')->isLoggedIn()) {
    echo "Special content for customers";
else {
    echo "The special content is not visible for you, login first.";

Now you’re able to display for example your price only to customer that are logged in or give customers that are logged in a discount code.

Creating a contact page with contact information and form

Standard the contact page only has an contact form and lacks contact information. You can fix this as follow:

  1. Create a new page in the admin -> CMS -> Pages
  2. Insert your contact information. In order to insert the contact form, use the following code:

    {{block type=”core/template” name=”contactForm” form_action=”/contacts/index/post” template=”contacts/form.phtml”}}

  3. Save your page and link to this contact page.
  4. Your contact page is finished!

Adding a Magento Blog Feature to your webshop

Magento Blog Plugin
Nice example of a Magento Blog

A blog is an important factor in respect to SEO for your webshop. Unfortunately the Magento Community Edition doesn’t offer a blog feature.

Fortunately Aheadworks created a plugin that creates a blog for Magento. It’s easily implementable with Magento Connect. Download it.

Install it and clear the cache.

Setting up the blog

Go to: Admin -> System -> Configuration -> Aheadworks -> Blog.

At the enable dropdown, choose ‘yes’. The blog is enabled now. Set up a ‘blog title’ and a ‘route to blog’. Go to YOURWEBSITE.COM/YOURROUTETOBLOG . If everything is alright, the blog should work. Else, try to remove the cache / refresh indices.

At Blog -> Add post you can add new blogposts.

Common problems

The admin shows a blank page when opening the plugin

It’s easy to fix this. Log out from the admin panel, clear the cache, login and open the plugin again. It should work.

Creating discount for your customers in Magento

Ever wondered how to set up discount for your customers? Here’s a how to guide:

Discount based on a coupon code

1. So you would like to create a discount based on a coupon code? Log in to your admin, go to promotions -> shopping cart pricerules and click on ‘add new pricerule’. Give the rule a name.

2. Select all discount groups with ctrl or shift. Select ‘specific coupon’ on the dropdown and at ‘discount code’ enter your discount code.

You can specify an end date as well at ’till date’.

Don’t want to use coupon code?

If you don’t want to use a coupon code, skip step 2.

Discount amount

Navigate to the tab ‘actions’ and at the field ‘discount amount’ enter the amount of discount you would like to give with the coupon. You can choose a fixed amount or a percentage at the dropdown ‘apply’.

How to import / export categories in Magento

A common problem in Magento is the lack of an import / export program in Magento. One of the solutions is importing / exporting directly to the MySQL database, but there is a nice plugin as well, made by user Santhosh, well known from the Magento Commerce Forum.

Install the plugin by uploading it to your webdir. In the admin, a menu Santhosh will appear. You can run it now in order to import/export. The category sheet will appear in the following CSV format.

Export file .csv of categories

Download this plugin or read the forum post

Creating a Magento multidomain website

So you have a Magento webshop, but you would like to add additional Magento subwebshops linked to your webshop? Than the Magento Multi-store feature could be something for you.

First you’ll have to add a store or website. Most of the time a store is good enough since it uses the same client database. After adding a store, add a storeview and remember the code of the storeview.

After that make sure the domains are pointed in the same webhosting package or linked. In order for Magento to know what domain has to be linked to a store code, add the following code in .htaccess:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(.*)
RewriteRule ^ – [E=MAGE_RUN_CODE:substore_en]

In this case the domain: will be linked to the storeview: substore_en . After this, make sure the storeview is set up correctly in Magento. Go to: System > Configuration > Web and edit the url’s (insert

After that, refresh cache. Everything should work now.

Google Adwords and Magento – Conversion tracking

So you started an Adwords campaign and would like to measure leads and conversions via Adwords. That’s possible of course! First, go to Adwords and to Conversions. Create a conversion and copy the code. It will look something like this:

<!– Google Code for Bestelling Conversion Page –>
<script type=”text/javascript”>
/* <![CDATA[ */
var google_conversion_id = XXXXX;
var google_conversion_language = “en”;
var google_conversion_format = “3”;
var google_conversion_color = “ffffff”;
var google_conversion_label = “YYYYY”;
var google_conversion_value = 0;
/* ]]> */
<script type=”text/javascript” src=””>
<div style=”display:inline;”>
<img height=”1″ width=”1″ style=”border-style:none;” alt=”” src=””/>

Go to the file /app/design/frontend/default/default/template/checkout/success.phtml and add at the bottom of the file:

$order_details = Mage::getModel(‘sales/order’)->loadByIncrementId(Mage::getSingleton(‘checkout/session’)->getLastRealOrderId());
$adwords_saleamt = $order_details->subtotal;

Copy your Google Adwords code as well under this code. Under var google_conversion_value = 0; create a line and add:

if (<?php echo $adwords_saleamt; ?>) {
google_conversion_value = <?php echo $adwords_saleamt; ?>;

Source: With thanks to:

Removing login step Magento

A common used unnecessary step is the login step. Most people are not interested in getting account. Therefore it could be better removing this step.

Excellence Magento Blog created a good solution that removes the login step.
Remove the login step in Magento

Go to and follow the instructions or like them on Facebook in order to get the complete file.

Shipping based on location and weight (table rates)

Would you like to make a shipping system based on location and weight?

  1. Login to Magento
  2. Go to System -> Configuration -> Select scope on website level -> Go to Shipping -> Table Rates
  3. Click on the button Export to CSV
  4. Edit the CSV and insert a new row for each condition

The table rates sheet will look about this (don’t copy the first row):

Country,State,Zip-Code,”Subtotal and above”,Shipping Costs


So in the country column you place the column. In the state/province column * means all states/provinces. Subtotal and above means the subtotal for which the shipping rule is valid. And for shipping costs you will set the shipping costs that will be charged.