ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Custom page add to cart with options
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Custom page add to cart with options

 Post Reply Post Reply
Author
Message
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post Topic: Custom page add to cart with options
    Posted: 23-September-2006 at 10:21pm

I created this page, and the last 2 items have options for "size".
http://www.opakallc.com/bosstin.asp

I find that "add to cart" (for those 2 items, the others work fine) results in a redirect to the home page instead of adding the qty to the cart.

Comparing the code to the normal detail page, I don't see a difference in terms of the form action or the input fields:
http://www.opakallc.com/store/pc/viewPrd.asp?idproduct=18

Would someone mind shedding some light upon what I might be overlooking?

Thanks much,
Greg

 

 



Edited by Greg Dinger - 23-September-2006 at 10:22pm
Back to Top
Matt View Drop Down
Moderator Group
Moderator Group


Joined: 20-July-2006
Location: United States
Status: Offline
Points: 73
Post Options Post Options   Thanks (0) Thanks(0)   Quote Matt Quote  Post ReplyReply Direct Link To This Post Posted: 17-October-2006 at 1:29am

You will need to create on validation function for each form on the page, or modify the function to receive the form's name as a parameter.

For example , the first product with options is contained within a form named "additem6".

Therefore the function will not work unless "additem6" is part of its path.

function cdd(choice, option) {

       if (choice== 0) {

              alert ("The product cannot be added to the shopping cart.\n"+ option + " is a required option.\n");

       } else {

               document.additem6.action="/store/pc/instPrd.asp";

               document.additem6.method="POST";

               document.additem6.submit();

       }

}

 

Therefore your next product can not use the same function "cdd", since this function only works with the form "additem6".  So if the next form on the page is called "additem7" you will need a new function.

For a better, more compact alternative you could just pass the name of the form into one dynamic function.  That would look something like this:

Function Call

 

cddMulti(additem6.idOptionA.selectedIndex,'Size','additem6') ;

 

 

Function

 

function cddMulti(choice, option, formname) {

var targeForm = eval("document." + formname + "");

if (choice== 0) {

       alert ("The product cannot be added to the shopping cart.\n"+ option + " is a required option.\n");

       } else {

       targeForm.action="/store/pc/instPrd.asp";

       targeForm.method="POST";

       targeForm.submit();

       }

}

 

We hope this helps!

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.