Re: Looking up two prices in database?

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 12603
interpreted = N
texte = Grant replied,>I don't know why you're doing that either. Unless you plan to multiply or >divide something, there's no need for math.I left it out and what follows seems to work.>Sounds good, although [saleprice] may not be valid in that context.Yes! I cannot get [saleprice] to substitute within the [showif] context. Can you only display text or HTML within this context?>Yes, it overrides the [price] *only* when adding a new product to the cart.Are you saying that WebCatalog looks for a price in the Formulas database only if one of the cart related commands or contexts is sent. In other words, it isn't the [price] tag that triggers a look into the Formulas database but a cart related command for a template taht contains the [price] tag? That's a pretty key concept!>>If it isn't met, I would expect the lookup to be performed and the >>regular price to be displayed wherever there is a [price] tag. > >Yes.Actually, the [saleprice] tag within the [showif] tag doesn't display the saleprice, even without the [lookup]. >No, it doesn't stop, so your lookup will actually shove some more numbers >after the [saleprice]. You need to wrap that portion with a hideif so >that only one is shown at a time.If the [showif] had worked I would do this.>Let's try simplifying this and just put in a simple lookup for the >[saleprice], with no showifs. Just to see if the saleprice gets put into >the cart from your formula, instead of the normal price. Then start >getting fancy with show/hide.Aahh! The old simplify, simplify debugging routine. Sounds like you do a lot of this chasing down why things don't work stuff, eh? Actually I'm embarrased that I didn't try that almost from the start. However . . .Now it gets interesting!!I used the following [lookup] [lookup db=products.db&lookInField=SKU&value=[SKU]&returnField=saleprice]in my SaleResults.tmpl template that returns when the user searches for the specials using the search url Click here to see our in-house specials.It successfully returns the two items for which I have set onsale=T and displays the sale price correctly. I thought, Great!I put the same lookup (copied and pasted) into the Formulas.db database. I did a search for specials, had the SaleResults.tmpl template return the onsale items which displayed the correct price, clicked on the Add to Cart link, and the shopping cart displayed the REGULAR price. In other words, the formula that worked fine in the template, doesnt return the sale price from the Formulas.db database when I go to the cart.The customer and I have agreed to put up the site without the specials feature. this is an upgrade from WebCatalog 1.6 and we want to get it up so he can continue to get sales. But I need to figure out a fix for this.Any help from anyone doing something similar would be helpful!!Jerry Nielsen - commSTRUCT Associates(I really have to take the time to create a signature. I'm impressed by the ones I have seen on other people's emails. Proof, I think, that internet users have always wanted graphics. I'll I need is a little time. Maybe at 4AM this morning . . . Nah! Associated Messages, from the most recent to the oldest:

    
  1. Re: Looking up two prices in database? (Grant Hulbert 1997)
  2. Re: Looking up two prices in database? ( 1997)
  3. Re: Looking up two prices in database? (Grant Hulbert 1997)
  4. Re: Looking up two prices in database? ( 1997)
  5. Re: Looking up two prices in database? (Grant Hulbert 1997)
  6. Looking up two prices in database? ( 1997)
Grant replied,>I don't know why you're doing that either. Unless you plan to multiply or >divide something, there's no need for math.I left it out and what follows seems to work.>Sounds good, although [saleprice] may not be valid in that context.Yes! I cannot get [saleprice] to substitute within the [showif] context. Can you only display text or HTML within this context?>Yes, it overrides the [price] *only* when adding a new product to the cart.Are you saying that WebCatalog looks for a price in the Formulas database only if one of the cart related commands or contexts is sent. In other words, it isn't the [price] tag that triggers a look into the Formulas database but a cart related command for a template taht contains the [price] tag? That's a pretty key concept!>>If it isn't met, I would expect the lookup to be performed and the >>regular price to be displayed wherever there is a [price] tag. > >Yes.Actually, the [saleprice] tag within the [showif] tag doesn't display the saleprice, even without the [lookup]. >No, it doesn't stop, so your lookup will actually shove some more numbers >after the [saleprice]. You need to wrap that portion with a hideif so >that only one is shown at a time.If the [showif] had worked I would do this.>Let's try simplifying this and just put in a simple lookup for the >[saleprice], with no showifs. Just to see if the saleprice gets put into >the cart from your formula, instead of the normal price. Then start >getting fancy with show/hide.Aahh! The old simplify, simplify debugging routine. Sounds like you do a lot of this chasing down why things don't work stuff, eh? Actually I'm embarrased that I didn't try that almost from the start. However . . .Now it gets interesting!!I used the following [lookup] [lookup db=products.db&lookInField=SKU&value=[SKU]&returnField=saleprice]in my SaleResults.tmpl template that returns when the user searches for the specials using the search url Click [cart] &eqonsaledata=T>here to see our in-house specials.It successfully returns the two items for which I have set onsale=T and displays the sale price correctly. I thought, Great!I put the same lookup (copied and pasted) into the formulas.db database. I did a search for specials, had the SaleResults.tmpl template return the onsale items which displayed the correct price, clicked on the Add to Cart link, and the shopping cart displayed the REGULAR price. In other words, the formula that worked fine in the template, doesnt return the sale price from the formulas.db database when I go to the cart.The customer and I have agreed to put up the site without the specials feature. this is an upgrade from WebCatalog 1.6 and we want to get it up so he can continue to get sales. But I need to figure out a fix for this.Any help from anyone doing something similar would be helpful!!Jerry Nielsen - commSTRUCT Associates(I really have to take the time to create a signature. I'm impressed by the ones I have seen on other people's emails. Proof, I think, that internet users have always wanted graphics. I'll I need is a little time. Maybe at 4AM this morning . . . Nah!

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Emailer help....! (1997) WebCat b13 CGI -shownext- (1997) Permissions Ignored - PLEASE HELP (2003) Multiple condition showif's (2004) Working with framesets (1998) WebCommerce: Folder organization ? (1997) WebMerchant - MacAuthorize (1999) Re2: frames & carts (1997) Running _every_ page through WebCat ? (1997) multiple search commands (1997) Running webcat 6 on Windows XP Prof. (2005) Whats going on with my SERIAL NUMBER??? (1998) [AppendFile] problem (WebCat2b13 Mac .acgi) (1997) Kaaaaahhhhhhhnnnnnnn! (1997) Browser Problem?!? Still getting Error message usingPOST! (1997) Huge databases and RAM (1998) SetHeader (1997) Which [index]? (1997) installing webcatalog problem. HELP! (1998) Search/sort in URL Was: GuestBook example (1997)