[ic] adding extra information into the shopping cart structure

John Allman interchange-users@icdevgroup.org
Thu Oct 10 08:02:01 2002


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};
push($Session->{carts}->{main},$lastitem);

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?

thanks

John Allman