Post by buzrocks » Fri Dec 21, 2018 6:38 am

Johnathan wrote:
Thu Oct 26, 2017 9:48 pm
This is a 3.0 bug that you can fix by doing this:

Code: Select all

IN:
/catalog/controller/checkout/cart.php

AFTER:
if ($this->cart->hasProducts() || !empty($this->session->data['vouchers'])) {

ADD:
$data['heading_title'] = $this->language->get('heading_title');
I just wanted to thank this poster for helping me fix this. I added the code as suggested then refreshed my modifications cache and theme/sass cache and it worked beautifully. THANK YOU! Opencart version 3.0.2.0

Newbie

Posts

Joined
Tue Apr 01, 2014 1:55 am

Post by Johnathan » Fri Dec 21, 2018 11:31 pm

Glad I could help! :)

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by eddiec » Sat Feb 16, 2019 2:06 am

Johnathan wrote:
Thu Oct 26, 2017 9:48 pm
This is a 3.0 bug that you can fix by doing this:

Code: Select all

IN:
/catalog/controller/checkout/cart.php

AFTER:
if ($this->cart->hasProducts() || !empty($this->session->data['vouchers'])) {

ADD:
$data['heading_title'] = $this->language->get('heading_title');
After encountering the same issue I also found that Johnathan's fix resolves the issue fine, but I wanted to find the root cause.

After a bit of digging I think I have found the root cause as below.

Root cause - heading_title is overridden by additional total modules

The title of the main checkout cart page, taken from the corresponding language file (\catalog\language\en-gb\checkout\cart.php), is set on Line 6 of /catalog/controller/checkout/cart.php

Code: Select all

$this->document->setTitle($this->language->get('heading_title'));
This is overridden by any heading_title (Use Reward Points, Use Coupon Code, Estimate Shipping & Taxes, Use Gift Certificate) from any language file in \catalog\language\en-gb\extension\total, loaded when any additional module in \catalog\controller\extension\total is loaded by the following Lines 222-234 in the controller /catalog/controller/checkout/cart.php:

Code: Select all

			$data['modules'] = array();
			
			$files = glob(DIR_APPLICATION . '/controller/extension/total/*.php');

			if ($files) {
				foreach ($files as $file) {
					$result = $this->load->controller('extension/total/' . basename($file, '.php'));
					
					if ($result) {
						$data['modules'][] = $result;
					}
				}
			}
Fix

Messy fix -> One way to avoid the title of the cart being overridden is to change the name heading_title in the language file and then change any references to it in cart.php and the cart.twig layout file, but that is messy.

Good fix -> Jonathan's fix works well as it saves the title in the main $data array so it can't be overridden when the language files of any total modules are loaded. The title is still initially set in Line 6 however so the only minor tweak I would suggest is to use HugoSega's approach (posting.php?mode=quote&f=202&t=198804&p=700549#pr709505) and just replace Line 6 with:

Code: Select all

$data['heading_title'] = $this->language->get('heading_title');
I notice that /catalog/controller/checkout/cart.php is unchanged in OpenCart 3.0.3.1, so I assume that the bug will still be present in that.

Newbie

Posts

Joined
Fri Jul 12, 2013 8:33 am
Who is online

Users browsing this forum: No registered users and 27 guests