If you have a Dynamicweb eCommerce based website you may have placed a global basket in the master file (DW7 design or old style master template). Here is a quick and dirty example of controling html should be included if the basket is not empty.
<!--@If Defined(Ecom:Order.OrderLines.Count)-->
<li class="bag"><a href="shopping-basket.aspx"><img src="basketIcon.gif" alt="Basket contains <!--@Ecom:Order.OrderLines.Count--> items" />Basket</a></li>
<!--@EndIf(Ecom:Order.OrderLines.Count)-->
This may be a part of a “servicemenu” for instance at the top right of the page, therefore I have used an LI as container. There is a link to a page which shows the complete basket. The reason that I have add an alternative text on the icon which informs about the number of items in the basket is that I have found out the sometimes the if-defined will not work if the tag is not used on the page…
Do you want to share a quick-and-dirty code snippet for Dynamicweb or Dynamicweb eCommerce, please feel free to contact me.
Hi Steen
I saw your article, and its very useful. But how do you make a global basket?
Do you have some link to any documentation on that subject?
Thanks
//Bille
Hi Bille,
Actually Dynamicweb will expose tags related to basket if the basket if some orderlines exists (the visitor has added goods to the basket).
All this is ofcause only possibel if you have a Dynamicweb eCommerce installed and set up on the website.
The code lines above can be copy’n'pasted into a MASTER template. The master template can be inside a layout template (/files/templates/design/[yourTemplateFolder]/master.html) or the old style master template (/files/templates/master/myMaster.html) .
You may write to me netsi1964@gmail.com if you need more help.
/Sten
Hi Steen,
Great, I think have figured it out. The addcart command adds products to “all baskets” in the setup. So I made a new basket and then I have 2 baskets:
1. One with the “global template”
2. One which is the step basket.
thats very versatile.
//thanks :-)