[ic] Re: adding extra information into the shopping cart structure

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Thu Oct 10 08:36:01 2002


John Allman writes: 

> Mike Heins wrote: 
> 
>> As with most IC things, it is just a perl data structure.
>>  $Session = {
>>                carts => {
>>                    main => [],
>>                    newcart => [
>>                         { code => 'foo', quantity => 1, mv_ib => 
>> 'products' },
>>                        ],
>>                },
>>             etc => 'etc.',
>>        }; 
>> 
>>   
>> 
> Hi - just a quick query here. I posted this a few hours ago under a 
> different thread, but since it is in fact a different issue i though i 
> should start a seperate thread. sorry if this annoys anyone! 
> 
> Am i right in thinking that if i want to add a new key and value to the 
> shopping cart data scructure it is pretty straightforward? I am 
> considering going with a one shopping basket solution and just having 
> something on the basket page to indicate that an item ordered was ordered 
> via the "quick catalog order" option. I'm thinking that it should be 
> possible for me to put something like quickorder => 1 in the perl 
> structure and then access it on the basket page with [item-quickorder]. Am 
> i right in thinking this and if so could you tell me the correct syntax? 
> 
> i'm thinking maybe something like 
> 
> $lastitem = pop($Session->{carts}->{main});
> $lastitem->{'quickorder' => 1};

I doubt that is valid Perl syntax. Try: 

$lastitem->{quickorder} = 1; 

> push($Session->{carts}->{main},$lastitem);

Or in the shorthand: 

$Items->[$#$Items]->{quickorder} = 1 

> 
> could something like that work and could i access it with 
> [item-quickorder] on the basket page? is there a better way to do what i'm 
> looking for?

Don't try to invent ITL :-;, give [item-field quickorder] a shot. 

You may need AutoModifier quickorder in the configuration. 

Bye
     Racke 


-- 
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.