close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Prevent product 2 being added if product 1 is not in the cart

Thread began 2/09/2012 8:00 am by doug8382 | Last modified 2/10/2012 6:51 am by Jason Byrnes | 2353 views | 10 replies |

doug8382

Prevent product 2 being added if product 1 is not in the cart

ok, i have 3 variations of one product set to replace (ID 1) if it is added by another variation.

That works great. Now, there is a second product with 2 variations (ID 2) that should only be able add if the product ID 1 is in the cart.

I think I read you could wrap the cart with if statement. I'm using ASP VB Script and E Cart 3.

Could you help me display at the very least, an error message saying you must add Product 1 before adding product 2?

Or any other solution you think would be best.

Thanks,
Doug

Sign in to reply to this post

doug8382

a little help please

Hey Jason, do you think I could get a little help on this one. time sensitive would appreciate some advice.

thanks,
Doug

Sign in to reply to this post

Ray BorduinWebAssist

You would have to write an if statement on the add to cart page, but would probably have to update the view cart page too in order to prevent them from removing the required item afterward.

This is a bit beyond what we handle on the public forum, but we can help you with the support incident you have purchased.

Sign in to reply to this post
Did this help? Tips are appreciated...

doug8382

Thanks

Hey Ray,

Thanks so much for getting back. I can point to a lot of threads where Jason and others are extremely helpful and often writes snippets of code.

I would just like some direction on what variable to target and how it might be written. I see this kind of help from Moderators all the time.

Sorry if I came across as impatient, but I am on deadline, and was excited at first to see the thorough and prompt replies, only to be told this is not covered in forums, when it clearly is.

appreciate any guidance on my issue, which I thinks, should be a simple one.

Thanks,
Doug

Sign in to reply to this post

Jason ByrnesWebAssist

doug,

it's easy enough to hide the add to cart button unless Item ID 1 is in the cart, that code would look like:

<% If WA_eCart_InCart(eCart1, "1") Then %>
<add to cart button form for product 2>
<% End If %>



this code example assumes the cart is named eCart1.

the part Ray is saying is not supported and beyond what we can do in the forums is editing the cart display page so that if item 1 and item 2 are in the cart, you cannot remove item 1

Sign in to reply to this post

doug8382

almost

Hey Jason,

Thanks for the snippet. It seems whenever i surround anything within an ecart form with that code i get this error.


Microsoft VBScript runtime error '800a01a8'

Object required: 'cartObj'

/WA_eCart/WA_eCart_Definition_VB.asp, line 81


Any idea why that's happening?

Thanks,
Doug

Sign in to reply to this post

Jason ByrnesWebAssist

I'd need to see the code, send a copy of your page in a zip archive please.

Sign in to reply to this post

doug8382

thanks

Thanks Jason,

I've attached all the files in the app. Your code is on the workshops.asp file. I think I'd prefer to hide the cart display page and display an else if message like "You must add Product 1 to the cart before adding product 2". But hiding the add cart area would work as well.

Thanks,
Doug

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

Jason ByrnesWebAssist

hiding the cart display page does not make any sense, they would not be able to see any items in the cart until item 1 where added....



any way, the error message is caused by using a different cart name. the code example i gave assumes the cart is named eCart1, your cart name is WA_eCart1. Slight difference, but it's enough to through off the asp processor.

you need to alter the code to use the correct cart name:

<% If WA_eCart_InCart(WA_eCart1, "1") Then %>
<add to cart button form for product 2>
<% End If %>
Sign in to reply to this post

doug8382

thanks

thanks again Jason. I missed the cart name and that works. Really appreciate the help.

you know i've had this cart for a few years and haven't really used it. I like it but need to get up to speed on discounts, so you may see me again. I have an upcoming project that ver 5 might work. I'll need product specific discounts.

I've read through the docs on discounts and calculations. a little confusing at first. are there any other resources for targeting that subject? again, thank you.

Thanks,
Doug

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