[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
two questions about modifier-name
I'm having two problems getting modifier-name to work the way I want it
to.
I have a situation where items can have variable numbers of the same
attribute. As an example, suppose I want to sell geometric figures. A
line segment would have one length, x, and a 3-D rectangular solid would
have three, x, y and z.
My intention was to use modifier-name in the following manner:
(on the basket page, catalog.cfg has "UseModifier size color ... lenx
leny lenz ...")
[item-list]
...
[set dimension]lx[/set]
[modifier-name len[scratch dimension]]
[/item-list]
This displays on a page as "[modifier-name lenx]." The substitution
works OK, but the result is not being interpolated. I've tried a number
of different strategiies, including embedded perl, but I can't find a
way to pass a variable to modifier-name and have a proper token
generated. Is such a thing possible?
The second problem is what happens to the modifier values when a
customer removes an item from the middle of the item list in the
basket. If there are 10 items with, say, the plain size attribute, and
the user deletes item #5 from the basket, then, on the refreshed basket
page, items 0-4 are OK, but (new) item 5 has (old) item 5's size, new 6
has old 6's size, etc. Quantity seems to track OK.
N code quantity size
... item s 0-4 ...
5 00-0044 1 medium <-delete this item
6 00-00765 8 small
7 00-00651 4 large
....
transforms to:
... 0-4
5 00-00765 8 medium
6 00-00652 4 small
...
Apparently the surviving items on the new page get new, lower, index
numbers above the deletion, but there is no mechanism in place to adjust
the incoming form variable values.
I'm a little surprised not to find this behavior mentioned before. Am
I using it improperly? I use th conventional means of generating
size-select forms:
<SELECT NAME="[modifier-name size]">
[loop arg="[item-accessories size, options]"]
<FONT SIZE=-2><OPTION [selected [modifier-name size] [loop-code]]
VALUE="[loop-code]">[loop-code]</FONT>
[/loop]
</SELECT>
I notice that in Inerpolate.pm there is a foreach loop that seems to be
taking care of these things. It looks like it takes the modifier number
from the index of the item in the cart. How about if the modifier
number were assigned to the item at the time it is placed in the cart
and so would remain constant for the item independent of its position in
the cart? This would require an additional per-cart variable like 'top'
which would be highest modifier number allocated so far.
so the code might go from :
$run =~ s:$T{'modifier-name'}$Spacef(\w+)\]:$1$i:go;
to
$run =~
s:$T{'modifier-name'}$Spacef(\w+)\]:$1$item->{position}:go;
Does anything else depend on the modifier index being equal to the item
index in the cart? i.e., what would this break?