Adding to cart

So I am trying to put together a simple shopping cart for a client. It is basically a book store, though they offer DVDs and also offer items for loan.


I have followed the example using a cart and checkout page in the Squiz manuals and it is all coming together quite nicely. The method outlined in the example makes use of an ‘asset selection’ for the asset listing of items to select a number of a particular item, then a ‘dynamic parameter’ to send that selection of the item to the cart.



The problem I am encountering is that the user has an option to click on an item in the asset listing to go to a page showing more details about the item (ie the product asset itself, displayed with a paint layout). But I can’t see a way of adding an asset selection or a dynamic parameter to this page.



I am also considering a way of listing items using a search folder rather than an asset listing. Is it possible to set up an asset selection and dynamic parameter in this case?

[quote]
So I am trying to put together a simple shopping cart for a client. It is basically a book store, though they offer DVDs and also offer items for loan.



I have followed the example using a cart and checkout page in the Squiz manuals and it is all coming together quite nicely. The method outlined in the example makes use of an ‘asset selection’ for the asset listing of items to select a number of a particular item, then a ‘dynamic parameter’ to send that selection of the item to the cart.



The problem I am encountering is that the user has an option to click on an item in the asset listing to go to a page showing more details about the item (ie the product asset itself, displayed with a paint layout). But I can’t see a way of adding an asset selection or a dynamic parameter to this page.[/quote]



I’ll reply to myself, in case anyone else has the same problem.



The problem I was having was that in order to add a product to a cart, it had to be selected. This could be done for an asset listing by defining an asset selection ‘add to cart’ with a target of the shopping cart. Product assets selected could then be sent to the cart using a ‘buy’ GET dynamic variable defined for the cart. However, there did not seem to be a way to select an individual product asset, so I didn’t know how to allow a user to select a product when viewing it by itself, i.e. not in an asset listing.



Discussions with Squiz gave me an answer. On the individual page listing of a product, I set up a button as follows: <a class=“button” href="./?a=cart_asset_ID?buy[%asset_assetid%]=1">purchase</a>. This allows one item to be purchased. It is possible to allow a number to be specified by using an input field with name="buy[%asset_assetid%], with a submit button wrapped inside a form with a GET method to the shopping cart url.