0
<?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">
    <?php foreach ($this->getItems() as $_item): ?>
        <li class="item">
            <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(75); ?>" width="75" height="75" 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; ?>

my checkout.xml at /app/design/frontend/default/{myThemeName}/layout/checkout.xml

<checkout_cart_index translate="label">
        <label>Shopping Cart</label>
        <remove name="right"/>
        <remove name="left"/>
        <!-- Mage_Checkout -->
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/cart" name="checkout.cart">
                <action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
                <action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
                <action method="chooseTemplate"/>
                <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
                <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
                <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>

                <block type="core/text_list" name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" translate="label">
                    <label>Empty Shopping Cart Content Before</label>
                </block>

                <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
                    <label>Payment Methods Before Checkout Button</label>
                    <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
                </block>

                <block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
                    <label>Shopping Cart Items Before</label>
                </block>

                <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
                    <label>Payment Methods After Checkout Button</label>
                    <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.bottom" template="checkout/onepage/link.phtml"/>
                    <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
                </block>

                <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
                <block type="core/text_list" name="checkout.cart.extra" translate="label">
                    <label>Checkout Forms Extra</label>
                </block>
                <block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
                <block type="core/text_list" name="checkout.cart.widget" as="checkout_cart_widget" translate="label">
                    <label>Shopping Cart Items After</label>
                </block>
                <block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>

                <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
            </block>
        </reference>
        <block type="core/text_list" name="additional.product.info" translate="label">
            <label>Additional Product Info</label>
        </block>
    </checkout_cart_index>
0

It's important to know that the cross-sells are displayed in the shopping cart page.

1) Check if you have set the config in the product in question : admin->catalog->manage products->select the product->cross sells in the right side bar

2) Check if you have well : <?php echo $this->getChildHtml('crosssell') ?> in app/design/frontend/{package}/{theme}/template/checkout/cart.phtml

3) Check if you have well the crosssell block name="checkout.cart.crosssell" in the checkout.xml else you can add it app/design/frontend/{package}/{theme}/layout/local.xml then add this:

<checkout_cart_index>
    <block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
</checkout_cart_index>

4) Reindex all

5) Clear your Magento and browser cache.

  • Do you want me to change this Code in Base and I Don't have the app/design/frontend/{package}/{theme}/layout/local.xml i.e., local.xml file – Kiran Padma Jul 25 '17 at 10:58
  • And what is the [frontend/{package}/{theme}] – Kiran Padma Jul 25 '17 at 11:00
  • Why base ? are you using a base package ? frontend/{package}/{theme} mean your current package/your current theme – PЯINCƏ Jul 25 '17 at 11:01
  • No am not using base package. – Kiran Padma Jul 25 '17 at 12:12
  • So use your corrent package and current theme – PЯINCƏ Jul 25 '17 at 12:14

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.