Jump to content

help - adjust onclick addtocart function


Snowman

Recommended Posts

i need to adjust the orderform addtocart function so that from the configure product page when you click to add to the cart the order will get added but the page will redirect to a different product group rather than the view cart page

 

the html line code is

 

<input type="button" value="{$LANG.continueshopping} »" class="checkout" onclick="addtocart();" /><br />

 

the js code is

 

functionaddtocart (gid) {    jQuery("#loading1").slideDown();
   jQuery.post("cart.php", 'ajax=1&a=confproduct&'+jQuery("#orderfrm").serialize(),
   function(data){
       if (data) {
           jQuery("#configproducterror").html(data);
           jQuery("#configproducterror").slideDown();
           jQuery("#loading1").slideUp();
       } else {
           if (gid) window.location='cart.php?gid='+gid;
           else window.location='cart.php?a=confdomains';
       }
   });

 

now i know that if i adjust the onclick to use

onclick="addtocart('43');"

this button will not go to the view cart page but will instead load product group 43

 

what i want to achieve however is to add the order to the cart on click and redirect to group 43

 

can anyone assist me with this adjustment to the js code to achieve this

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated