On a product page with the add to basket button I'm capturing a screenshot. The screenshot's ID and NAME are passed to the basket page(g.newimage_id, g.newimage_name). On the basket page if there is a value for the ID I save it and the NAME to custom basket fields. At the bottom of the basket contents I display all custom basket fields. The problem is that if the Write_Basket statement is executed then the display all custom basket fields forgets everything except the field it just saved. For example if I have two items in the basket when I add the third the only custom basket fields that show any values belong to the third item.
third.jpg
If I go to the store front and back to basket, the Write_Basket would not be executed and then all the custom basket fields appear.
home.jpg
This is the code I'm using. It's located at the bottom of the basket contents.
Anyone see a reason for the loss of data when writing to a custom basket fired?
third.jpg
If I go to the store front and back to basket, the Write_Basket would not be executed and then all the custom basket fields appear.
home.jpg
This is the code I'm using. It's located at the bottom of the basket contents.
Code:
<mvt:comment>if adding a product to the basket save the ID and NAME values</mvt:comment> <mvt:if expr="g.newimage_id EQ '' "> <mvt:else> <mvt:item name="customfields" param="Write_Basket( 'id' $ g.newimage_id, g.newimage_id )" /> <mvt:item name="customfields" param="Write_Basket( 'name' $ g.newimage_id, g.newimage_name )" /> </mvt:if> <mvt:comment>display all custom basket fields</mvt:comment> <mvt:item name="customfields" param="Read_Basket( '' )" /> <mvt:foreach iterator="basket" array="customfields"> <mvt:comment>use the name field to call the saved image</mvt:comment> <mvt:if expr=" 'name' CIN l.settings:BASKET:code "> Code:&mvte:basket:code; - Value:&mvte:basket:value;<br/> <img src="&mvt:global:domain:base_url;screenshots/&mvte:basket:value;" style="max-width:500px;"><br/> </mvt:if> </mvt:foreach>