Magento Admin – link to product from category page

Want to link to a product directly from the category page in the Magento admin?  So did we. It ended up being rather simple and here’s how we did it:

Open the file /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php

You’ll see a function “protected function _prepareColumns()” around line 100. Within that function, you’ll see where all the columns get added to the Category Products tab.   After the last column that’s being added and before the line “return parent::_prepareColumns();” add the following:

$this->addColumn('action',
            array(
                'header'    => Mage::helper('catalog')->__('Action'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                    array(
                        'caption' => Mage::helper('catalog')->__('Edit'),
                        'url'     => array(
                            'base'=>'*/catalog_product/edit',
                            'params'=>array('store'=>$this->getRequest()->getParam('store'))
                        ),
                        'field'   => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
        ));

Now we don’t have to keep 2 tabs open and go back and forth between the catagory page and product pages.  There’s a link directly to the products within the category page.  We’re running 1.4.2, but I suppose this should work with virtually any Magento version.

And obviously you may want to override the Magento core file by putting this in your own module so it doesn’t get removed when you upgrade the core.

Enter coupon codes in checkout page

We had a request from a client to add the ability for the user to enter a coupon code on the checkout page recently.  On a sidenote, I was very surprised that this isn’t already included in the Magento core.  In any case, I was pleased to find that the very day I was going to start development to add this capability to my client’s site, an extension was released that did exactly what we needed.  We had to do a little CSS massaging to fit with our Magento template, but it was for the most part just plug-and-play.

Check out the Coupon Step extension

The extension was $15 when we got it and it’s $25 now so (not surprisingly) they must be getting a pretty good response to it.  To see it integrated on our client’s site, go to Ngnutrition.com and add a product to your cart and proceed to checkout.  As of the time of this writing, if you want to get something from their site you can Like them on Facebook and they’ll give you a coupon code to use with your purchase.