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

Thomas J.M. Burton tom at globalfocusdm.com
Fri Oct 10 17:22:23 UTC 2008

Peter wrote:
> 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
Rather than checking for the sku in the products table, what about 
checking for the "code" field (the variant table's key)? Since the 
products table doesn't have a field named "code", its presence would 
indicate the product is in the variants table without the extra db hit 
from using the if-item-data method.

[if-item-field code]
    Code field is present, this is in the variants table.
    No code field, this is in the products table.

I haven't thoroughly tested this, so I'm not entirely sure if it will work.

Also, the catalog in which I did a little testing gave me a "sorry, we 
couldn't find that" message when I tried to access a page for a variant 
item. You might need to tweak some config settings in order for things 
to work the way you want to.

Good luck,

Global Focus Digital Media, LLC


More information about the interchange-users mailing list