[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Re: adding extra information into the shopping cart structure
racke@linuxia.de wrote:
> John Allman writes:
>
>> racke@linuxia.de wrote:
>>
>>> John Allman writes:
>>>
>>>>
>>>> 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
>>
>> Ok - i'm getting places. i have the following in the page for the
>> quick catalog order:
>> [set altercart]
>> [perl]
>>
>> $Session->{carts}->{main}->[$Tag->nitems(main)-1]->{quickorder}=1;
>> [/perl]
>> [/set]
>> and later:
>> <input type=hidden name=mv_check value=altercart>
>> i found that if i put the code in mv_click it wasn't executed before
>> the item was added to the cart - but this way seems to work. [dump]
>> reveals the following in the ##### ###### SESSION ##### bit:
>> 'carts' => { 'main' => [ { 'spprice' => undef, 'userdiscount' =>
>> undef, 'quickorder' => 1, 'mv_ip' => '0', 'code' => '0115163400',
>> 'size' => undef, 'mv_ib' => 'products', 'quantity' => 1, 'color' =>
>> undef } ] }
>> so it looks like quickorder has been added and assigned the value 1.
>> good stuff so far.
>> however i'm having difficulty getting it back out in the basket page.
>> [item-field quickorder] returns nothing. i added a line AutoModifier
>> quickorder into the catalog.cfg but that doesn't appear to improve
>> matters either...
>
>
> Hm, then try [item-modifier quickorder].
> Ciao
> Racke
>
Thanks to both jerry and racke - [item-modifier quickorder] works just
fine! I'm not too sure how these modifier things work but am i right in
thinking that i could somehow use the form submission process to mark
quickorder=1 instead of the nasty bit of perl i currently have? Also can
somebody explain the difference between AutoModifier and UseModifier?
thanks
John