Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] Discount Tags on index.html (Solved!)



******    message to minivend-users from Sydney Urshan <urshan@nethollywood.net>     ******

Actually, I was using the correct tags.  What happened was when the 
first of the month came around, the code did not compensate for zero 
in 01, 02, etc., so I wasn't getting *any* discount on *any* page as 
I was at the end of the month.  After that was fixed (thanks Mike!), 
the $str was resolving to 20tr ($s = product amount) when a $20 
product was selected, etc. which resulted in an item discount 
([discount_price]), but no final discount ([subtotal]).  So, I 
changed $str to $bit.  Here is the final (I hope!) code:

[loop list='2001 2002 3001 3002']
[discount [loop-code]]
my $bit = $Tag->time('', {}, '%m %d');
my ($month, $n) = split /\s+/, $bit;
$n =~ s/^0//;
my %mon = (
	'01' => 31,
	'02' => 29,
	'03' => 31,
	'04' => 30,
	'05' => 31,
	'06' => 30,
	'07' => 31,
	'08' => 31,
	'09' => 30,
	'10' => 31,
	'11' => 30,
	'12' => 31,
);
if ($mon{$month} and $n > 1) {
           return ($s - ($s / $mon{$month} * $n));
}
return $s;
[/discount]
[/loop]

Now [item-list][discount_price][/item-list] and 
[item-list][item-discount][/item-list] work on every page!

Sydney Urshan

>******    message to minivend-users from Ed LaFrance 
><newmedia@newmediaems.com>     ******
>
>At 12:50 PM 4/29/00 -0700, you wrote:
>  >******    message to minivend-users from Sydney Urshan
>  ><urshan@nethollywood.net>     ******
>  >
>  >I can't get the [item-discount] or [discount_price] tags to work on pages
>  >before basket.html (index, results, flypage, etc.)  They work on the
>  >basket, final, receipt, etc.  The discount I am using is:
>
>Are you using the [item-discount] tag inside of an [item-list][/item-list]
>pair?  If not, you may need to simulate the display of the discount using
>[perl] or [calc] tags.  If the discount shows up correctly in the basket
>and checkout, then it is working, and it is just a matter of getting it to
>display where you want.
>
>- Ed L.
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>| New Media E.M.S.              Software Solutions for Business |
>| 12831 Blanco Ct.              Consulting                      |
>| Poway, CA  92064  U.S.A.      Custom Programming              |
>| 858-486-6508                  Internet and eCommerce          |
>| 630-604-4265 eFax                                             |
>| newmedia@newmediaems.com                                      |
>| http://www.newmediaems.com                                    |
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>I can't get the [item-discount] or [discount_price] tags to work on 
>pages before basket.html (index, results, flypage, etc.)  They work 
>on the basket, final, receipt, etc.  The discount I am using is:
>
>[loop list='2001 2002 3001 3002']
>[discount [loop-code]]
>my $str = $Tag->time('', {}, '%m %d');
>my ($month, $n) = split /\s+/, $str;
>my %mon = (
>	01 => 31,
>	02 => 29,
>	03 => 31,
>	04 => 30,
>	05 => 31,
>	06 => 30,
>	07 => 31,
>	08 => 31,
>	09 => 30,
>	10 => 31,
>	11 => 30,
>	12 => 31,
>);
>if($n == 1) {
>          return ($s);
>}
>elsif ($n > 1) {
>          return ($s - ($s / $mon{$month} * $n));
>}
>[/discount]
>[/loop]
>
>which is placed on the pages in question.
>
>I saw one answer in the archives to use a bit in CommonAdjust, but I 
>am not using that at all.
>
>Thanks,
>
>Sydney Urshan
>
>p.s.  Mike H. - Thanks for the great consulting!
-
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


Search for: Match: Format: Sort by: