Re: [SMSI]Re: Price and Formula.db

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 45583
interpreted = N
texte = Thanks, Donovan. Your suggested changes have been made.> -----Original Message----- > From: WebCatalog Talk > [mailto:WebDNA-Talk@talk.smithmicro.com]On Behalf > Of Donovan > Sent: Wednesday, November 20, 2002 8:10 AM > To: WebCatalog Talk > Subject: [SMSI]Re: Price and Formula.db > > > John, > Thanks for the response. > I believe the answer is yes (as I think you stated). I > created a test store to > play around to look at the formulas.db. > Here is the untouched formula from the test store (all one > line of course). > > Name Formula > price [text show=f&multi=t]foundOverride=F&actualPrice=[lookup > db=admin/products.db&lookInField=sku&value=[sku]&returnField=p > rice][/text][formvariables > name=__&exact=f][search > db=admin/related.db&eqR_IDdatarq=[value]&eqR_CATEGORYdatarq=[getchars > start=3][name][/getchars]][founditems][ShowIf ![r_ovr_price]][text > show=f&multi=t]foundOverride=T&actualPrice=[r_ovr_price][/text > ][/ShowIf][/founditems][/search][/formvariables][actualPrice] > > There would be no reason for the formvariables loop if form > vars couldn't be > passed in. > > From the FILE FORMATS on-line docs: > > but you can still customize pricing by creating a formula to > calculate a different > price based on any > WebDNA tags, such as [username], [zip], or even a [math] calculation. > > > ****SCOTT****, (when you get a moment ;-) can you change the above to: > > but you can still customize pricing by creating a formula to > calculate a different > price based on any > WebDNA tags, such as [username], [zip], [math] calculation, > or any form, text or > math variable that is active on that page. > > AND can you change: > > 2.If Formulas.db contains a price formula, then evaluate > the WebDNA expression > (in the context of the current lineitem, so tags such as > [price], [quantity], [zip] and [sku] are available). > > to > > 2.If Formulas.db contains a price formula, then evaluate > the WebDNA expression > (in the context of the current lineitem, so tags such as > [price], [quantity], [zip] and [sku] are available as > well as any form, text > or math variables active on that page). > > > You could also state clearer that Since the formulas.db is a > database there must > be no carraige returns other than signifing line endings in > the formula. > a way around this could be using comments ([!][/!]) to hide > extra carraige > returns. ie: > > --formula.inc-- > ___________ > [if [username]=SCOTT][!] > [/!][then][math][_discount]*[lookup > db=products.db&lookInField=sku&value=[sku]&returnField=price][ > /math][/then][!] > [/!][else][lookup > db=products.db&lookInField=sku&value=[sku]&returnField=price][ > /else][/if]. > > This is something we all learn but it is learned from the > archives or the list and > not the docs. > > A quick search in the archives will show a record of the > confussion the formulas.db > has caused > over the years. I remeber dealing with it a year and a half ago. > > Thanks, > Donovan > > > > John Peacock wrote: > > > Donovan wrote: > > > Can a variable be passed into a formulas.db other than the > > > orderfile/lineitems and internal webcat > > > variables? > > > > > > > How would you expect to pass in a variable to the > formulas? If you are using > > the '?add' command and including an additional URL > parameter, then the answer > > is, I believe, no. Using a [addlineitem] context is much > more likely to give > > you the control you need. > > > > Formulas.db is only used (currently) when adding an item to > the cart. As such, > > it automatically gains access to the current orderfile > header fields, any and > > all fields from the database that is included as part of the add > > command/context, all builtin webcat contexts, and AFAIK any > and all active form > > variables at that point on the page. > > > > To confirm this, add something like this to the price line > in your formulas.db: > > > > [WriteFile > SomeTextFile][FormVariables][index],[name],[value]
> > [/FormVariables][/WriteFile] > > > > (obviously all as a single line). This will show you > exactly what is available > > for you to use within the formulas.db. > > > > HTH > > > > John > > > > > > -- > > -------------------------------------------------------------- > ---------- > > > -------------------------------------------------------------- > ---------- > > <><> Donovan Brooke <><>->ï > > -------------------------------------------------------------- > ---------- > > > -------------------------------------------------------------- > ---------- > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://search.smithmicro.com/ ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
Thanks, Donovan. Your suggested changes have been made.> -----Original Message----- > From: WebCatalog Talk > [mailto:WebDNA-Talk@talk.smithmicro.com]On Behalf > Of Donovan > Sent: Wednesday, November 20, 2002 8:10 AM > To: WebCatalog Talk > Subject: [SMSI]Re: Price and Formula.db > > > John, > Thanks for the response. > I believe the answer is yes (as I think you stated). I > created a test store to > play around to look at the formulas.db. > Here is the untouched formula from the test store (all one > line of course). > > Name Formula > price [text show=f&multi=t]foundOverride=F&actualPrice=[lookup > db=admin/products.db&lookInField=sku&value=[sku]&returnField=p > rice][/text][formvariables > name=__&exact=f][search > db=admin/related.db&eqR_IDdatarq=[value]&eqR_CATEGORYdatarq=[getchars > start=3][name][/getchars]][founditems][ShowIf ![r_ovr_price]][text > show=f&multi=t]foundOverride=T&actualPrice=[r_ovr_price][/text > ][/ShowIf][/founditems][/search][/formvariables][actualPrice] > > There would be no reason for the formvariables loop if form > vars couldn't be > passed in. > > From the FILE FORMATS on-line docs: > > but you can still customize pricing by creating a formula to > calculate a different > price based on any > WebDNA tags, such as [username], [zip], or even a [math] calculation. > > > ****SCOTT****, (when you get a moment ;-) can you change the above to: > > but you can still customize pricing by creating a formula to > calculate a different > price based on any > WebDNA tags, such as [username], [zip], [math] calculation, > or any form, text or > math variable that is active on that page. > > AND can you change: > > 2.If formulas.db contains a price formula, then evaluate > the WebDNA expression > (in the context of the current lineitem, so tags such as > [price], [quantity], [zip] and [sku] are available). > > to > > 2.If formulas.db contains a price formula, then evaluate > the WebDNA expression > (in the context of the current lineitem, so tags such as > [price], [quantity], [zip] and [sku] are available as > well as any form, text > or math variables active on that page). > > > You could also state clearer that Since the formulas.db is a > database there must > be no carraige returns other than signifing line endings in > the formula. > a way around this could be using comments ([!][/!]) to hide > extra carraige > returns. ie: > > --formula.inc-- > ___________ > [if [username]=SCOTT][!] > [/!][then][math][_discount]*[lookup > db=products.db&lookInField=sku&value=[sku]&returnField=price][ > /math][/then][!] > [/!][else][lookup > db=products.db&lookInField=sku&value=[sku]&returnField=price][ > /else][/if]. > > This is something we all learn but it is learned from the > archives or the list and > not the docs. > > A quick search in the archives will show a record of the > confussion the formulas.db > has caused > over the years. I remeber dealing with it a year and a half ago. > > Thanks, > Donovan > > > > John Peacock wrote: > > > Donovan wrote: > > > Can a variable be passed into a formulas.db other than the > > > orderfile/lineitems and internal webcat > > > variables? > > > > > > > How would you expect to pass in a variable to the > formulas? If you are using > > the '?add' command and including an additional URL > parameter, then the answer > > is, I believe, no. Using a [addlineitem] context is much > more likely to give > > you the control you need. > > > > formulas.db is only used (currently) when adding an item to > the cart. As such, > > it automatically gains access to the current orderfile > header fields, any and > > all fields from the database that is included as part of the add > > command/context, all builtin webcat contexts, and AFAIK any > and all active form > > variables at that point on the page. > > > > To confirm this, add something like this to the price line > in your formulas.db: > > > > [WriteFile > SomeTextFile][formvariables][index],[name],[value]
> > [/FormVariables][/WriteFile] > > > > (obviously all as a single line). This will show you > exactly what is available > > for you to use within the formulas.db. > > > > HTH > > > > John > > > > > > -- > > -------------------------------------------------------------- > ---------- > > > -------------------------------------------------------------- > ---------- > > <><> Donovan Brooke <><>->ï > > -------------------------------------------------------------- > ---------- > > > -------------------------------------------------------------- > ---------- > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://search.smithmicro.com/ ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Scott Anderson

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:

[WebDNA] WebDNA on LiveCD ... (2008) Site Builder & IE Mac (2004) Re:trouble (1997) 2nd WebCatalog2 Feature Request (1996) [OrderFile] being testy (2000) hiding links (1999) Multiple Merchant Accounts? (1997) Banner DNA (1997) WebCatalog [FoundItems] Problem - AGAIN - (1997) Problem (1997) Missing from Docs [folderName] (1997) [WebDNA] php/mySQL version of WebDNA Speed Test? (2009) multiple record replace (2001) [Fileinfo] Context (2000) WebCat2.0 acgi vs plugin (1997) Preventing code execution (2003) upgrading (1997) Question re: FlushDatabases (1997) Writing multiple data into one field (1998) Help with database strategy (1998)