NWDthemes magento extensions FAQ

Ajax Cart: how to add related products to success popup

If you using NWDthemes Ajax Cart and you want to have the related products on the success pop-up notification when you add an item to the basket, you just need to make small changes in a single file – app\code\community\Nwdthemes\Nwdajax\controllers\CartController.php

Find

protected function _getCartSuccessMessage($msg, $product)

and update it to

    protected function _getCartSuccessMessage($msg, $product)
    {
        Mage::register('product', $product);
        $this->loadLayout();
        $_block = $this->getLayout()
            ->createBlock('catalog/product_list_related')
            ->setTemplate('catalog/product/list/related.phtml');

        return '<div class="center_content">'
            . $this->__($msg, Mage::helper('core')->escapeHtml($product->getName()))
            . '<div class="buttons-container">'
            . sprintf($this->_btnTemplate, 'btn-location-cart', Mage::getUrl('checkout/cart'), $this->__('View Cart'))
            . sprintf($this->_btnTemplate, 'btn-location-checkout', Mage::helper('checkout/url')->getCheckoutUrl(), $this->__('Checkout'))
            . '</div>'
            . ($_block ? $_block->toHtml() : '')
            . '</div>';
    }

Thanks a lot,
NWDthemes team

Leave a Reply

Your email address will not be published. Required fields are marked *