[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Discounted fields in minivend database
****** message to minivend-users from "kyle@invisio.com" <kyle@invisio.com> ******
I have not used the discount tag as selectively as you are attempting,
but here are a few things to try/check:
1) in your code
> [discount [item-code]]
> $s = $original;
> $discounted = $s * .75;
> $difference = $s - $discounted;
> return $discounted;
> [/discount]
[discount [item-code]]
should be written [discount code="[item-code]"]
2) $s is the database price for the item, so to save it for latter
calculations you should reverse the left and right vars in the line:
$s = $original; (otherwise you just erased your price!)
also you don't need the additional vars and math. If you
are taking 75% off of the price just use:
[discount code="[item-code]"]
return ($s * .25);
[/discount]
3) your if statement won't work, it should
be more like:
[if [item-field Category] =~ /Shirts|Suits|Blazers|Dress/]
(I think that is right, not tested)
So all together it should be like:
[if [item-field Category] =~ /Shirts|Suits|Blazers|Dress/]
[then]
[discount code="[item-code]"]
return ($s * .25);
[/discount]
[/then]
[/if]
Also you said at one point "I don't think it ever actually
entered the if tag" --- there is an easy way to find out,
simply try your if tag like:
[if [item-field Category] =~ Shirts,Suits,Blazers,Dress]
[then]
IT WORKED!
[/then]
[/if]
and if you don't see the words IT WORKED! on the page,
then you would be right, it never entered. This is a good way
to debug or build MV pages (or even other programs), try little
pieces of code to make sure they work then start combining
them 1 at a time to make sure it does what you expect.
Kyle Cook (KC)
At 05:00 PM 1/21/00 -0600, you wrote:
>****** message to minivend-users from Brent Worley <brent@12ave.com>
>******
>
>After much time and headache, I have yet to have the [discount] tag be
>selective about what it discounts. I have tried minivends if/else tags
>and I have tried embeded perl code. I'm going to present both and see if
>anyone has any suggestions or reasons why this code doesn't work.
>
>[if [item-field Category] =~ Shirts,Suits,Blazers,Dress]
>[then]
> [discount [item-code]]
> $s = $original;
> $discounted = $s * .75;
> $difference = $s - $discounted;
> return $discounted;
> [/discount]
>[/then]
>[/if]
>
>This one produced a lot of uncertain results. I don't think it ever
>actually entered the if tag. Here is what I had for perl code.
>
>[perl interpolate=1]
> if(('[item-field Category]' =~ /^Suits/i) || ('[item-field Category]' =~
>/^Dress/i) || ('[item-field Category]' =~ /^Shirts/i) || ('[item-field
>Category]' =~ /^Blazers/i)
> {
> return [item-subtotal] * .75;
> }
> {
> return [item-subtoal];
> }
>[/perl]
>
>We have been trying to get either one of these tags to work but with no
>luck. If anyone sees any logic flaw or incompatibilities, please let me
>know. Thanks.
>
>Brent Worley
>brent@12ave.com
>
>-
>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
-
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