Post by igoryakovlev666 » Wed Aug 30, 2017 9:21 pm

Hi, i have some problem with heading_title and some other text variable. For example in demo, when some products are added to the cart, in cart page heading title is "Shopping Cart", but in my case heading title is "Use Gift Certificate". This variable overwritten from other controllers, if they are added to page, i dont understand hot to fix it. Help plz.


Posts

Joined
Wed Aug 09, 2017 10:25 pm

Post by sachin6609 » Wed Aug 30, 2017 9:44 pm

igoryakovlev666 wrote:
Wed Aug 30, 2017 9:21 pm
Hi, i have some problem with heading_title and some other text variable. For example in demo, when some products are added to the cart, in cart page heading title is "Shopping Cart", but in my case heading title is "Use Gift Certificate". This variable overwritten from other controllers, if they are added to page, i dont understand hot to fix it. Help plz.
Hello igoryakovlev666

Can you please tell me which opencart version you are using and that cart screen short also with problem explanation

Thanks

sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by thekrotek » Wed Aug 30, 2017 9:50 pm

It's easy, actually. Simply load cart page language file before template is rendered and assign $data['heding_title'] again.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by igoryakovlev666 » Wed Aug 30, 2017 11:33 pm

sachin6609 wrote:
Wed Aug 30, 2017 9:44 pm
igoryakovlev666 wrote:
Wed Aug 30, 2017 9:21 pm
Hi, i have some problem with heading_title and some other text variable. For example in demo, when some products are added to the cart, in cart page heading title is "Shopping Cart", but in my case heading title is "Use Gift Certificate". This variable overwritten from other controllers, if they are added to page, i dont understand hot to fix it. Help plz.
Hello igoryakovlev666

Can you please tell me which opencart version you are using and that cart screen short also with problem explanation

Thanks

sachin
3.0.2.0

https://goo.gl/photos/sMULmgg9jF8n1D2z9

This problem occurs every time a page has a module with the same text variable. Screenshot shows that the variable from the module overwrites the variable from cart page..


Posts

Joined
Wed Aug 09, 2017 10:25 pm

Post by JNeuhoff » Thu Aug 31, 2017 12:29 am

This problem occurs every time a page has a module with the same text variable. Screenshot shows that the variable from the module overwrites the variable from cart page..
Update: Now I am able to reproduce it, too.
Last edited by JNeuhoff on Thu Aug 31, 2017 12:35 am, edited 2 times in total.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by igoryakovlev666 » Thu Aug 31, 2017 12:30 am

thekrotek wrote:
Wed Aug 30, 2017 9:50 pm
It's easy, actually. Simply load cart page language file before template is rendered and assign $data['heding_title'] again.
Thx for reply. I can fix it like u solution. If module in left column, i can put
$data['column_left'] = $this->load->controller('common/column_left');
Higher then
$this->load->language('account/forgotten');
And it fix. But is this the best practices?I must remake all "broken" controllers?

For example, there is no such problem on the product page.


Posts

Joined
Wed Aug 09, 2017 10:25 pm

Post by igoryakovlev666 » Thu Aug 31, 2017 12:38 am

JNeuhoff wrote:
Thu Aug 31, 2017 12:29 am
This problem occurs every time a page has a module with the same text variable. Screenshot shows that the variable from the module overwrites the variable from cart page..
I am unable to reproduce this error. You are not telling us the whole story.
The story is that, if the page has a variables in the language file and a module is added to the page. A variables from the module overwrites the original language file of the page. I hope u understand me. Absolute clean version 3.0.2.0. There is no such problem on the opencart demo.


Posts

Joined
Wed Aug 09, 2017 10:25 pm

Post by JNeuhoff » Thu Aug 31, 2017 12:44 am

I am just looking at it, normally a module used on the colum_left or colum_right should have been rendered before being assigned to a $data['<what-ever>'] variable.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JNeuhoff » Thu Aug 31, 2017 8:29 pm

The error is caused by the event handler at catalog/controller/event/language.php in this method:

Code: Select all

<?php
class ControllerEventLanguage extends Controller {
	public function index(&$route, &$args) {
		foreach ($this->language->all() as $key => $value) {
			if (!isset($args[$key])) {
				$args[$key] = $value;
			}
		}
	}	
	....
Triggering event is 'view/checkout/cart/before'. Defined in system/config/catalog.php.

It is supposed to load any missing language variables from the currently loaded language files. Perhaps Daniel had the vision to avoid the many

Code: Select all

$data['...'] = $this->language->get('...')
statements in the controller.

Anyway the bugfix is easy:

Just add the missing

Code: Select all

$data['heading_title'] = $this->language->get('heading_title');
to the catalog/controller/checkout/cart.php

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by StormDesigner » Thu Oct 05, 2017 9:20 pm

Thanks for the Fix MHC! Just thought I'd note for others as "newbie" as I (really I'm not that new, just a jack of all trades so I consider myself PHP-intermediate, not at all fluent) When I first "added" the code to the bottom of the document it generated an error on the cart page (line 479). Instead I added

Code: Select all

$data['heading_title'] = $this->language->get('heading_title');
on "line 5" near the beginning of "cart.php" (See JN's post above for other specifics) and now the word "Shopping Cart" Displays where expected (with 0.00 kg displaying also) I don't need the weight displayed for internet downloads but at least people will know they're in the cart.

Thanks again for the great solution.

StormDesigns, Inc. Website Design and Web Application Development - plus graphic design and print media.

www.StormDesigns.com


User avatar
New member

Posts

Joined
Wed Feb 01, 2012 1:53 am

Who is online

Users browsing this forum: paulfeakins and 460 guests