close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Add to Cart not going to cart.php

Thread began 9/19/2012 9:52 am by Joe Lowery | Last modified 9/20/2012 12:49 pm by Jason Byrnes | 6322 views | 5 replies |

Joe Lowery

Add to Cart not going to cart.php

I have one product page on this site (gift-boxes.php) that is different from the others and I can't get the Add to Cart buttons to work, although the Checkout ones do.

Unlike my other product pages, this page has 3 different items on the page at the same time, each with their own form and set of buttons. I have a different recordset populating each ATC bindings.

I've attached the file for your perusal.

Thanks for your help again. It's greatly appreciated.

Best - Joe

P.S. You'll may notice the multi-checkbox options for the 3rd form. That will be my next question - on how to pass the selections to the cart.

Attached Files
gift-boxes.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

It doesn't look like the recordsets on your page are working correctly.

If i view source of the page and look at the code for the first gift box:

php:
<form id="threePForm" name="muirhead_1_ATC_" method="POST"  action="/dev/gift-boxes.php">

      <input type="hidden" name="muirhead_1_ID_Add" value="" >
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th>&nbsp;</th>
      <th>&nbsp;</th>
      <th>&nbsp;</th>
      <th>Quantity</th>
      </tr>
    <tr id="buttons">
      <td><input type="submit" id="atc" name="muirhead_1_ATC" value="Add to Cart" class="button" /></td>
      <td><input type="submit" id="checkout" name="muirhead_Checkout_1" value="Checkout" class="button" /></td>
      <td><input type="submit" id="continueShopping" name="continueShopping" value="Continue Shopping" class="button lastOne" /></td>
      <td><input class="quantityField" name="muirhead_1_Quantity_Add" type="text" value="1" /></td>
      </tr>
    </table>
  </form>



the iD element does not have a value:
<input type="hidden" name="muirhead_1_ID_Add" value="" >

in the original PHP code, the ID is coming from the recordset. Double check that your record sets are defined properly.


For the checkbox selection, you would need to define a new column in your cart object. in the add to cart button behavior, set the new option column to be updatable from a checkbox. You can then add the additional checkboxs to the page using the same name as the fisrt one created by the eCart Add to cart behaivor, make sure the name ends with [] so that all selected items will be passed as an array.

you can then add the following code at line 1 to convert the array to a comma seperated list:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>
Sign in to reply to this post

Joe Lowery

Multiple checkbox selection

Closing in, but not quite there yet. I believe I've set up the multiple checkbox selection correctly, but I'm not sure if I'm displaying it properly.

Here's what I've done so far:
1. Added a new column to eCart object, MixMatchSelections, set to Text.
2. In the Add to Cart behavior on gift-box.php for the Mix Match item, set the new column as updatable. There isn't an option to make it a checkbox, as you suggested, so I set it to a text field.
3. For all checkbox items, I set the name to the generated value and added square brackets, like this: name="muirhead_3_MixMatchSelections_Add[]".
4. On cart.php, I inserted the routine to explode the array that you included in your last post at line 1.
5. In the display area, I added the following code right after the description (where I'd like the list of selections to be shown: <?php echo $muirhead->DisplayInfo("MixMatchSelections"); ?>
(Eventually, I'd like to only show this message conditionally, if there are any such selections. What's the best way to do that?)

So far, no selections are shown on cart.php. I've attached gift_boxes.php and cart.php in hopes you'll take a look.

I really appreciate all your help - this is pretty much the final piece of the puzzle.

Best - Joe

Attached Files
lowery-multicheckbox.zip
Sign in to reply to this post

Jason ByrnesWebAssist

  4. On cart.php, I inserted the routine to explode the array that you included in your last post at line 1.  



that code needs to go on the gift-box.php page, not the cart display page.

Sign in to reply to this post

Joe Lowery

Okay, I did that. No change in output. Any other suggestions.

TIA - Joe

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

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