[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] Problems with discounts
****** message to minivend-users from Chris Rapier <rapier@psc.edu> ******
I'm trying to apply different discounts to different items using the
following:
NB: I'm using a database of keys because it makes the searching much
faster.
The key database looks like
sku sale
1 1
2 .5
3 4
6 3
where sku corresponds to the sku of the sale tiem in the products
database and the sale is the amount off in dollars
[loop search="fi=saleitems/st=db/ra=yes"]
[loop search="fi=products/sf=sku/se=[loop-data saleitems sku]"]
[seti item-discount][loop-data saleitems sale][/seti]
[discount code="[loop-data saleitems sku]"]
my $p = $Scratch->{'item-discount'};
return ($s - $p);
[/discount]
<img border = 0 src =
"http://__SERVER_NAME____IMAGE_DIR__/[loop-field image]"><BR>
<b>[loop-field brand] [loop-field description]</b><br>
<b>Save [currency][scratch item-discount][/currency] off the
regular price of [loop-price]!</b><br>
[currency][calc][loop-price noformat=1]-[scratch
item-discount][/calc][/currency][scratch tax-status] each<br>
[order code="[loop-code]"]Buy Now[/order]<br>
[/loop]
[/loop]
The problem is that all of the items end up have the same discount
amount applied to them corresponding to the discount of the last item
retrieved from the database (e.g. evrerythign on the sale list is
discounter $3). It doesn't seem to matter where I put the [discount]
code. I've a feeling this is because the inner loop is being run against
all the values of the outer loop in each iteration or that I don't
really understand how discount works.
If anyone can lend some help I'd appreciate it.
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list