
music at labyrinth
Jul 2, 2009, 6:24 PM
Post #1 of 3
(695 views)
Permalink
|
|
timed-build and discount tag
|
|
Hi I am using a modified merchandising table to build a list of timed discounted items. I then loop through the table and adjust pricing for all discounted items. This works great and it allows us to apply discounted items with start and end dates. i.e. Discounted July 4th only. However I am trying to set up caching of the discounted items using timed-build so we don't have to loop through and find the discounted items on every page load. i.e. [comment]apply discounts and cache[/comment] [timed-build file=discountcache reparse=1 force=1 minutes="10"] [.query arrayref=main sql=" SELECT sku,timed_promotion,start_date,finish_date FROM merchandising WHERE discount = 'discounted' "][/query] [perl tables="merchandising"] my @out; my $ref; my $db; delete $Scratch->{promo_codes}; my $date = $Tag->time( { body => '%Y%m%d' } ); $ref = $Tmp->{main} or return; for(@$ref) { my $line = $_; push(@out, $line->[0]), next if ! $line->[1]; next if $line->[2] gt $date; next if $line->[3] lt $date; push @out, $line->[0]; } $Scratch->{promo_codes} = join(' ', @out); return; [/perl] [loop list="[scratch promo_codes]" ] [discount [loop-code]] $s - $q * [loop-data merchandising discountminus][/discount] [/loop] <!--discounts applied [time]%k:%M%p[/time]--> [/timed-build] With the above code the cached file only includes the "discounts applied time' text (last line) and the list of discounted items appears as blank lines. It all works perfectly if I remove the timed-build. How do I get IC to write the list of discounted items to the cached file or is there another way of caching a loop of [discount] tags? _______________________________________________ interchange-users mailing list interchange-users [at] icdevgroup http://www.icdevgroup.org/mailman/listinfo/interchange-users
|