Miva Merchant 4 Module FAQs » Product Page Templates (BROK_PRODTEMPLATES )


{docurl}

How do I conditionally test for the existence of an image on the server (not the image assigned to the product but one I upload myself)?


(2004/01/22)You want to test for the existence of an image named after the product code. You can do this with a conditional such as:

%begin_if|sexists('/Merchant2/graphics/00000001/' $ Products.d.code $ '_th.gif')|%
the image exists
%end_if%

This also may work (depends on teh order of token processing which, unfortunately, is not consisten between the template modules):

%begin_if|sexists('/Merchant2/graphics/00000001/%prodcode%/_th.gif')|%
the image exists
%end_if%

Note that the path is relative to the directory in which the module file is installed (usually /Merchant2/4.xx/modules/system/). The path in these examples is absolute from the script root (which is usually the directory /Merchant2/ is in) but a relative path would work as well. For example:

%begin_if|sexists('../../../graphics/00000001/' $ Products.d.code $ '_th.gif')|%
the image exists
%end_if%



Last update: 2004-12-07 13:50
Author: Support
Revision: 1.0

Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry

Records in this category