Re: Re: Re: Add more than 1 Product to Cart with one Form ! Is t

Posts: 13
Joined: 05/07/2008

Blessed_Steve has it mostly right. Check the help page for Cart Links under the Admin >> Store Administration >> Configuration >> Cart Links. The help page describes how to create links directly into the cart.

You'll probably want to make sure you pass "e" in which empties the existing cart if you only have one page. Otherwise you'll end up with extra product in the cart. Also, not only do you want to validate on the client side with JavaScript, but you'll want a PHP controller that actually passes the URL into the cart. Less prone to hacking.

Here is an example of our PHP controller. We use checkboxes on a separate hand-coded page.

<?php

//if (isset($_POST['p1']) || isset($_POST['p2'])) {
   
$url = "/cart/add/e-";
   
    if (isset(
$_POST['p2']))
       
$url .= "p2-q1";
       
    if (isset(
$_POST['p1']))
       
$url .= "-p1-q1";
       
   
$url .= "?destination=cart/checkout";
       
   
// /cart/add/e-p2_q1-p1_q1?destination=cart/checkout
   
header("Location: " . $url);
//}
?>