Shopping cart page - unable to update product quantity
This one got me puzzled (client site): When on the shopping cart page, I am unable to update the quantity in cart of any given product. I can change the quantity in the box but pressing the update icon does nothing.
Site is bubs2grubsknitting[dot]com[dot]au
ZC version 1.5.5e
PHP 5.6.30
I have scoured through virtually every similar thread dealing with this issue, to no avail.
Compared the files
includes/modules/pages/shopping_cart/header_php.php
includes/templates/bubs/template/tpl_shopping_cart_default.php
to relevant stock files and can't find any differences (other than css / display changes in the override template file).
Thanks guys
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
frank18
This one got me puzzled (client site): When on the shopping cart page, I am unable to update the quantity in cart of any given product. I can change the quantity in the box but pressing the update icon does nothing.
Site is bubs2grubsknitting[dot]com[dot]au
ZC version 1.5.5e
PHP 5.6.30
I have scoured through virtually every similar thread dealing with this issue, to no avail.
Compared the files
includes/modules/pages/shopping_cart/header_php.php
includes/templates/bubs/template/tpl_shopping_cart_default.php
to relevant stock files and can't find any differences (other than css / display changes in the override template file).
Thanks guys
looks like your form is closing before the quantity input field and update button. should be below input or just above the shipping estimator section.
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
davewest
looks like your form is closing before the quantity input field and update button. should be below input or just above the shipping estimator section.
Thanks Dave, but that is not the case. Form closes just above the shipping estimator section, exactly the same as it is in the stock template_default/templates/tpl_shopping_cart_default.php file - no difference.
Re: Shopping cart page - unable to update product quantity
Here is the actual tpl_shopping_cart_default.php file:
PHP Code:
<?php
/**
* Page Template
*
* Loaded automatically by index.php?main_page=shopping_cart.<br />
* Displays shopping-cart contents
*
* @package templateSystem
* @copyright Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Author: DrByte Thu Jan 7 22:38:14 2016 -0500 Modified in v1.5.5 $
*/
?>
<div class="centerColumn" id="shoppingCartDefault">
<?php
if ($flagHasCartContents) {
?>
<?php
if ($_SESSION['cart']->count_contents() > 0) {
?>
<div class="forward"><?php echo TEXT_VISITORS_CART; ?></div>
<?php
}
?>
<h1 id="cartDefaultHeading"><?php echo HEADING_TITLE; ?></h1>
<?php if ($messageStack->size('shopping_cart') > 0) echo $messageStack->output('shopping_cart'); ?>
<?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product', $request_type), 'post', 'id="shoppingCartForm"'); ?>
<?php
$page_query = $db->Execute("SELECT pages_html_text FROM ezpages WHERE pages_title='Shopping Cart Info'");
$shoppingcartinfo_text = $page_query->fields['pages_html_text'];
echo $shoppingcartinfo_text;
?>
</div>
<?php if (!empty($totalsDisplay)) { ?>
<div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div>
<br class="clearBoth" />
<?php } ?>
<?php if ($flagAnyOutOfStock) { ?>
<?php if (STOCK_ALLOW_CHECKOUT == 'true') { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>
<?php } else { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>
<?php } //endif STOCK_ALLOW_CHECKOUT ?>
<?php } //endif flagAnyOutOfStock ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
<tr class="tableHeading">
<th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
<th scope="col" id="scUpdateQuantity"> </th>
<th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE; ?></th>
<th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
<th scope="col" id="scRemoveHeading"> </th>
</tr>
<!-- Loop through all products /-->
<?php
foreach ($productArray as $product) {
?>
<tr class="<?php echo $product['rowClass']; ?>">
<td class="cartQuantity">
<?php
if ($product['flagShowFixedQuantity']) {
echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
} else {
echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
}
?>
</td>
<td class="cartQuantityUpdate">
<?php
if ($product['buttonUpdate'] == '') {
echo '' ;
} else {
echo $product['buttonUpdate'];
}
?>
</td>
<td class="cartProductDisplay">
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
<br class="clearBoth" />
<?php
echo $product['attributeHiddenField'];
if (isset($product['attributes']) && is_array($product['attributes'])) {
echo '<div class="cartAttribsList">';
echo '<ul>';
reset($product['attributes']);
foreach ($product['attributes'] as $option => $value) {
?>
<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>
<?php
}
echo '</ul>';
echo '</div>';
}
?>
</td>
<td class="cartUnitDisplay"><?php echo $product['productsPriceEach']; ?></td>
<td class="cartTotalDisplay"><?php echo $product['productsPrice']; ?></td>
<td class="cartRemoveItemDisplay">
<?php
if ($product['buttonDelete']) {
?>
<a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&product_id=' . $product['id']); ?>"><?php echo zen_image($template->get_template_dir(ICON_IMAGE_TRASH, DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . ICON_IMAGE_TRASH, ICON_TRASH_ALT); ?></a>
<?php
}
if ($product['checkBoxDelete'] ) {
echo zen_draw_checkbox_field('cart_delete[]', $product['id']);
}
?>
</td>
</tr>
<?php
} // end foreach ($productArray as $product)
?>
<!-- Finished loop through all products /-->
</table>
<div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $cartShowTotal; ?></div>
<br class="clearBoth" />
<!--bof shopping cart buttons-->
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div>
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div>
<?php
// show update cart button
if (SHOW_SHOPPING_CART_UPDATE == 2 or SHOW_SHOPPING_CART_UPDATE == 3) {
?>
<div class="buttonRow back"><?php echo zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT); ?></div>
<?php
} else { // don't show update button below cart
?>
<?php
} // show update button
?>
<!--eof shopping cart buttons-->
</form>
<br class="clearBoth" />
<?php
if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') {
?>
<div class="buttonRow back"><?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_SHIPPING_ESTIMATOR) . '\')">' .
zen_image_button(BUTTON_IMAGE_SHIPPING_ESTIMATOR, BUTTON_SHIPPING_ESTIMATOR_ALT) . '</a>'; ?></div>
<?php
}
?>
<!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** -->
<?php // the tpl_ec_button template only displays EC option if cart contents >0 and value >0
if (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
include(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/tpl_ec_button.php');
}
?>
<!-- ** END PAYPAL EXPRESS CHECKOUT ** -->
<?php
if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '2') {
/**
* load the shipping estimator code if needed
*/
?>
<?php require(DIR_WS_MODULES . zen_get_module_directory('shipping_estimator.php')); ?>
<?php
}
?>
<?php
} else {
?>
<h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY; ?></h2>
<?php
$show_display_shopping_cart_empty = $db->Execute(SQL_SHOW_SHOPPING_CART_EMPTY);
while (!$show_display_shopping_cart_empty->EOF) {
?>
<?php
if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_FEATURED_PRODUCTS') { ?>
<?php
/**
* display the Featured Products Center Box
*/
?>
<?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
<?php } ?>
<?php
if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_SPECIALS_PRODUCTS') { ?>
<?php
/**
* display the Special Products Center Box
*/
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>
<?php
if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_NEW_PRODUCTS') { ?>
<?php
/**
* display the New Products Center Box
*/
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>
<?php
if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_UPCOMING') {
include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS));
}
?>
<?php
$show_display_shopping_cart_empty->MoveNext();
} // !EOF
?>
<?php
}
?>
</div>
Re: Shopping cart page - unable to update product quantity
If you're questioning the files (though there are many others that support even what is seen in the code above and there are database settings to boot), then upon submission of the form, the general process would include:
includes/auto_loaders/config.base.php which loads
includes/init_includes/init_cart_handler.php which loads
includes/main_cart_actions.php which is expected to load
All of the includes/extra_cart_actions files which may prevent "update" or change of the total amount/quantity before feeding back to have the shopping_cart page load again. After those files (if present) are parsed/acted upon then there is the shopping_cart class itself found in includes/classes. Then through all this there is the possibility of one or more observers that could be taking action to prevent changing the total quantity in the cart. There also could be a cart override "class" that is loaded ahead of the default shopping_cart class to take its place and that may have something involved.
Lots of possibilities. Would suggest identifying what has been installed that might have modified any of those files or that process, differences in the overall system, and anything else that might be further helpful.
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
frank18
This one got me puzzled (client site): When on the shopping cart page, I am unable to update the quantity in cart of any given product. I can change the quantity in the box but pressing the update icon does nothing.
Site is bubs2grubsknitting[dot]com[dot]au
It is a JavaScript problem. If JS is disabled the quantity can updated.
Further checking showed you are loading jQuery twice, and two different versions.
Results of viewing page source shows:
#25
Code:
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="//code.jquery.com/jquery-1.12.0.min.js"%3E%3C/script%3E'));</script>
#153 - #157
Code:
<link rel="stylesheet" type="text/css" href="includes/templates/bubs/css/zen_lightbox.css"><script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write("<scr" + "ipt type=\"text/javascript\" src=\"//code.jquery.com/jquery-1.11.3.min.js\"></scr" + "ipt>");
}
</script>
Lines #153 - #157 should be removed as 'zen_lightbox.css' was previously loaded as was 'jquery-1.12.0.min.js'.
Even better is to not use Slimbox but some other script.
Re: Shopping cart page - unable to update product quantity
Zen Colorbox is about to be updated, just verifying the installation script and then will be submitting as an update to: https://www.zen-cart.com/downloads.php?do=file&id=1322
Current version includes documentation to support manually applying the SQL; however, the version currently on the site needs massaging (expecting to upload it, but didn't yesterday). The issues with the sql are that some do not identify the fields to which the value is to be applied so in some queries if the associated table had been modified there might be an error/issue, also that NULL is used to assign to the configuration_id that auto-numbers and that could be an issue depending on the system/database to which it is applied (some expect '' instead of NULL). Anyways, that software is available at https://github.com/mc12345678/zen-co...ree/z4a-master.
There is currently an auto-install script provided. It can be used or ignored. To remove it or not use it, simply remove (prior to navigating the admin after upload of the files) or do not upload the file admin/includes/auto_loaders/config.zcb.php
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
mc12345678
If you're questioning the files (though there are many others that support even what is seen in the code above and there are database settings to boot), then upon submission of the form, the general process would include:
includes/auto_loaders/config.base.php which loads
includes/init_includes/init_cart_handler.php which loads
includes/main_cart_actions.php which is expected to load
All of the includes/extra_cart_actions files which may prevent "update" or change of the total amount/quantity before feeding back to have the shopping_cart page load again. After those files (if present) are parsed/acted upon then there is the shopping_cart class itself found in includes/classes. Then through all this there is the possibility of one or more observers that could be taking action to prevent changing the total quantity in the cart. There also could be a cart override "class" that is loaded ahead of the default shopping_cart class to take its place and that may have something involved.
Lots of possibilities. Would suggest identifying what has been installed that might have modified any of those files or that process, differences in the overall system, and anything else that might be further helpful.
None of the files listed above have been altered or are missing, all are standard ZC 1.5.5e files.
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
Website Rob
It is a JavaScript problem. If JS is disabled the quantity can updated.
Had that inkling, need to look into this further.
Quote:
Originally Posted by
Website Rob
Lines #153 - #157 should be removed as 'zen_lightbox.css' was previously loaded as was 'jquery-1.12.0.min.js'.....
Did that, no change...
Re: Shopping cart page - unable to update product quantity
Two things I noticed.
You mentioned using 1.5.5e but it looks like some links are hard-coded, old code? Reason being is I see 'main_page=page&id' instead of 'main_page=page&amp;id' in a lot of links.
Code:
- <ul>
- <li><a href="index.php?main_page=page&id=13">Shipping</a></li>
- <li><a href="index.php?main_page=page&id=6">Ordering</a></li>
- <li><a href="index.php?main_page=page&id=4">Payment</a></li>
- <li><a href="index.php?main_page=page&id=10">Returns Policy</a></li>
- <li><a href="index.php?main_page=page&id=26">Q & A</a></li>
- <li><a href="index.php?main_page=page&id=9">Privacy Policy</a></li>
- </ul></li>
The other is when editing was done to the Shopping page there was an incorrect placement of HTML code.
Edit should be like so:
Code:
<form name="cart_quantity" action="https://bubs2grubsknitting.com.au/index.php?main_page=shopping_cart&action=update_product&zenid=removed_by_WR" method="post" id="shoppingCartForm"><input type="hidden" name="securityToken" value="removed_by_WR" />
<div>
<p style="text-align: center;">
<strong style="font-family: Verdana; color: rgb(255, 0, 0);">If ordering discontinued product please do not order more than current stock holding as these are also unavailable at the suppliers.</strong></p>
<p style="text-align: center;">
<br />
<span style="color:#800080;"><span style="font-size: 12px;"><span style="font-family: Verdana;"><strong>If your order is over $100 and contains mainly discontinued yarns payment of postage would be much appreciated as these are priced out at cost + 10% GST.</strong></span></span></span></p>
<p style="text-align: center;">
<span style="color:#0000ff;"><span style="font-size: 12px;"><span style="font-family: Verdana;"><strong>$10 Flate rate - if you order fits in a 3kg satchel it will be posted via express post</strong></span></span></span><br />
</p>
</div>
As it is currently, a <div> tag is missing and the FORM is not properly coded. This may or may not solve the Quantity problem but it is coding that needs to be corrected.
Speaking of which, I found the above problems using the validator.w3.org which is always a handy tool--regardless of having problems or not.
Re: Shopping cart page - unable to update product quantity
are you using an ajax plugin to update the quantity?
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
carlwhat
are you using an ajax plugin to update the quantity?
No, nothing like that on this client site
Re: Shopping cart page - unable to update product quantity
Quote:
Originally Posted by
Website Rob
Two things I noticed.
.........
As it is currently, a <div> tag is missing and the FORM is not properly coded. This may or may not solve the Quantity problem but it is coding that needs to be corrected.
Speaking of which, I found the above problems using the validator.w3.org which is always a handy tool--regardless of having problems or not.
Well, you weren't too far off with your missing <div> tag.
Changed this
Code:
<?php
$page_query = $db->Execute("SELECT pages_html_text FROM ezpages WHERE pages_title='Shopping Cart Info'");
$shoppingcartinfo_text = $page_query->fields['pages_html_text'];
echo $shoppingcartinfo_text;
?>
</div>
to this, just to "tidy up"
Code:
<div>
<?php
$page_query = $db->Execute("SELECT pages_html_text FROM ezpages WHERE pages_title='Shopping Cart Info'");
$shoppingcartinfo_text = $page_query->fields['pages_html_text'];
echo $shoppingcartinfo_text;
?>
</div>
and the addition of that missing opening <div> tag fixed the update quantity issue.
I found that many boo-boos on this site (from the previous developer) that I am not really surprised. What else will I find in the next few months????
Anyway, thanks all for taking the time to look at this issue, much appreciated!
Cheers / Frank
Re: Shopping cart page - unable to update product quantity
Considering that the original line of the template_default/templates/tpl_shopping_cart_default.php file was a one liner that was expanded to multiple to include omitting/losing the div tag, may want to consider the impact of restoring the other parameters of that div tag to have it like so:
Code:
<div id="cartInstructionsDisplay" class="content">
instead of just being a div tag.
Original line from a ZC 1.5.5 template_default version:
Code:
<div id="cartInstructionsDisplay" class="content"><?php echo TEXT_INFORMATION; ?></div>
Which as described above was modified to use a lookup for the content to be displayed in the position of TEXT_INFORMATION.
At least that way would have direct/specific control of any associated formatting even if it were to be to remove the formatting directly associated with that tag. :)
So was this difference one of those CSS/display changes in the override template file to which you referred in the OP?