close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart 5 Product Options

Thread began 3/09/2012 11:20 am by rob294118 | Last modified 3/12/2012 9:56 am by toms016390756 | 2915 views | 14 replies |

rob294118

eCart 5 Product Options

What is the nest way to add a STYLE to a product. One style will cost more than the other.

For example: T-shirt Short Sleeve and Long Sleeve.

When I pick Short Sleeve, I want 1 price and when I pick Long Sleeve, I want another price.

Sign in to reply to this post

Jason ByrnesWebAssist

before we get into the mechanics, is the price difference between short sleeve and long sleeve going to differ from product to product? or will it always be the same?

Sign in to reply to this post

rob294118

It will be the same for all products.

For example: short sleeve $15, long sleeve $20

Sign in to reply to this post

Jason ByrnesWebAssist

Ok, so Long Sleeve adds $5 to the price.

1) in the eCart object, add a new column named "style" (NOTE: after adding a new column to the cart, you will need to edit any add to cart buttons behaviors on your site to have the code regenerated to include the new column)

2) in the add to cart button behavior, set the style column to be updatable as a select list. in the select list that is added to the page, add the short sleeve and long sleeve options.

set the price column to the regular short sleeved price

3) in the eCart object, on the calculations tab, create a new calculation named "realPrice" as:

php:
(abs([style] = "Long Sleeve"))?[Price] + 5:[Price]



this is a short hand if statement that basically says

If the style is Long Sleeve return the Price + 5 Else just return the Price

so if it is long sleeve, it returns 20, if not it returns 15.

4) on the calculations tab, edit the Total rice calculation:

php:
[Price] * [Quantity]



to:

php:
((abs([style] = "Long Sleeve"))?[Price] + 5:[Price]) * [Quantity]



4) on the cart display page, where it shows the price, replace that with the truePrice binding.

Sign in to reply to this post

rob294118

After doing all this, I get the following error on the products page (store.php)

Parse error: syntax error, unexpected '[', expecting ')' in /homepages/20/d184490718/htdocs/DeezNutz/WA_eCart/eCart1_PHP.php on line 10

Sign in to reply to this post

Jason ByrnesWebAssist

this means that you didn't name the column "style" you named it something else. Remember, php is case sensitive so "Style" and "style" are not the same thing.

so when you added the new column, what did you name it?

Sign in to reply to this post

rob294118

The error is gone.

I have the price field on the STORE.PHP page. How would I make this field change depending on if I select "Short Sleeve" or "Long Sleeve"?

Also, the cart.php page is not displaying the realprice.

I attached 2 files.

Attached Files
store.zip
Sign in to reply to this post

Jason ByrnesWebAssist

it would be easier to edit the Long Sleeve option to show +$5

<option value="Long Sleeve">Long Sleeve (add $5)</option>



when you created the calculation, did you name it realPrice or realPrice:

you have the code for binding using the name RealPrice:
<?php echo $eCart1->DisplayInfo("RealPrice"); ?>

Sign in to reply to this post

rob294118

The calculation is names RealPrice.

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the /WA_eCart/eCart1_PHP.php file please

Sign in to reply to this post
loading

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...