| Prev | Next
Menu: Products - Portfolio - Services - Download - Order - Company

 
Topic #1.1.1.1.
Shopping Carts
   Overall Design  
   Multi-Store  
   DB-Driven  
   User Interface  
   Site Features  
   Delphi to W-HTML  
   The Order  
   Item Graphic  
   Not Included  
   Summary  
*

  

Browsing >>Item Graphic: Displaying a Graphic on the Item Detail page

This works based on a filename convention which uses the Itemnumber plus the file extension (GIF or JPG), in a directory associated with the store. "DMStore" is the data module for the store.
procedure TfmAppPanel.waShowPictureExecute(Sender: TObject);
const
  fileNotFound='/htdemo/shared/img/misc/blnk32.jpg';
var
  a1,aItem,aShortFile:string;
begin
  inherited;
  with TwhWebActionEx(Sender).WebApp, DMStore do begin
    // send the name of a valid (existing!) file, or a placeholder
    aItem:=StringVar['CurrentItem'];
    aShortFile:=aItem+'.gif';
    a1:=StoreImgUrl+'/'+aShortFile;
    // first see if the GIF file exists
    if fileExists(trailingBackSlash(StoreImgPath)+StoreImgUrl+'\'+aShortFile) then begin
      SendString('/'+a1);
      exit;
      end;
    aShortFile:=aItem+'.jpg';
    a1:=StoreImgUrl+'/'+aShortFile;
    // then see if the JPG file exists
    if fileExists(trailingBackSlash(StoreImgPath)+StoreImgUrl+'\'+aShortFile) then begin
      SendString('/'+a1);
      exit;
      end;
    SendString(fileNotFound);
    end;
end;

 
Path:  www.href.com to; Services to; Tech Talk Archive to; Shopping Carts to; Item Graphic

Copyright © 1995-2012 HREF Tools Corp. All Rights Reserved Worldwide.
Running: WebHub-v2.167 compiled with d16_win32 on Microsoft-IIS/7.5,
Local Time: Thu, 24 May 2012 05:11:18.
Session 2092805004, 10 pages sent to CCBot/1.0 (+http://www.commoncrawl.org/bot.html) at 38.107.179.228;
Time to produce this page: 0msec.