Forums / General Questions / Quantity Unit Errors when adding to list for products I DIDNT add to cart...

Quantity Unit Errors when adding to list for products I DIDNT add to cart...

Views: 690

Results 1 to 4 of 4
29 Mar 2015, 2:46 PM
#1
toomanyknots avatar

toomanyknots

Zen Follower

Join Date:
Jun 2014
Location:
hamilton, ohio
Posts:
100
Plugin Contributions:
0

Quantity Unit Errors when adding to list for products I DIDNT add to cart...

Well I am at a loss. I am using the genesis template that i purchased from envato (which is a really nice template) but it has a bug for me where when I try to add a product from the list of products when viewing the category, I get quantity units errors for the products that I DON'T select to add to cart, which is weird. Nothing is showing up in my logs, so I am at a loss as to how to address this issue. I have contacted the author a week ago about a different issue, so I am not sure when I will be able to talk to them about it. It seems it is only with this template, and I am pretty committed to using it at the moment as I have customized it somewhat. These are the errors I get when I am directed to my cart for the items I did not select:

29 Mar 2015, 2:51 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Quantity Unit Errors when adding to list for products I DIDNT add to cart...

You said it 'seems' to only happen with that template. Have you switched to the Classic template to be sure it's a template issue?

29 Mar 2015, 2:56 PM
#3
toomanyknots avatar

toomanyknots

Zen Follower

Join Date:
Jun 2014
Location:
hamilton, ohio
Posts:
100
Plugin Contributions:
0

Re: Quantity Unit Errors when adding to list for products I DIDNT add to cart...

I have tested on the my current template (avonlee contempo) and everything is hunky dory at the moment. I did just find a fix though from Ajeh on this thread: http://www.zen-cart.com/showthread.php?54989-Display-price-add-to-cart-show-price-only

,where by selecting Display Product Add to Cart Button not to be shown in product listing, I get only an "add to cart button" instead of the quantity selection, which works great!

29 Mar 2015, 5:01 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Quantity Unit Errors when adding to list for products I DIDNT add to cart...

Previously reported here: http://www.zen-cart.com/showthread.php?216543-Update-actionMultipleAddProduct-to-interoperate-with-HTML5-placeholder-attribute

What I did to work around the issue was to create the file /includes/extra_cart_actions/fix_genesis_multiple_add_to_cart.php containing:

<?php
// -----
// Correct the multiple-add-to-cart processing for the genesis theme.  There's an incompatibility between /includes/modules/genesis/product_listing.php's
// use of the HTML5 "placeholder" attribute and the shopping-cart class.  The "placeholder", if not filled in, results in a blank value being returned on
// the "multiple-add-to-cart" request which the shopping-cart interprets as an invalid value because it's not numeric.
//
if (isset ($_GET['action']) && $_GET['action'] == 'multiple_products_add_product' && is_array ($_POST['products_id'])) {
  foreach ($_POST['products_id'] as $pid_check => &$quantity_check) {
    if ($quantity_check == '') {
      $quantity_check = 0;
      
    }
  }
  unset ($pid_check, $quantity_check);
  reset ($_POST['products_id']);
  
}