[ic] Setting a modifier after it is in the cart
Angus Rogerson
arogerson at uwaterloo.ca
Wed Jul 8 19:59:32 UTC 2015
Hello list,
I am trying to sell access codes for on-line materials using IC 5.8. The codes are issued one at a time by an external vendor as they are sold. I allow the customer to select which products he needs and put the products in the IC shopping cart with an mv_order_route set. When the customer checks out, the route is executed and calls a custom UserTag which uses an API from our vendor to purchase/retrieve an access code. I am able to display that code in an email to the customer. I would like to also save the code in the shopping cart so that I can display it on the receipt. I have a modifier set up in the cart to receive this information but can't figure out how to set it.
I was hoping that
[item-list]
[seti order_result][orderaccesscode blah blah blah][/seti]
[item-modifier name=voucher set=[order_result]]
[/item-list]
would record the return result in the modifier called voucher. However, Vend::Interpolate does not seem to support setting a modifier. I suspect that item-list is merely a copy of the items from the cart so I can't use it to write back to the cart. Further, this probably would not work because of the way the item=list parsing interacts with the parsing of true ITL tags.
So, do I need to search for the sku by looping through the items in $Vend::Items or $Carts->{main} to find the corresponding product then write the order_result into $Carts->{main}[my_item_line_number]->{voucher} = $::Scratch->{order_result}? Something like:
for my $i = 0 to number of items in cart
if $Carts->{main}[$i]->{sku} = current sku
$Carts->{main}[$i]->{voucher} = $::Scratch->{order_result}
Or is there an easier, more robust way?
Thanks in advance for any suggestions.
Angus
---
Angus Rogerson, BMath, BScN, RN
Duct Tape Programmer
University of Waterloo | Retail Services | Information Systems
Visit Us Online & Right On Campus www.retailservices.uwaterloo.ca
More information about the interchange-users
mailing list