Quantcast
Channel: Magento Development – Coding Basics
Viewing all articles
Browse latest Browse all 21

Remove the Magento Wishlist Feature

$
0
0

A lot of store owners are not amused by Magento’s Wishlist feature. They think it’s a useless feature and want to have it removed from their stores to smoothen up their product pages and to get rid of the bells and whistles. Unfortunately, there are a lot of un-experienced Magento Developers who remove the Wishlist feature the wrong way. This can cause security threats to your store, and it may even break your store when installing new extensions.

In this tutorial, we will show you the correct way to remove the Wishlist feature from Magento. This tutorial is aimed at Magento version 1.9.x. There are 2 ways to remove the wishlist feature from Magento. We will go through both of them, so you can see which one is easier for you to use. Both methods are equally good in terms of Magento development code rules.

Remove the Wishlist feature from files

The first method consists of removing all Wishlist code from your cart template files. Open up your text editing software and navigate to the following files:

checkout/cart.phtml
checkout/cart/item/default.phtml
downloadable/checkout/cart/item/default.phtml

Open them one by one and remove the wishlist column. You’ll need to do this to these files, and custom cart templates if you have those.

Create a small Extension

The second method consists of creating a small extension that removes the wishlist function from your Magento store without you having to edit .phtml files. To start, you’ll have to make sure that the Mage_Wishlist_Helper_Data::isAllowInCart returns false always. We will now create the extension which we will call CodingBasics_RemoveWishlist. Create the following files on your FTP client.

Create the Module Declaration file in the following path:

app/etc/modules/CodingBasics_RemoveWishlist.xml

<?xml version="1.0"?>
<config>
    <modules>
        <CodingBasics_RemoveWishlist>
            <codePool>local</codePool>
            <active>true</active>
            <depends>
                <Mage_Wishlist />
            </depends>
        </CodingBasics_RemoveWishlist>
    </modules>
</config>

You will also need to create a configuration file for the extension:

app/code/local/CodingBasics/RemoveWishlist/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <CodingBasics_RemoveWishlist>
            <version>1.0.0</version>
        </CodingBasics_RemoveWishlist>
    </modules>
    <global>
        <helpers>
            <wishlist>
                <rewrite>
                    <data>Easy_Wishlist_Helper_Data</data> <!-- Tell Magento to use your own created helper instead of the default one -->
                </rewrite>
            </wishlist>
        </helpers>
    </global>
</config>

After that, we need to create a helper for our extension:

app/code/local/CodingBasics/RemoveWishlist/Helper/Data.php

<?php 
class CodingBasics_RemoveWishlist_Helper_Data extends Mage_Wishlist_Helper_Data 
{
    public function isAllowInCart()
    {
        return false;
    }
}

Upload all these files to your store in their correct location. Clear the cache and disable compilation. If everything went correctly you should now see that the Wishlist feature is inactive. If you have further questions about this Magento extension, please ask them in the comment section below for a quick reply.

The post Remove the Magento Wishlist Feature appeared first on Coding Basics.


Viewing all articles
Browse latest Browse all 21

Trending Articles