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

rating

how to limit quantity in ecart?

Thread began 11/26/2013 1:54 pm by stella | Last modified 11/27/2013 9:00 am by Jason Byrnes | 286 views | 6 replies |

stella

how to limit quantity in ecart?

Hello,
I don't know how to limit the quantity customers add to the cart. I have a certain quantity for each product in the database and it vary from 1 to 200. However right now customers can add any quantity and also change it in the cart. How to make the error message appear than customers set the quantity more than available in stock?

Sign in to reply to this post

Jason ByrnesWebAssist

add a column in the cart object called maxQuantity

on the calculations tab, create a calculation as:

abs([Quantity] > [maxQuantity])?[Quantity] = [maxQuantity]:0

in the add to cart button behavior, bind the maxQuantity column to the stock column in your recordset.

This will prevent the user from being able to set the quantity above what is set in the Database. it wont show an error message, so On your product page, you should probably list the stock so they know the maximum that is available.

Sign in to reply to this post

stella

Thank you! You are the best! :)

Sign in to reply to this post

stella

I did like you said but it shows this right now:

Notice: Use of undefined constant maxQuantity - assumed 'maxQuantity' in C:\xampp\htdocs\BYZANTINO_BOSTON\WA_eCart\eCart_BYZANTINO_PHP.php on line 12

here is line 12:
$itmObj->QuantityAvailable = abs($itmObj->Quantity > [maxQuantity])?$itmObj->Quantity = [maxQuantity]:0;//t

Sign in to reply to this post

Jason ByrnesWebAssist

that would mean you used a different name for the maxQuantity column in the cart object.

Note, the column names are case sensitive. Send a screen shot of the column tab showing the column names

Sign in to reply to this post

stella

yea, right now i noticed... my mistake...
i spelled it 'Quantiry'
Thank you again for your help!
It works! :)

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

Sign in to reply to this post

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