Page 1 of 1

Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 1:10 am
by Seraph77
When there is a product in the cart and I go to vew cart page, the page title says, Use Gift Certificate (0.50kg). The weight changes and is the weight of the actual product.

No gift certificates have been purchased and why would the weight appear there??

I would prefer to have either Shopping Cart or the product name on there. Where can I change this?

jpg screenshot:
Image

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 1:36 am
by Seraph77
Update:
If I change heading title in voucher.php to 'Shopping Basket', the title changes to 'Shopping Basket(0.05kg)' and the lower 'Use Gift Certificate' changes to Shopping Basket too.

If I change 'text voucher', nothing happens.

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 1:45 am
by pom

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 2:41 am
by straightlight
Which OC version? In the mean time, switch back to the default theme and see if you can reproduce the same issue.

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 3:23 am
by Seraph77
Changing the theme to default made no difference to the cart title.

Looking at the thread Pom posted. I made the edit suggested in this post: viewtopic.php?p=700549#p700549

As a result, 'Use Gift Certifcate (0.50kg)' changed to 'Shopping Cart (0.50kg)'.

So it did half the job as the weight is still displaying.

Any suggestions?

OC: 3.0.2.0
Theme: Journal 2
Plug-in's: SEO Pack Pro

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 4:51 pm
by Seraph77
Any suggestions anyone? Any ideas what causes the product weight to be added to the cart page title? It looks really bad.

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 5:18 pm
by phinq1910
go to file catalog\view\theme\*\template\checkout\cart.tpl, search

Code: Select all

if ($weight)
and remove following:

Code: Select all

<?php if ($weight) { ?>
        &nbsp;(<?php echo $weight; ?>)
        <?php } ?>

Re: Cart Title is adding Product Weight

Posted: Wed Nov 01, 2017 10:36 pm
by Johnathan
Rather than edit core files, you can actually just turn this off in the admin panel. It's a setting called "Display Weight on Cart Page" in System > Settings > Option.

Re: Cart Title is adding Product Weight

Posted: Thu Nov 02, 2017 12:03 am
by Seraph77
All sorted, thanks everyone! :)

Re: Cart Title is adding Product Weight

Posted: Tue Mar 20, 2018 12:50 am
by dynamicsites
Johnathan wrote:
Wed Nov 01, 2017 10:36 pm
Rather than edit core files, you can actually just turn this off in the admin panel. It's a setting called "Display Weight on Cart Page" in System > Settings > Option.
Any advice if setting is as suggested but still the weight appears on the Cart Page?
Opencart 3.0.2 with Journal theme, Cart is default ("Quickcheckout" option has been disabled)

Thanks in advance,
Alex

Image

Re: Cart Title is adding Product Weight

Posted: Wed Mar 21, 2018 4:53 am
by Johnathan
If you're using 3.0, make sure you turn off twig caching in the main admin dashboard. You do that using the small gear icon in the upper-right. It's possible the page was just getting cached.

If that's not it, you can manually remove that text by making this edit in 3.0.2.0:

Code: Select all

IN:
/catalog/view/theme/YOURTHEME/template/checkout/cart.twig

DELETE:
&nbsp;({{ weight }})

Re: Cart Title is adding Product Weight

Posted: Thu Mar 22, 2018 3:23 pm
by dynamicsites
Hi Johnathan, thanks for the information.

Unfortunately changing the suggested twig file didn't work (cache was already deactivated).
Could it be that I need to tweak the core twig file? As mentioned, I have disabled the theme's "quickcheckout" and using the default cart.

Thanks,
Alex

Re: Cart Title is adding Product Weight

Posted: Fri Mar 23, 2018 1:14 am
by Johnathan
If you made that edit, then it definitely should be working. Some things to check:

1. Are you sure you *cleared* the Twig cache, not just disabled it? If you didn't clear it then it will still use the old cached files, even if you disable it.

2. Double-check that you've edited the file in your theme, and not the default theme (unless you're using that).

3. If you used the Theme Editor in the admin panel, that will override any edits you make to the .twig files themselves. Double-check that you haven't edited the checkout/cart.twig file in the Theme Editor.

4. Make sure you clear/disable all other caching on your site. Another caching mechanism could be at play here.

Re: Cart Title is adding Product Weight

Posted: Fri Mar 23, 2018 1:44 am
by straightlight
If your cache is causing issue, ensure to follow these two posts:

- viewtopic.php?f=176&p=718325#p718325
- viewtopic.php?f=176&p=718325#p717782

Re: Cart Title is adding Product Weight

Posted: Fri Mar 30, 2018 3:29 am
by dynamicsites
A big apology to all, it turns out I'm an idiot for not explaining properly what I'm trying to do. :clown:
I am actually trying to remove cart weight from the shipping method in the checkout page, please see image below.
It dawned on me when I started comparing the code from the section I'm trying to edit to the code in the Twig file.
Also, it's definitely not a caching issue. I checked ALL cache files via FTP and they are absolutely fresh (created at the exact moment I refreshed cache).

https://imgur.com/a/5hLN0

Re: Cart Title is adding Product Weight

Posted: Fri Mar 30, 2018 10:43 pm
by Johnathan
I e-mailed this to dynamicsites, but for others that need this in the future, here's the edit you need to remove the weight from the Weight Based Shipping rate title:

Code: Select all

IN:
/catalog/model/shipping/weight.php
or
/catalog/model/extension/shipping/weight.php

REPLACE:
'title'        => $result['name'] . '  (' . $this->language->get('text_weight') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')',

WITH:
'title'        => $result['name'],

Re: Cart Title is adding Product Weight

Posted: Fri Mar 30, 2018 10:48 pm
by straightlight
For which OC version is this replacement code for?

Re: Cart Title is adding Product Weight

Posted: Sun Apr 01, 2018 2:41 am
by dynamicsites
straightlight wrote:
Fri Mar 30, 2018 10:48 pm
For which OC version is this replacement code for?
My installation is v.3.0.2.0 and it worked great.

Re: Cart Title is adding Product Weight

Posted: Tue Apr 03, 2018 9:42 pm
by Johnathan
straightlight wrote:
Fri Mar 30, 2018 10:48 pm
For which OC version is this replacement code for?

Literally every OpenCart version since 1.5.1. The syntax for that line is slightly different in 1.5.0 and older, but I doubt there are many users of versions that old these days. If you do have a version that's 1.4.x or 1.5.0, the line is pretty much the same, so it shouldn't be hard to find.

Re: Cart Title is adding Product Weight

Posted: Tue Apr 03, 2018 9:59 pm
by straightlight
Johnathan wrote:
Tue Apr 03, 2018 9:42 pm
straightlight wrote:
Fri Mar 30, 2018 10:48 pm
For which OC version is this replacement code for?

Literally every OpenCart version since 1.5.1. The syntax for that line is slightly different in 1.5.0 and older, but I doubt there are many users of versions that old these days. If you do have a version that's 1.4.x or 1.5.0, the line is pretty much the same, so it shouldn't be hard to find.
No problem. Although, it would of still be informative to indicate the OC version range that is available to use the provided codes to help future users. ;)