Page 1 of 1

text_empty issue [solved]

Posted: Thu Dec 21, 2017 9:52 pm
by virtualgadjo
Hi all,

first message for me here so, glad to meet you :)

i'm running into a funny little issue, when i click on en empty category or run a search with no result, it's always the language/common/cart.php text_empty string that is displayed instead of the product/category.php or the search.php one
in order to be sure i've replaced the original string by a personal one i can't miss

if any of you had an idea that would help solve this, i would be lifelong grateful :)
all the best
chris

Re: text_empty issue

Posted: Thu Dec 21, 2017 11:38 pm
by straightlight
Since it is your first post, it is understandable. Although, you need to post your 4 decimals OC version when creating a new post. In this case, the steps you did in order to obtain the text_empty results would be needed as well as the route location (?route=xxxxx) on your platform to provide an accurate solution.

Re: text_empty issue

Posted: Fri Dec 22, 2017 12:38 am
by virtualgadjo
Hi straightlight,

thanks a lot for your answer and, you know, as soon as i clicked on submit, i slapped my head and was waiting for my post to appear to add "sorry guys, forgot to say, using the very last opencart release (3.0.2.0)"

i talked a little with the great guys behind journal2 to see if they had any insight about this but having investigated a bit they ended thinking like i was that it must be an opencart issue

the website is currently local and i use extensively url_rewriting but i could easily reproduce the problem with, for example
route=product/manufacturer/info&manufacturer_id=8 (no products for this manufacturer)
or
route=product/search&search=toto&description=true (of course, no result for toto in the search field)
same for
guitares-acoustiques/guitares-acoustiques-occasions for example with url rewriting which routes to category_id=67 that has no products (yet :))

actually whichever page that has no product in it displays the cart.php text_epty string instead of the category/search/ and so on text_empty one, funny isn't it? :)

thanks again for your time and answer
all the best
chris

Re: text_empty issue

Posted: Fri Dec 22, 2017 12:43 am
by straightlight
actually whichever page that has no product in it displays the cart.php text_epty string instead of the category/search/ and so on text_empty one, funny isn't it?
As funny as trying this already working solution here: viewtopic.php?f=202&t=187159&p=704301#p704140

Re: text_empty issue

Posted: Fri Dec 22, 2017 1:00 am
by virtualgadjo
Hi again,

and now to say that those great guys i talked about above that are behind journal2 theme found out the solution, it's an opencart little issue
in case it helps anybody else, solved by adding

Code: Select all

$data['text_empty'] = $this->language->get('text_empty');
before

Code: Select all

$data['breadcrumbs'] = array();
in the catalog/product/controller/category.php, search.php, special.php and manufacturers controllers (refreshing opencart modification afterwards)

have a great day and thanks again for having taken time to answer :)
all the best
chris

Re: text_empty issue [solved]

Posted: Wed Apr 04, 2018 8:33 pm
by webs_bd
v 3.0.2.0.
Successfully sorted this in search.php with the above fix.
I carried out this fix in 'catalog/controller/account/order.php' and successful here also.
However can't seem to fix in catalog/controller/account/address.php' - this file seems a little different and can't find the right place for the extra code. Can anyone help here please? Currently if there are no customer addresses I get the 'Your Shopping Cart is empty!' message.

Re: text_empty issue [solved]

Posted: Thu Apr 05, 2018 2:01 am
by dpanderson
Same problem for me webs_bd, in multiple locations. I see the text_empty is not getting loaded, but have not successfully figured out where to load it at, or it is getting overwritten by a later called module. 3.0.2.0 with no modifications.

Re: text_empty issue [solved]

Posted: Thu Apr 05, 2018 2:03 am
by straightlight
dpanderson wrote:
Thu Apr 05, 2018 2:01 am
Same problem for me webs_bd, in multiple locations. I see the text_empty is not getting loaded, but have not successfully figured out where to load it at, or it is getting overwritten by a later called module. 3.0.2.0 with no modifications.
When viewing the admin pages, do you see the English text or the defined keys such as text_empty?

Re: text_empty issue [solved]

Posted: Thu Apr 05, 2018 3:08 am
by dpanderson
The issue is on several catalog pages, it's the "shopping cart is empty" issue that has several forum posts running right now. Easiest way I have found to reproduce it is to register for a customer account, then go to "Wish List" when the wish list is empty.

Re: text_empty issue [solved]

Posted: Wed Aug 01, 2018 3:01 am
by leeburgess
same issue here. any fix?

Re: text_empty issue [solved]

Posted: Sat Aug 04, 2018 2:42 am
by HSLGuy
edited to remove the code to fix issue with page titles. That is a separate issue and a simpler fix was provided by Journal theme support.

Thanks everyone for the code to fix this. There were still some other pages where I needed a fix, like recurring payments and address book, which needed the code in a different location. With some trial & error, I was able to find a location to insert the code given above on everything I could find that needed fixing. I'll compile all of my changes here:


Insert this code in all locations below:

Code: Select all

$data['text_empty'] = $this->language->get('text_empty');
In:
catalog/controller/account/download.php
catalog/controller/account/order.php (find first occurance of code only)
catalog/controller/account/reward.php
catalog/controller/account/transaction.php
catalog/controller/account/wishlist.php
catalog/controller/product/category.php
catalog/controller/product/compare.php
catalog/controller/product/manufacturer.php (find first occurance of code only)
catalog/controller/product/search.php
catalog/controller/product/special.php


BEFORE:

Code: Select all

$data['breadcrumbs'] = array();
===========================================

In:
catalog/controller/account/address.php

BEFORE

Code: Select all

$data['addresses'] = array();
===========================================

In:
catalog/controller/account/recurring.php

AFTER

Code: Select all

$this->document->setTitle($this->language->get('heading_title'));
===========================================

In:
catalog/controller/account/return.php

AFTER 1ST OCCURANCE (index function) OF

Code: Select all

$this->document->setTitle($this->language->get('heading_title'));
===========================================

In:
catalog/controller/information/contact.php

BEFORE:

Code: Select all

$data['continue'] = $this->url->link('common/home');

Don't forget to refresh the cache after making these changes.

That's all I've found,
Please mention any errors or other files that need fixing

Re: text_empty issue [solved]

Posted: Mon Apr 29, 2019 11:45 am
by devth
This problem is caused by this line in every page.

Code: Select all

$data['header'] = $this->load->controller('common/header');
It will load controller/common/cart.php that will load its language file by this line.

Code: Select all

$this->load->language('common/cart');
So, text_empty in every page will be replaced by controller/common/cart.php.
For me, I fix it by change "text_empty" to "text_empty_cart" in these files.

common/cart.twig
language/en-gb/common/cart.php

Re: text_empty issue [solved]

Posted: Mon Apr 29, 2019 7:25 pm
by straightlight
devth wrote:
Mon Apr 29, 2019 11:45 am
This problem is caused by this line in every page.

Code: Select all

$data['header'] = $this->load->controller('common/header');
It will load controller/common/cart.php that will load its language file by this line.

Code: Select all

$this->load->language('common/cart');
So, text_empty in every page will be replaced by controller/common/cart.php.
For me, I fix it by change "text_empty" to "text_empty_cart" in these files.

common/cart.twig
language/en-gb/common/cart.php
Ahh ! yes, as explained to Daniel regarding the conflicted array keys on Github. :bang:

Re: text_empty issue [solved]

Posted: Mon Sep 23, 2019 6:41 pm
by Mr.Pikatchu
Someone on Github named PlusA2M found a much simpler solution . Go to system/config/catalog.php and change:

This:
'controller/*/after' => array(
'event/debug/after'
)
To this:
//'controller/*/after' => array(
// 'event/debug/after'
// )