7

You wouldn't believe how much time I've spent researching/trying to make this happen. All I want is to have an extra page come up in the order process after the product page asking the customer which cross-sell product(s) they want to add to their order (I would call them up-sell but I guess the Magento lingo is "cross-sell"). I really find it unbelievable that more businesses don't want this (I think "up-selling" can greatly increase profits and what's built into Magento does not really work so well (I have more than 20 "Cross-sell" products and they don't even fit/show on there).

I'm using Magento ver. 1.9.1.0.

I just installed the Porto Theme #11 if that makes a difference

NEW INFO: I've been trying to implement this but no luck so far. I even have someone helping me now but we can't figure it out. Can someone please give step-by-step instructions on how to do this? (ANY solution would be much appreciated).

I would like it to work similar to what proflowers.com has (see the enclosed screenshot): enter image description here

They have this page come up as the next step AFTER customer adds a product to the cart (clicks on PROCEED TO CHECKOUT)

All the cross-sell products are ALWAYS the SAME for everyone (every product ordered)


Edited on November 15th, 2016:

The solution that got awarded the 100 reputation actually works. Anyone trying to do what I am trying to do should download the files and upload them into your root directory and then add the following code in your app/code/community/TM/SuggestPage/controllers/IndexControlle‌​‌​r.php file:

$block2 =  $this->getLayout()->createBlock('checkout/cart_coupon')->setTemplate('checkout/cart/coupon.phtml');
$this->getLayout()->getBlock('content')->append($block2);

I am still trying to figure out how to display 12 products on the special Cross-sell page instead of just 4. Accoring to @MurtuzaZabuawala - this should be done by modifying the crosssell.phtml file in:

app/design/frontend/YourPackge/YourTheme/checkout/cart/

I found my crossell.phtml here:

/public_html/app/design/frontend/smartwave/porto/template/checkout/cart

(I hope it's the right one - I have the Porto Theme installed)

Here is what it looks like:

<?php
/**
 * Cart cross sell items template
 *
 * @see Mage_Checkout_Block_Cart_Crosssell
 */
$store = Mage::app()->getStore();
$code  = $store->getCode();
$aspect_ratio = Mage::getStoreConfig("porto_settings/category/aspect_ratio",$code);
$ratio = ($aspect_ratio || (!$aspect_ratio && Mage::getStoreConfig("porto_settings/category/ratio_width",$code) == 0))?1:(Mage::getStoreConfig("porto_settings/category/ratio_height",$code)/Mage::getStoreConfig("porto_settings/category/ratio_width",$code));
?>
<?php if($this->getItemCount()): ?>
<div class="crosssell">
    <h2><?php echo $this->__('Based on your selection, you may be interested in the following items:') ?></h2>
    <ul id="crosssell-products-list" class="row">
    <?php foreach ($this->getItems() as $_item): ?>
        <li class="item col-sm-6 col-md-3">
            <a class="product-image" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(84,84*$ratio); ?>" width="84" height="<?php echo 84*$ratio ?>" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
            <div class="product-details">
                <h3 class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h3>
                <?php echo $this->getPriceHtml($_item, true) ?>
                <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                <ul class="add-to-links">
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                        <li><a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
                    <?php endif; ?>
                    <?php if($_compareUrl=$this->getAddToCompareUrl($_item)): ?>
                        <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </li>
    <?php endforeach; ?>
    </ul>
    <script type="text/javascript">decorateList('crosssell-products-list', 'none-recursive')</script>
</div>
<?php endif; ?>

EDITED December 2nd, 2016:

This is a great solution which works perfect especially if you want to assign different cross-sell products to each product individually. In my case - I want all of my products to have the EXACT SAME cross-sell products and I want to be able to change that depending on the season so I decided to have the extra step in the check-out (solution provided by Murtuza Zabuawala below) display products from a special category I created just for this reason. Murtuza Zabuawala did a great job with. I'm just missing the final step here:

When I put in the code which should display the products from a specific category:

$block = $this->getLayout()->createBlock('catalog/product_list')->set‌​CategoryId(157)->set‌​Template('catalog/pr‌​oduct/list.phtml'); $this->getLayout()->getBlock('content')->append($block);

I get the following Error message:

> There has been an error processing your request
> 
> 
> SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
> error in your SQL syntax; check the manual that corresponds to your
> MySQL server version for the right syntax to use near ')' at line 1,
> query was: SELECT `mg_catalog_category_entity`.* FROM
> `mg_catalog_category_entity` WHERE (entity_id =)
> 
> Trace:
> #0 /home/mystore/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110):
> Zend_Db_Statement_Pdo->_execute(Array)
> #1 /home/mystore/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
> #2 /home/mystore/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
> #3 /home/mystore/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238):
> Zend_Db_Adapter_Abstract->query('SELECT `mg_cata...', Array)
> #4 /home/mystore/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `mg_cata...', Array)
> #5 /home/mystore/public_html/lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
> #6 /home/mystore/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(943):
> Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))
> #7 /home/mystore/public_html/app/code/core/Mage/Catalog/Model/Resource/Abstract.php(698):
> Mage_Eav_Model_Entity_Abstract->load(Object(Mage_Catalog_Model_Category),
> Object(Mage_Catalog_Model_Category), NULL)
> #8 /home/mystore/public_html/app/code/core/Mage/Core/Model/Abstract.php(225):
> Mage_Catalog_Model_Resource_Abstract->load(Object(Mage_Catalog_Model_Category),
> Object(Mage_Catalog_Model_Category), NULL)
> #9 /home/mystore/public_html/app/code/core/Mage/Catalog/Block/Product/List.php(80):
> Mage_Core_Model_Abstract->load(Object(Mage_Catalog_Model_Category))
> #10 /home/mystore/public_html/app/code/core/Mage/Catalog/Block/Product/List.php(142):
> Mage_Catalog_Block_Product_List->_getProductCollection()
> #11 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(918):
> Mage_Catalog_Block_Product_List->_beforeToHtml()
> #12 /home/mystore/public_html/app/code/core/Mage/Core/Block/Text/List.php(43):
> Mage_Core_Block_Abstract->toHtml()
> #13 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(919):
> Mage_Core_Block_Text_List->_toHtml()
> #14 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(637):
> Mage_Core_Block_Abstract->toHtml()
> #15 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(581):
> Mage_Core_Block_Abstract->_getChildHtml('content', true)
> #16 /home/mystore/public_html/app/design/frontend/smartwave/porto/template/page/1column.phtml(49):
> Mage_Core_Block_Abstract->getChildHtml('content')
> #17 /home/mystore/public_html/app/code/core/Mage/Core/Block/Template.php(241):
> include('/home/mystore/pu...')
> #18 /home/mystore/public_html/app/code/core/Mage/Core/Block/Template.php(272):
> Mage_Core_Block_Template->fetchView('frontend/smartw...')
> #19 /home/mystore/public_html/app/code/core/Mage/Core/Block/Template.php(286):
> Mage_Core_Block_Template->renderView()
> #20 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(919):
> Mage_Core_Block_Template->_toHtml()
> #21 /home/mystore/public_html/app/code/core/Mage/Core/Model/Layout.php(555):
> Mage_Core_Block_Abstract->toHtml()
> #22 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390):
> Mage_Core_Model_Layout->getOutput()
> #23 /home/mystore/public_html/app/code/community/TM/SuggestPage/controllers/IndexController.php(32):
> Mage_Core_Controller_Varien_Action->renderLayout()
> #24 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418):
> TM_SuggestPage_IndexController->indexAction()
> #25 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250):
> Mage_Core_Controller_Varien_Action->dispatch('index')
> #26 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172):
> Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
> #27 /home/mystore/public_html/app/code/core/Mage/Core/Model/App.php(354):
> Mage_Core_Controller_Varien_Front->dispatch()
> #28 /home/mystore/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
> #29 /home/mystore/public_html/index.php(87): Mage::run('', 'store')
> #30 {main}

my

app/code/community/TM/SuggestPage/controllers/IndexControlle‌​‌​r.php

looks like this:

<?php

class TM_SuggestPage_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()


{

    $this->loadLayout()
        ->_initLayoutMessages('checkout/session')
        ->_initLayoutMessages('catalog/session');



$block2 =  $this->getLayout()->createBlock('checkout/cart_coupon')->setTemplate('checkout/cart/coupon.phtml');
$this->getLayout()->getBlock('content')->append($block2);


    $_product = Mage::getModel('catalog/product')->load(1); //here 1 is product Id
    $block = $this->getLayout()->createBlock('catalog/product_list')->set‌​CategoryId(157)->set‌​Template('catalog/pr‌​oduct/list.phtml'); $this->getLayout()->getBlock('content')->append($block);



    $this->renderLayout();
    }
}

When I tried the following code instead (in: app/code/community/TM/SuggestPage/controllers/IndexControlle‌​‌​r.php ):

**

$category = Mage::getModel('catalog/category')->load(190);  
   $block = $this->getLayout()->createBlock('catalog/product_list')->set‌​Category($category)->set‌​Template('catalog/pr‌​oduct/list.phtml'); $this->getLayout()->getBlock('content')->append($block);

**

  • it gave me this Error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your

MySQL server version for the right syntax to use near ')' at line 1, query was: SELECT mg_catalog_category_entity.* FROM mg_catalog_category_entity WHERE (entity_id =)

Trace:
#0 /home/mystore/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110):

Zend_Db_Statement_Pdo->_execute(Array) #1 /home/mystore/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #2 /home/mystore/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) #3 /home/mystore/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT mg_cata...', Array) #4 /home/mystore/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECTmg_cata...', Array) #5 /home/mystore/public_html/lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array) #6 /home/mystore/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(943): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select)) #7 /home/mystore/public_html/app/code/core/Mage/Catalog/Model/Resource/Abstract.php(698): Mage_Eav_Model_Entity_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL) #8 /home/mystore/public_html/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Catalog_Model_Resource_Abstract->load(Object(Mage_Catalog_Model_Category), Object(Mage_Catalog_Model_Category), NULL) #9 /home/mystore/public_html/app/code/core/Mage/Catalog/Block/Product/List.php(80): Mage_Core_Model_Abstract->load(Object(Mage_Catalog_Model_Category)) #10 /home/mystore/public_html/app/code/core/Mage/Catalog/Block/Product/List.php(142): Mage_Catalog_Block_Product_List->_getProductCollection() #11 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Catalog_Block_Product_List->_beforeToHtml() #12 /home/mystore/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #13 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml() #14 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml() #15 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true) #16 /home/mystore/public_html/app/design/frontend/smartwave/porto/template/page/1column.phtml(49): Mage_Core_Block_Abstract->getChildHtml('content') #17 /home/mystore/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mystore/pu...') #18 /home/mystore/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/smartw...') #19 /home/mystore/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #20 /home/mystore/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml() #21 /home/mystore/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml() #22 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput() #23 /home/mystore/public_html/app/code/community/TM/SuggestPage/controllers/IndexController.php(33): Mage_Core_Controller_Varien_Action->renderLayout() #24 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): TM_SuggestPage_IndexController->indexAction() #25 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index') #26 /home/mystore/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #27 /home/mystore/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #28 /home/mystore/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array) #29 /home/mystore/public_html/index.php(87): Mage::run('', 'store') #30 {main}

Error log record number: 573016373867

Does my Controller.php suppose to look like this?

<?php


class TM_SuggestPage_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()


{

    $this->loadLayout()
        ->_initLayoutMessages('checkout/session')
        ->_initLayoutMessages('catalog/session');


$block2 =  $this->getLayout()->createBlock('checkout/cart_coupon')->setTemplate('checkout/cart/coupon.phtml');
$this->getLayout()->getBlock('content')->append($block2);


    $_product = Mage::getModel('catalog/product')->load(1); //here 1 is product Id
    $category = Mage::getModel('catalog/category')->load(190);  
   $block = $this->getLayout()->createBlock('catalog/product_list')->set‌​Category($category)->set‌​Template('catalog/pr‌​oduct/list.phtml');

$this->getLayout()->getBlock('content')->append($block);

    $this->renderLayout();
    }
}

EDITED December 29th, 2016:

The solution posted by Murtuza Zabuawala is great! The only thing I still need to do is put some code in to call up (display) products from a specific category instead of the actual cross-sell items. Any idea how to do that?

8
+100

Install below extension that will help you to create extra page after cart

https://github.com/tmhub/suggestpage

above extension add extra page after cart and that page you will add these code and you will get cross-sell product data

change your indexController indexAction as below

public function indexAction()
{
    $this->loadLayout()
        ->_initLayoutMessages('checkout/session')
        ->_initLayoutMessages('catalog/session');

    $_product = Mage::getModel('catalog/product')->load(1); //here 1 is product Id
    $block =  $this->getLayout()->createBlock('checkout/cart_crosssell')->setProduct($_product)->setTemplate('checkout/cart/crosssell.phtml');
    $this->getLayout()->getBlock('content')->append($block);

    $this->renderLayout();
}

and for your 4 product issue please check in your app/design/frontend/YourPackge/YourTheme/checkout/cart/crosssell.phtml file any condition who breaks for loop after four product then change it.

to increase limit for cross-sell product follow this quick step

1) copy app/code/core/Mage/Checkout/Block/Cart/Crosssell.php file to app/code/local/Mage/Checkout/Block/Cart/Crosssell.php

2) find this line and increase limit as per your need protected $_maxItemCount = 4;

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

3
+25

We've implemented something on a client website where you click on proceed to checkout you land on a page before it asking you to add free samples, these are pulled in from a category but would be just as easy to pull in some cross-sell/related products.

Essentially code wise what would have to happen is, a module would have to listen for the event controller_action_predispatch_checkout_onepage_index and redirect the user to a page built by that module with the products you require, then after that set a session flag to say this user has already seen this up-sell page and allow them through to the checkout.

I'm not sure if there are any modules out there that currently do this.

As a brief example we have this as our xml:

<controller_action_predispatch_checkout_onepage_index>
    <observers>
        <namespace_module>
            <class>namespace_module/observer</class>
            <method>redirectToUpsellOnCheckout</method>
        </namespace_module>
    </observers>
</controller_action_predispatch_checkout_onepage_index>

Edit 15/11/16 Here's what i have so far, still needs some amends:

app/etc/modules/

<?xml version="1.0"?>
<config>
    <modules>
        <Dc_Crosssells>
            <active>true</active>
            <codePool>community</codePool>
        </Dc_Crosssells>
    </modules>
</config>

app/code/community/Dc/Crosssells/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Dc_Crosssells>
            <version>0.0.1</version>
        </Dc_Crosssells>
    </modules>
    <global>
        <blocks>
            <dc_crosssells>
                <class>Dc_Crosssells_Block</class>
            </dc_crosssells>
        </blocks>
        <events>
            <controller_action_predispatch_checkout_onepage_index>
                <observers>
                    <dc_crosssells>
                        <class>Dc_Crosssells_Model_Observer</class>
                        <method>controllerActionPredispatchCheckoutOnepageIndex</method>
                    </dc_crosssells>
                </observers>
            </controller_action_predispatch_checkout_onepage_index>
        </events>
    </global>
    <frontend>
        <routers>
            <beforeyoucheckout>
                <use>standard</use>
                <args>
                    <module>Dc_Crosssells</module>
                    <frontName>before-you-checkout</frontName>
                </args>
            </beforeyoucheckout>
        </routers>
        <layout>
            <updates>
                <dc_crosssells>
                    <file>dc/dc_crosssells.xml</file>
                </dc_crosssells>
            </updates>
        </layout>
    </frontend>
</config>

app/code/community/Dc/Crosssells/Model/Observer.php

<?php
class Dc_Crosssells_Model_Observer
{
    public function controllerActionPredispatchCheckoutOnepageIndex(Varien_Event_Observer $observer)
    {
        if(Mage::getSingleton('core/session')->getCrossSellFlag()) {
            Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl() . 'before-you-checkout');
            Mage::getSingleton('core/session')->setCrossSellFlag('true'); 
        }
    }

}

That above is enough to redirect the user to another page after hitting going to checkout. Would need to set a flag within this observer to the session and then check if that flag exists, if it does, do the redirect.

Then we can create a controller this will be our "before-you-checkout" page, it creates/renders the layout using a block from the template. app/code/community/Dc/Crosssells/controllers/IndexController.php

<?php
class Dc_Crosssells_IndexController extends Mage_Core_Controller_Front_Action
{

    public function indexAction()
    {
        $this->loadLayout(array('default'));

        $block = $this->getLayout()->getBlock('before.you.buy')->getBlockHtml('before.you.buy');
        $this->getLayout()->getBlock('content')->append($block);
        $this->_initLayoutMessages('core/session');
        $this->renderLayout();
    }

}

We have a block class to house the functions needed by the frontend block, I haven't fully tested this, it is supposed to return a product collection filtered by the category you should have created in the backend, in my case it's category 292. app/code/community/Dc/Crosssells/Block/BeforeYouBuy.php

<?php
class Dc_Crosssells_Block_BeforeYouBuy extends Mage_Core_Block_Template
{
    public function getCrossSellProductsFromCategory()
    {
        $category = Mage::getModel('catalog/category')->load(292);

        $products = Mage::getModel('catalog/product')->getCollection()
            ->addCategoryFilter($category)
            ->addAttributeToSelect('*');

        return $products;
    }
}

app/design/frontend/base/default/layout/dc/dc_crosssell.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <beforeyoucheckout_index_index>
        <reference name="content">
            <block type="dc_crosssells/beforeYouBuy" name="before.you.buy" template="dc/crosssell.phtml"/>
        </reference>
    </beforeyoucheckout_index_index>
</layout>

app/design/frontend/base/default/template/dc/crosssell.phtml

<?php $products = $this->getCrossSellProductsFromCategory();

foreach($products as $item) {
    echo $item->getName(). '<br />';
}

I haven't fully tested this code properly yet and still needs some work to actually display the products properly with add to cart buttons etc. I've put it in a github repo here: https://github.com/DanCarlyon/MagentoCrossSellPage

Feel free to download and have a play with it.

  • what you have sounds exactly like what I need! I don't mind putting all the cross-sell products into a category and having that displayed. Is there any way you could give me more details about how I may be able to implement this? I did manage to actually get an extra step in the check-out process (I installed the "SuggestPage" extension from Murtuza Zabuawala /right above your post here/) but it only displays 4 cross-sell items from the cross-sells that are actually associated with that product in the Admin. Any help would be really appreciated! ;-) – Allysin Nov 8 '16 at 21:22
  • I will try and update my answer today with a more full solution, i don't really know anything about the suggestpage extension and don't currently have a test environment to test it on. :) – DanCarlyon Nov 9 '16 at 10:56
  • I'm really interested in this - I think adding the cross-sell products from a category would really do what I am trying to accomplish – Allysin Nov 15 '16 at 6:39
  • Hi @Allysin really sorry for the delay, i've updated my answer with some of the code i have been able to write, although it's still not quite complete. But there is a github repo where you can download what i have written and have a play with it. – DanCarlyon Nov 15 '16 at 11:22
0

Try this module:

File : app\etc\modules\Rkt_CrossSell.xml

true community File : app\code\community\Rkt\CrossSell\etc\config.xml

1.0.0 Rkt_CrossSell_Helper Rkt_CrossSell_Block rkt_crossell.xml File : app\code\community\Rkt\CrossSell\Block\Catalog\Product\View\Crosssell.php

/**
 * Get crosssell items
 *
 * @return array
 */
public function getItems()
{
    $items = $this->getData('items');
    if (is_null($items)) {
        $items = $this->getProduct()->getCrossSellProducts();
        $this->setData('items', $items);
    }
    return $items;
}

} File : app\code\community\Rkt\CrossSell\Helper\Data.php

} File : app\design\frontend\base\default\layout\rkt_crossell.xml

Now in your view.phtml add this code in the appropriate position

getChildHtml('crosssell') ?> Now clear your cache. Double check evey file name and file paths are correct. Then you are good to go

You can add a block on product page or else call the phtml file inside a cms page.

  • Thank you for helping. Let me ask you this - Do I understand it correctly that I would insert the code in the grey box into the 5 files you mention and then add the getChildHtml into view.phtml? Would that create an extra page in the check-out process and display the cross-sell products on it? I'm open to any solution that would display at least 12 cross-sell products in such a way that customers just wouldn't be able to miss them...Thank you – Allysin Nov 8 '16 at 21:28
  • If you want to display all the cross sell product at the time add to cart you can show in popup using the events and observers in Magento. Like you can use "checkout_cart_product_add_after" and there you have to show all the cross sell product in a popup or as your suggested design. – Asheem Patro Nov 9 '16 at 6:00
  • You can also perform a ajax add to cart to the cross sell products – Asheem Patro Nov 9 '16 at 6:01
  • thank you very much for your suggestions. A pop-up sounds wonderful but the problem here is going to be that I am not versed enough in these things to implement it. I can use FTP to upload files and make changes to existing files but without step-by-step instructions - I will not be able to figure out how to set that up... :-( – Allysin Nov 15 '16 at 6:36
  • For doing so fisrt you have to make a ajax add to cart in your magento. Then using observer you can show the related cross sell or up sell products in a window and there also you have to make an ajax add to cart for the cross sell products. To make this happen you will needing a lot of efforts :-) – Asheem Patro Nov 15 '16 at 7:21
0

Try Below code For category rendering

   $category = Mage::getModel('catalog/category')->load(157);  
   $block = $this->getLayout()->createBlock('catalog/product_list')->set‌​Data('category_id',$category)->set‌​Template('catalog/pr‌​oduct/list.phtml'); 
   $this->getLayout()->getBlock('content')->append($block);
  • I did and got an Error also (I posted that Error on top in my original post). – Allysin Dec 2 '16 at 7:29
  • 1
    @Allysin we need to look I cannot say why this error is coming – Murtuza Zabuawala Dec 2 '16 at 7:45
  • @Allysin check updated answer – Murtuza Zabuawala Apr 19 '17 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.