Forums / Upgrading to 2.x.x / Update quantity in cart not updating

Update quantity in cart not updating

Views: 1,121

Results 1 to 20 of 24
6 Jan 2025, 3:07 PM
#1
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Update quantity in cart not updating

ZC 2.1.0

Not sure if this is a bug or if I did something wrong, did anybody else have problems with updating the quantity in the shopping cart? right before checking out. When I change the quantity and click the Update icon, neither the quantity or the amount is updated.
Attachment 20847

6 Jan 2025, 3:11 PM
#2
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,845
Plugin Contributions:
0

Re: Update quantity in cart not updating

is that the bootstrap template? what version of the template?

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

6 Jan 2025, 3:22 PM
#3
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

Yes Bootstrap 3.7.4

7 Jan 2025, 10:39 AM
#4
royaldave avatar

royaldave

Zen Follower

Join Date:
Aug 2013
Location:
Perth, WA, AU
Posts:
285
Plugin Contributions:
1

Re: Update quantity in cart not updating

DML73:

Yes Bootstrap 3.7.4

Which version of zc did you upgrade from and how old is your database?

I had the same issue and ended up putting in the recursive classic template file with a few embellishments copied in from the bootstrap version as a workaround.

My db is 10 years old and I swear it's something to do with it because if I use the test db it works fine.

7 Jan 2025, 10:44 AM
#5
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

That's what I was afraid of. I upgraded from v1.5.7, but the database is even older, from 1.3.x I believe.

Do you remember which files fixed this? or did you use the full classic template file-set?

7 Jan 2025, 1:58 PM
#6
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: Update quantity in cart not updating

i would open the dev tools and look at the console.

i have a feeling you have an error there that is causing the problem.

i would think it unlikely to be a db problem. although i could be wrong…

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

8 Jan 2025, 12:28 PM
#7
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: Update quantity in cart not updating

If you followed the upgrade process and upgraded your database during your upgrade process, then your database is not from v1.3.x - it's now an upgraded database and you're free to say it's from 2.1.0
I upgraded a 1.2.4 site recently (yup, you read it right) and it's currently on 2.1.0 and everything works just fine so it's very unlikely that this is a database issue.

A URL would help for sure... Maybe your form element is closing before the update button?

My site - Pro ZC Help
My portfolio | My plugins

8 Jan 2025, 4:12 PM
#8
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

Sounds good regarding the database.
The url is: https://nordfield.com/
Any ideas would be great.

8 Jan 2025, 5:44 PM
#9
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: Update quantity in cart not updating

I'm not familiar with that template, but do check your includes/templates/bootstrap/templates/tpl_shopping_cart_default.php

You're missing one line:

echo zen_draw_hidden_field('products_id[]', $product['id']);

When you click the update button, quantities are POSTed, but there's no products_id array, and I don't see the hidden products_id field anywhere in the form...

My site - Pro ZC Help
My portfolio | My plugins

8 Jan 2025, 5:49 PM
#10
royaldave avatar

royaldave

Zen Follower

Join Date:
Aug 2013
Location:
Perth, WA, AU
Posts:
285
Plugin Contributions:
1

Re: Update quantity in cart not updating

DML73:

That's what I was afraid of. I upgraded from v1.5.7, but the database is even older, from 1.3.x I believe.

Do you remember which files fixed this? or did you use the full classic template file-set?

Sorry, overseas at present so can't be too precise.

Try replacing tpl_shopping_cart.php with the version from recursive classic. But you'll need to comment out some lines referring to mobil usage. If the functionality works then you have the same issue I have.

I can send you my file if you want. Pm me your email and I can send to you.

8 Jan 2025, 5:53 PM
#11
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: Update quantity in cart not updating

Also, just realized - check your includes/modules/pages/shopping_cart/header_php.php and make sure you have the following lines:

$buttonUpdate = '';
    if (SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) {
        if (!$showFixedQuantity) {
            $buttonUpdate = zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT);
        } else {
            $buttonUpdate = zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT, 'style="opacity: 0.25" disabled="disabled"');
        }
    }
    $buttonUpdate .= zen_draw_hidden_field('products_id[]', $products[$i]['id']);

    $productArray[$i] = [
        'attributeHiddenField' => $attributeHiddenField,
        'flagStockCheck' => $flagStockCheck,
        'flagShowFixedQuantity' => $showFixedQuantity,
        'linkProductsImage' => $linkProductsImage,
        'linkProductsName' => $linkProductsName,
        'productsImage' => $productsImage,
        'productsName' => $productsName,
        'productsModel' => $productsModel,
        'showFixedQuantity' => $showFixedQuantity,
        'showFixedQuantityAmount' => $showFixedQuantityAmount,
        'showMinUnits' => $showMinUnits,
        'quantityField' => $quantityField,
        'buttonUpdate' => $buttonUpdate,
        'productsPrice' => $productsPriceTotal,
        'productsPriceEach' => $productsPriceEach,
        'rowClass' => $rowClass,
        'buttonDelete' => $buttonDelete,
        'checkBoxDelete' => $checkBoxDelete,
        'id' => $products[$i]['id'],
        'attributes' => empty($attrArray) ? false : $attrArray,
    ];

My site - Pro ZC Help
My portfolio | My plugins

8 Jan 2025, 6:34 PM
#12
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

Thanks for all suggestions, I found that if I replace tpl_shopping_cart_default.php in the Bootstrap template with the same file from the default template then it's working. So now I guess I just have to find exactly what is missing/wrong in that file.

8 Jan 2025, 7:17 PM
#13
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,843
Plugin Contributions:
17

Re: Update quantity in cart not updating

Warning to those who know how to dig around. Stay out of the stylesheets.

You have lots of problems on the site other than just the update.

One category's products all result in 404

A non-zencart stylesheet is placing the add to cart form on top of all your product descriptions.

One of them is dangerous and not a part of a standard ZC load.

All of this could have been discovered earlier if you had followed the Posting Tips.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

8 Jan 2025, 7:36 PM
#14
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

Yes indeed this is a work in progress. The site is not live yet, I just took it out of maintenance mode so people here could take a look at it regarding the update problem.
The add to cart form is on top of the description on all product pages right now I believe.

But I'm surprised about "One category's products all result in 404", on which category do you see that?

Also, "One of them is dangerous and not a part of a standard ZC load", please let me know which one you mean and why it's dangerous.

"Posting Tips" please let me know what you are referring to here, thanks.

Much appreciated, thanks a lot!

8 Jan 2025, 8:13 PM
#15
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: Update quantity in cart not updating

dbltoe:

Warning to those who know how to dig around. Stay out of the stylesheets.
Do you mind clarifying this? What dangers lurk, other than a misaligned element?

One category's products all result in 404
I'll assume it's USB To Serial where the descriptions link to static URLs which probably just haven't been enabled yet.

A non-zencart stylesheet is placing the add to cart form on top of all your product descriptions.
You mean the bootstrap template stylesheets? I believe Cindy made it like that for easier updating...
I don't see any other stylesheets being loaded other than the ones that are distributed with the template...

One of them is dangerous and not a part of a standard ZC load.
A dangerous stylesheet? :blink:

With all due respect, such vague and misleading posts don't benefit anyone. If you think something's DANGEROUS (and we all know what that word means), elaborate it straight away and help the person fix it, don't leave them hanging. If it breaks layout, it's not dangerous, it's just something that needs to be fixed.
For example, product page for model STE-232 (I won't post the link so search engines don't pick it up) shows the CSS error, but it's a simple fix - for some reason there's an added line in stylesheet.css:

.productDescription {
  width: 210%;
  margin-top: 25px;
}

Removing that line will fix the overlap. These are simple mistakes, but not something I'd call dangerous...

My site - Pro ZC Help
My portfolio | My plugins

8 Jan 2025, 9:48 PM
#16
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,843
Plugin Contributions:
17

Re: Update quantity in cart not updating

It's not included in the bootstrap mod and, if you access using the basic URL of the stylesheet, a trojan is launched.

Being grouped with the cloudflare files, one might assume....

As far as Posting Tips, every time you start or answer a thread, you are presented with the Posting Tips. When you started this thread, you actually had to delete the reminder to use them.

Also, USB to Serial Adapter

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

8 Jan 2025, 10:26 PM
#17
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: Update quantity in cart not updating

dbltoe:

It's not included in the bootstrap mod and, if you access using the basic URL of the stylesheet, a trojan is launched.

Being grouped with the cloudflare files, one might assume....
The bootstrap css file is being loaded from cdn.jsdeliver.net (one of the most trusted sources), the npm indicates it's coming directly from the official npm registry and the integrity SRI hash exists and is valid.
I don't know where you got the trojan alert form, but it's definitely not from that CSS file.

As far as Posting Tips, every time you start or answer a thread, you are presented with the Posting Tips. When you started this thread, you actually had to delete the reminder to use them.
Yeah, but most has been said, at least the information that matters... PHP version is the only thing we don't know, but even if it were php 10.5 and MySQL 11.3 running on CentOS 17 that was released in 2050, it wouldn't change the fact that the form doesn't contain products_id hidden field(s) so there's nothing to process.

My money is on includes/modules/pages/shopping_cart/header_php.php :wink:

My site - Pro ZC Help
My portfolio | My plugins

9 Jan 2025, 1:10 AM
#18
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,843
Plugin Contributions:
17

Re: Update quantity in cart not updating

My money's with you on this one as well.

I still wonder why the .net is resolving to .com.

And, the more posting tips the easier for some of us to help.

Not everyone here is as familiar with an area without "looking" at it. Didn't someone say, "knowledge is power"?

IMHO, if the Posting Tips are included with at least the opening of a post, the answer can be reached much faster.

Likewise, if someone joins a thread with a "similiar" problem, we know from the start that the likelihood of similar is not always true. Again, in such cases, posting tips answers would probably get us to a resolution quicker.

Don't make me research all the times you have asked for a display log. ;-) (smilies are down apparently)

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

9 Jan 2025, 7:05 AM
#19
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

balihr:

The bootstrap css file is being loaded from cdn.jsdeliver.net (one of the most trusted sources), the npm indicates it's coming directly from the official npm registry and the integrity SRI hash exists and is valid.
I don't know where you got the trojan alert form, but it's definitely not from that CSS file.

Yeah, but most has been said, at least the information that matters... PHP version is the only thing we don't know, but even if it were php 10.5 and MySQL 11.3 running on CentOS 17 that was released in 2050, it wouldn't change the fact that the form doesn't contain products_id hidden field(s) so there's nothing to process.

My money is on includes/modules/pages/shopping_cart/header_php.php :wink:

Thanks, that answered all my questions and concerns, except solving the actual problem of course :D

I do see:

$buttonUpdate .= zen_draw_hidden_field('products_id[]', $products[$i]['id']);
and
'buttonUpdate' => $buttonUpdate,

in

includes/modules/pages/shopping_cart/header_php.php

so apparently that isn't the problem.

But as I mentioned earlier, when I replace:

includes/templates/bootstrap/templates/tpl_shopping_cart_default.php

with

includes/templates/template_default/templates/tpl_shopping_cart_default.php

Then the update button works, but the layout gets mixed up. So there must be something missing/wrong in that file. I guess? Just can't seem to find the exact missing link.

9 Jan 2025, 8:21 AM
#20
dml73 avatar

dml73

Zen Follower

Join Date:
Oct 2007
Posts:
414
Plugin Contributions:
0

Re: Update quantity in cart not updating

Seems like I found a solution, not sure if it's the correct way of fixing this, but in tpl_shopping_cart_default.php it looks like the update action function was in the wrong table cell, so I moved:

<span class="qtyUpdateCell text-center d-none d-sm-table-cell"><?php echo (!empty($product['buttonUpdate'])) ? $product['buttonUpdate'] : ''; ?></span>

in line 121 to line 116. So line 116 no looks like this:

            <span class="qtyUpdateCell text-center d-none d-sm-table-cell"><?php echo (!empty($product['buttonUpdate'])) ? $product['buttonUpdate'] : ''; ?></span></div>