Page 1 of 1

Custom Template (Inventory question)

PostPosted: Mon Jul 15, 2002 11:11 pm
by Andy
Hi, all, please forgive me if this was asked but...

In a custom product template anyone know the language to use for an if-else
statement that would be used in the following instance.

If available inventory is greater than 0, than display add to cart button
else insert text "send an email to join our waiting list"?

Is something like this possible?

Thanks!

Andy

Re: Custom Template (Inventory question)

PostPosted: Tue Jul 16, 2002 12:14 am
by loren_d_c
There is no greater than or less than compare for the custom template IF
tag. In fact, the string compare (basically an 'equals' function) for
the IF tag was added to the 6.1 release, previously the IF would always
return true if there was anything in the field it was checking.

To do what you are wanting would require using the CALL tag to pass the
Inventory Tracking values to an external program to do that kind
greater-than/less-than compare.

Since you don't want to have to create the order buttons in the external
script if the quantity available is OK (the script would be a lot
simpler if you leave the order button creating in the template), you
should probably do something like if there is product available, your
external script does nothing, but if there is not, output your out of
stock message/graphics and then an HTML comment tag that will comment
out the order buttons that follow immediately after in the template. And
then in the template after the order buttons, put another CALL to
another similar script to check the inventory again so that if you
commented out the order buttons, you can output the ending HTML comment
after the order buttons.

-Loren




Andy wrote:
Hi, all, please forgive me if this was asked but...

In a custom product template anyone know the language to use for an if-else
statement that would be used in the following instance.

If available inventory is greater than 0, than display add to cart button
else insert text "send an email to join our waiting list"?

Is something like this possible?

Thanks!

Andy