[ic] show only the items in stock in promo component

Greg Hanson greg at perusion.com
Wed Oct 8 19:02:24 UTC 2014


On 10/8/2014 11:49 AM, Salvador Caballe wrote:
> I just want to show the items in stock, in the promo component
> (standard catalog) but I don't know how modify the search to look 
> inventory table and merchandising table.
>
>
> this is the promo component code:
>
>
> [query arrayref=main
> sql="
> SELECT sku,timed_promotion,start_date,finish_date
> FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either]
> WHERE featured = '[control promo_type specials]'

One way to do it:

SELECT m.sku, m.timed_promotion, m.start_date, m.finish_date
FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either] m, inventory i
WHERE m.featured = '[control promo_type specials]'
AND i.sku = m.sku
AND i.quantity >= 1





> "][/query]
> [perl tables="__UI_MERCH_TABLE__ 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]
>
> best regards
> Salvador Caballé
>
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users


-- 
Greg Hanson
Interchange Consulting
Perusion
1506 E Gilbert Ave
Coeur d'Alene, ID 83815

Email		greg at perusion.com
Phone		208-214-4306

Please Note NEW TOLL FREE NUMBER:
Toll Free	1-855-444-1949

Fax		775-256-2231
Web		http://www.perusion.com
PGP Key		http://www.perusion.com/Greg_Hanson.asc

The one who says it can't be done should never interrupt the one doing it..
Ask us about job opportunities.




More information about the interchange-users mailing list