Thumbnail (scaled down) Product Images (gif or jpg) in Search Results - Actinic Version 6 version. Updated 25/01/03 to allow for "/" in product references and leading "-" prefixes for duplicated products. Assuming you have some product images whose filenames are related to your product references then it is possible to display these images with the search results. The images can be in either jpg or gif format but the extensions must lower case for the code to work. These patches can be implemented with just a single line of perl but have grown rather large due to the addition of the option of scaling down the image sizes. As the character "/" may occur in product references but will be a problem on the web the "/" character will be replaced by "-" so the product reference "XYZ/123" should have XYZ-123.jpg or XYZ-123.gif as its image name. To allow you to put a product in more than one section (where it must have a different product reference) you can use one or more "-" as a prefix to the product reference and all these will be stripped out when checking for the image. E.g. product "XYZ-123" can be also called "-XYZ-123" or "--XYZ-123", etc but all of them will use the image named "XYZ-123.jpg". To do this make the following changes to SearchScript.pl in your Site1 folder (make backup copies first). Make sure you use a text editor and not a word processor program (see www.editpadlite.com if you need one). The following code has been tested on Win32 / Apache with Catalog and V5.1.4. The code should work with Business and other version numbers. In the patches that follow there are 5 user modifiable lines (starting at "my $NorcatImagePrefix") 1) Change $NorcatScale to whatever scale down factor you like ( 2 gives half sized images, 1 full size, fractions are OK ). 2) Also if you have a prefix or postfix (3) to your image file names (i.e. bits that aren't part of the product reference) then add that text to $NorcatImagePrefix and $NorcatImageSuffix. 4) You can also amend the code that starts and ends (5) the cart image. Patching instructions:- ******************************* In Act_ResultsTemplate.html Change the line . to read . You can move the fragment around (within the block) to suit your requirements. ******************************** In SearchScript.pl (V5 & V6 versions) locate the line (there should be only one instance) $ACTINIC::B2B->SetXML('S_ITEM', ($nCount + 1)); and INSERT the following code immediately above it:- ########## START of ALL PATCHING - SEARCH RESULTS - IMAGE with scaling V1.1 ######################### my $NorcatRef = $$rarrResults[$nCount]; # Our product reference SearchScript.pl version $NorcatRef =~ s/^-+//; # strip any leading "-" characters $NorcatRef =~ s/\//-/g; # (V11) replace "/" with"-" ############################# SEARCH RESULTS - IMAGE with scaling V1.1 ####################################### # SearchScript.pl (V5 & V6 versions) patch # # author Norman Rouxel www.drillpine.biz (V11) # user modifiable variables my $NorcatImagePrefix = ''; # optional text that prefixes product ref in image filenames my $NorcatImageSuffix = ''; # optional text that follows product ref in image filenames my $NorcatScale = 2; # e.g. 2 -> half size thumbnails. 1 -> full size. Fractions OK. my $NorcatImageStart = ' 0xCF) || ($NByte == 0xC4) || ($NByte == 0xCC) ) { if ( not eof(ImageFile) ) {read(ImageFile, $N1stByte, 1)} # 1st length byte if ( not eof(ImageFile) ) { read(ImageFile, $N2ndByte, 1); # 2nd length byte my $NLength = ord($N1stByte) * 256 + ord($N2ndByte); # calculate fragment length if ( $NLength >= 2 ) # must be at least 2 bytes { seek(ImageFile, $NLength - 2, 1); # seek past this fragments data $NError = 0; # (ignore 2 bytes already read) } } } else { if ( not eof(ImageFile) ) {read(ImageFile, $N1stByte, 1)} # 1st length byte if ( not eof(ImageFile) ) {read(ImageFile, $N2ndByte, 1)} # 2nd length byte if ( not eof(ImageFile) ) {read(ImageFile, $NNextByte, 1)} # Data Precision char if ( not eof(ImageFile) ) {read(ImageFile, $N1stByte, 1)} # 1st height byte if ( not eof(ImageFile) ) { read(ImageFile, $N2ndByte, 1); # 2nd height byte $NImageHeight = ord($N1stByte) * 256 + ord($N2ndByte); # image height } if ( not eof(ImageFile) ) {read(ImageFile, $N1stByte, 1)} # 1st width byte if ( not eof(ImageFile) ) { read(ImageFile, $N2ndByte, 1); # 2nd width byte $NImageWidth = ord($N1stByte) * 256 + ord($N2ndByte); # image width $NImageHeight = int($NImageHeight / $NorcatScale); # scale down $NImageWidth = int($NImageWidth / $NorcatScale); # scale down $NError = 0; $NFoundIt = 1; # whew - that's it } } } } } } } if ( not $NError ) { $NorcatImage = $NorcatImageStart . $NorcatImagePrefix . $NorcatRef . $NorcatImageSuffix . '.jpg" width=' . $NImageWidth . ' height=' . $NImageHeight . $NorcatImageEnd; # image HTML } close ImageFile; } ########## end of MAIN PATCH - SEARCH RESULTS -IMAGE with scaling V1.1 ####################################### # patch in the image (must also have somewhere in Act_ResultsTemplate.html) $ACTINIC::B2B->SetXML('S_IMAGE', $NorcatImage); ########## end of ALL PATCHING - SEARCH RESULTS -IMAGE with scaling V1.1 ##################################### Now update the site and that's that.