close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Correct Workfow?

Thread began 8/25/2011 1:56 pm by chuck429411 | Last modified 12/16/2011 1:46 pm by chuck429411 | 7824 views | 105 replies

Jason ByrnesWebAssist

parenthesis placement is not specific to thee calculations, really. parenthesis placement strategy is pretty standard throughout all php coding.

parenthesis are used for two purposes:
1) Pass arguments to a function;
runThis(argument1, argumet2, argumet3)

2) Group expressions to create conditional logic;
(expression1 || expression2) && (expression3 || expression4)

the above example will evaluate to true if exression1 or 2 is true AND expresion3 or 4 are true.

the calculation are using the php abs() function to create a ternary expression.

ternary expression is a shortened if statement, it consists of a question, a true part and a false part. instead of:
if(expression1 == "foo") {
return "foo";
}else {
return "bar";
}

we can write:
return (expresion1 == "foo")?"foo":"bar";


the true price calumniation is a collection of ternary conditions, for each one the false response is 0. they are all added together using the addition operator. the first 2 parts look like this:
1- ((abs(([Size] == '50ml') && [Quantity] < 12))?[Price]:0)
2- ((abs(([Size] == '50ml') && [Quantity] == 12))?[price50mlCase]:0)

if the first one evalutes to tru it will return the price, other wise it returns 0, the second one returns the 50ML case price or 0.

in the calculation, they are added together:
((abs(([Size] == '50ml') && [Quantity] < 12))?[Price]:0) + ((abs(([Size] == '50ml') && [Quantity] == 12))?[price50mlCase]:0)

so it ends up as being:
Price + 0
or
0 + 50MLCasePrice

yes, with the number of conditions you have, the calculation may get very long

This may be a good argument for creating a database table that contains the price for each condition, and creating a recordset that will lookup the price to use based on the selections made. this is why it is important to have all of the information on how pricing is going to work before you start development. that information is important in determining how to develop the cart.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...