[ic] simple --if product is varient-- on flypage question

Peter peter at pajamian.dhs.org
Fri Oct 10 01:11:43 UTC 2008


On 10/09/2008 12:30 PM, Rick Bragg wrote:
> This seems to be the month of me asking a million questions!
> Anyway,
> 
> Is there a simple way on the product flypage to find out if the arg is a
> real product or a variant?
> 
> in other words:
> 
> [fly-list code="[data session arg]"]
> 
> [bogus]
> if arg is in products table,
>   this is a real product, just show it!
> elsif arg is in the variants table,
>   this is a variant, bounce to sku... and select this variant!
> /if
> [/bogus]


Well, if none of your skus have a dash in them you can check the sku for 
the dash that separates the sku from the options:

[if-item-pos 0 =~ /-/]
    This is a variant.
[else]
    This is a real sku.
[/else][/if-item-pos]

If that won't work for you then you may be stuck with testing to see if 
the sku is in the products table.  This requires an extra hit to the 
database, though:

[if-item-data products sku]
    This is a real sku.
[else]
    This is a variant.
[/else][/if-item-data]

Peter



More information about the interchange-users mailing list