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:
especially for this purpose this extension creates a basket block in which the following extensions can be used
results in true if there are no products in the shoppingbasket
results in true if there is exactly 1 product in the shoppingbasket
result in true if there are more then 1 products in the shoppingbasket
displayes the exact count of products in the shoppingbasket
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:
for the small basket and
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.