Shopping Cart Project Revisions 1)Added states.db table to \ht\mall directory - missing in shipped version 2)Code attempts to open tax table even if UseTax flag in store table is set to false. The following Delphi changes fix that: In procedure procedure TdmStore.DefineStore in unit StoreDM Change: with TaxTable do begin DatabaseName:=StoreAlias; TableName:=aTax; Open; end; To: with TaxTable do begin DatabaseName:=StoreAlias; TableName:=aTax; if aUseTax then Open; end; In procedure TfmAppPanel.waGetFullCartExecute in Unit CustForm Change: with DMStore.TaxTable do begin First; if locate('TaxJurisdiction',pwebapp.Literal['State'],[]) then TaxRate:= FieldByName(TxRate).asfloat else begin TaxRate:=0; end; Tax:=TTotal * TaxRate; GTotal:=STotal + Tax; end; To: if aUseTax then begin with DMStore.TaxTable do begin First; if locate('TaxJurisdiction',pwebapp.Literal['State'],[]) then TaxRate:= FieldByName(TxRate).asfloat else begin TaxRate:=0; end; Tax:=TTotal * TaxRate; GTotal:=STotal + Tax; end; end; 3) The dynamic link created on the Item Overview page to drill down to the ItemDetail page does not correct the correct key value. In chunk chItemRow in chunks.htm Change: %=Field|WdsClassQuery|Item=% To: %=Field|WdsClassQuery|Item=% 4) The store maintains a literal named "Cart" that is designed to determine if the shopper has anything in their cart. This literal is set by the waGetOrderItems.execute procedure that is called with the customer goes to check out. In order to set this literal earlier to permit conditional display of the cart on the ItemsOverview page (hide the cart if it is empty), a new procedure waCheckOrderItems has been added: procedure TfmAppPanel.waCheckOrderItemsExecute(Sender: TObject); var i, qty:integer; bCartEmpty:boolean; a1, a2, itemID :string; begin inherited; with TWebAction(Sender) do begin CartCommand:=DefaultsTo(Command,htmlParam); // added to support new htmlParam property bCartEmpty:=false; with WebApp do begin //begin scanning literals array for i:=0 to pred(WebSession.Literals.count) do begin a1:=WebSession.Literals[i]; if pos('!',a1)>0 then begin // we are on an order! WdsItems.Qty!1007=3 itemID:=RightOf('!',LeftOfEqual(a1)); // this should give me 1007 a2:=tpJustDigits(RightOfEqual(a1)); // this cleans up qty in case of user input error if a2<>'' then qty:=StrToInt(a2) else qty:=0; if (qty > 0) then begin bCartEmpty:=false; with DMStore.ItemsTable do begin First; if not locate(keyItemsTable,itemID,[]) then begin PageID:='Error'; Literal['ErrorMessage']:= 'Item #'+itemID+ ' not found'; Abort; end; end; end; end; end; //end scanning literals array //start scanning the checked array for i:=0 to pred(WebSession.Checked.count) do begin a1:=WebSession.Checked[i]; if pos('!',a1)>0 then begin bCartEmpty:=false; // we are on an order! WdsItems.Item!1007=Yes itemID:=RightOf('!',LeftOfEqual(a1)); // this should give me 1007 with DMStore.ItemsTable do begin first; if not locate(keyItemsTable,itemID,[]) then begin PageID:='Error'; Literal['ErrorMessage']:= 'Item #'+itemID+ ' not found'; Abort; end; end; end; end; //end scanning the checked array if bCartEmpty then begin pWebApp.Literal['Cart']:='EMPTY'; end else begin pWebApp.Literal['Cart']:='OK'; end; end; end; CartCommand:=''; //resetting the command end; 5) In order to call the above procedure, the following line was added to the top of the ItemsOverview page in the pages.htm file: %=waCheckOrderItems.Execute=% 6) In order to properly close the ClassQuery before displaying a new parts classification on the ItemsOverview page, the following line was added to the top of the ItemsOverview page in the pages.htm file: %=wdsClassQuery.close=% 7) In order to prevent an error the first time the homepage is displayed, remove the following line was added to the top of the HomePage page in the pages.htm file: %=wdsClassQuery.close=% 8) In order to enable backwards compatible support for the new tWebAction.htmlParam property (which replaces the OnSetCommand event), the following Delphi changes were made: In procedure procedure TfmAppPanel.waGetOrderItemsExecute in the CustForm unit Change: CartCommand:=Command; // added to support new htmlParam property To: CartCommand:=DefaultsTo(Command,htmlParam); // added to support new htmlParam property