Displaying basket content in productlist or moreinfo screens

This page will explain how to display the basket content in the productlist or moreinfo screens. By default, only the number of products in the shoppingcart can be shown, however, using a simple trick it is possible to also display the complete content with productinformation and prices.

Displaying the number of items in the basket

A few default extensions are available to display the number of items in the basket (like the default myShop menu). These are:

Example

The extension mentioned above can be used to create a shoppingcart block like in the next example:

<div style="myshop-block:basket">
        <span style="myshop-not-has:products">
                No products in basket
        </span>
        <span style="myshop-has:products-1">
                1 product in basket
        </span>
        <span style="myshop-has:products">
                <span style="myshop-value:count">2</span> products in basket
        </span>
</div>

Displaying the basket with complete contents

In order to display the basket with complete contents in the productlist or moreinfo screens you could make smart use of the $custom function and iframes. You can display the shoppingbasket in an iframe in the productlist or moreinfo template, but most of the time you will want a small version for in the productlist and moreinfo screens and a large version for actually ordering the products. Thats where $custom comes in handy. Using the $custom function you can question a variable given in the URL of the shoppingbasket, lets call this variable ‘mode’.

In the URL you can then use custom_mode=big for the large basket, and custom_mode=small for the smaller basket in the iframe. Place two sets of the complete basket code between two different (on the same level) div elements with the following style code:

  • style="myshop-test:{$custom('mode')}=='small'"
    for the small basket and
  • style="myshop-test:{$custom('mode')}=='large'"
    for the large basket.

Using this method you can display a large or small basket depending on your need, displaying the basket in an iframe in the productlist or moreinfo screens or showing the basket in a large fashion for ordering.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment