Post by cheeseus » Sun Mar 04, 2018 6:11 pm

I believe this is a bug. If not, please excuse my ignorance and move/delete my post.

I have just completed a translation for OpenCart 3.0.2.0 and found out that in the front-end, in the left-hand-side menu, the menu item "Wish List" contains a variable that is unnecessary and is hence displayed as "%s" instead of being replaced by an actual value. Screenshot of the English version is attached. I haven't been able to locate the string in the translation file to try deleting the variable. This is not the string found in catalog/language/en-gb/account/wishlist.php > row 8 > $_['text_wishlist'] = 'Wish List (%s)';

Attachments

wish_list_var.png

wish_list_var.png (41.33 KiB) Viewed 2559 times


New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Sun Mar 04, 2018 9:51 pm

In catalog/controller/account/account.php file,

find:

Code: Select all

$data['wishlist'] = $this->url->link('account/wishlist');
add above:

Code: Select all

$data['text_wishlist_account'] = sprintf($this->language->get('text_wishlist_account'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
In catalog/language/<your_language>/account/account.php file,

find:

Code: Select all

$_['text_wishlist'] =
add below:

Code: Select all

$_['text_wishlist_account'] = 'Wish List (%s)';
In your catalog/view/theme/<your_theme>/template/account/account.twig file,

replace:

Code: Select all

{{ text_wishlist }}
with:

Code: Select all

{{ text_wishlist_account }}
This should resolved the issue.
Last edited by straightlight on Sun Mar 04, 2018 10:51 pm, edited 2 times in total.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cheeseus » Sun Mar 04, 2018 10:05 pm

Thank you for replying. However, your fix does not solve the problem.
When I add the lines you've written, a different text appears ("Modify your wish list"), which should not be displayed there – I suppose it should be displayed on the Account/Wishlist page or elsewhere.
What should display in the left-hand-side menu is "Wish List" – a plain link that does not contain a variable. I guess the easiest fix would be to find the actual text in the corresponding language file and remove the variable in brackets. But I don't know which language file to look in.
And, equally important – if this is an actual bug, it should be reported and fixed.

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Sun Mar 04, 2018 10:50 pm

My bad. Instructions edited on my previous post.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cheeseus » Sun Mar 04, 2018 11:03 pm

I've done exactly as instructed – the problem persists. Still, the text "Wish List (%s)" is displayed, even if I comment out the line

Code: Select all

$data['wishlist'] = $this->url->link('account/wishlist');

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Sun Mar 04, 2018 11:10 pm

Clear all OC caches from the admin

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cheeseus » Sun Mar 04, 2018 11:15 pm

I couldn't find a menu (item) to delete cache in the Admin. However, I deleted everything but the "index.html" file in the "storage" folder, which should be the equivalent.
No change.

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Sun Mar 04, 2018 11:17 pm

Not good enough. There are many topics on the forum that properly explains how to clear the OC cache. Admin - > dashboard - > blue icon on the right and admin - > extensions - > modifications - > refresh button.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cheeseus » Sun Mar 04, 2018 11:41 pm

I actually did do admin > extensions > modifications > refresh – but nothing changed, so I thought this only applies to modifications. Now I did it again.
Then I also cleared the cache via Dashboard > gear button to the right.
Still get the same "Wish List (%s)".

So, I have solved the problem as follows:

1. In catalog\controller\account\account.php, just above the line:

Code: Select all

$data['wishlist'] = $this->url->link('account/wishlist');
I've added:

Code: Select all

$data['text_wishlist'] = $this->language->get('text_wishlist_account');
2. As advised, I've added a new translation string in catalog\language\en-gb\account\account.php and in my language:

Code: Select all

$_['text_wishlist_account'] = 'Wish List';
3. I preferred to not modify the template file, so I've left it as it was:

Code: Select all

<li><a href="{{ wishlist }}">{{ text_wishlist }}</a></li>
Now, while these edits do solve the problem, they are a temporary solution that will only last until an update rolls out.

The questions that remain unanswered are:
1. What is the text that's actually supposed to show in this menu group? Is it "Wish List", or "Wish List (%s)", or "Modify your wish list". I have not found the last of these three strings used anywhere on the front-end.
2. If this is an actual bug, isn't it too simple and obvious to miss? If a bug, should I report in in GitHub?

While examining the translations, I've also found out that there are other unused strings in catalog\language\en-gb\account\account.php, e.g.

Code: Select all

$_['text_newsletter']     = 'Subscribe / unsubscribe to newsletter';
$_['text_edit']           = 'Edit your account information';
$_['text_address']        = 'Modify your address book entries';
and others.

Overall, comparing the two files (catalog\controller\account\account.php) from 3.0.2.0 and 2.0.3.1, there are 14 lines that get the translations that are not present in this new version (3.0.2.0)... This looks like a huge omission to me.

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by cyclops12 » Mon Mar 05, 2018 12:13 am

Well this is what i have in a default 3.0.2.0 when logging into my account

Attachments

MyAccount.JPG

MyAccount.JPG (31.25 KiB) Viewed 2466 times


Active Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by cheeseus » Mon Mar 05, 2018 12:21 am

Weird because I didn't have this – and I haven't touched the files. I will simply reinstall OpenCart – it's on my local WAMP server, and I've only installed it to do the translations.

These are the texts that make sense having, though. With some editing... "Your Reward points", "Your Transactions", "Downloads" should read something like "Check your reward points", "View your transactions", "View your downloads", etc. to be in the same format as the rest. Of course, it sounds awkward to have a menu group "My account" and included in it "Edit your account information"...

There are so many issues with the English texts, I can't believe no one has had a competent look as them...

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by cyclops12 » Mon Mar 05, 2018 12:27 am

Well i suppose these are just generic texts that can be easily changed in the language file to read whatever suits you best.
As for the Edit your account information..... you will need this to change your email, phone number etc

So obviously just a minor mishap on your translations causing this
BTW are you using a 'language pack' for the translations or are you editing them manually ?

Active Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by cheeseus » Mon Mar 05, 2018 1:31 am

cyclops12 wrote:
Mon Mar 05, 2018 12:27 am
Well i suppose these are just generic texts that can be easily changed in the language file to read whatever suits you best.
True that. But the problem is there isn't a consistent approach to the English texts. There are so many errors in the files.
cyclops12 wrote:
Mon Mar 05, 2018 12:27 am
As for the Edit your account information..... you will need this to change your email, phone number etc
Of course, it just sounds awkward to have "My Account" above it. If the developers decide to keep "My Account", the links below this should be stripped of the possessive pronouns, e.g. "Edit account information". Alternatively, the heading should be "Account" and the links below can keep the "your" pronouns.
cyclops12 wrote:
Mon Mar 05, 2018 12:27 am
So obviously just a minor mishap on your translations causing this
BTW are you using a 'language pack' for the translations or are you editing them manually ?
If I understand your question correctly, I've created a new folder in ...\language\, gave it the correct name, and pasted the English files in it, then translated them. When translating for 2.0.3.1, I actually worked using a rich text editor (EditPlus), but now I created a project in Crowdin, so that I could reuse repeating strings already stored in the TM. Actually, it's working in Crowdin that made the numerous inconsistencies and mistakes obvious.

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Mon Mar 05, 2018 6:15 am

cheeseus wrote:
Sun Mar 04, 2018 11:41 pm
I actually did do admin > extensions > modifications > refresh – but nothing changed, so I thought this only applies to modifications. Now I did it again.
Then I also cleared the cache via Dashboard > gear button to the right.
Still get the same "Wish List (%s)".

So, I have solved the problem as follows:

1. In catalog\controller\account\account.php, just above the line:

Code: Select all

$data['wishlist'] = $this->url->link('account/wishlist');
I've added:

Code: Select all

$data['text_wishlist'] = $this->language->get('text_wishlist_account');
2. As advised, I've added a new translation string in catalog\language\en-gb\account\account.php and in my language:

Code: Select all

$_['text_wishlist_account'] = 'Wish List';
3. I preferred to not modify the template file, so I've left it as it was:

Code: Select all

<li><a href="{{ wishlist }}">{{ text_wishlist }}</a></li>
Now, while these edits do solve the problem, they are a temporary solution that will only last until an update rolls out.

The questions that remain unanswered are:
1. What is the text that's actually supposed to show in this menu group? Is it "Wish List", or "Wish List (%s)", or "Modify your wish list". I have not found the last of these three strings used anywhere on the front-end.
2. If this is an actual bug, isn't it too simple and obvious to miss? If a bug, should I report in in GitHub?

While examining the translations, I've also found out that there are other unused strings in catalog\language\en-gb\account\account.php, e.g.

Code: Select all

$_['text_newsletter']     = 'Subscribe / unsubscribe to newsletter';
$_['text_edit']           = 'Edit your account information';
$_['text_address']        = 'Modify your address book entries';
and others.

Overall, comparing the two files (catalog\controller\account\account.php) from 3.0.2.0 and 2.0.3.1, there are 14 lines that get the translations that are not present in this new version (3.0.2.0)... This looks like a huge omission to me.
Where was that advised on my behalf after I did mentioned the codes were modified afterwards ... ?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cheeseus » Mon Mar 05, 2018 7:01 am

straightlight wrote:
Mon Mar 05, 2018 6:15 am
Where was that advised on my behalf after I did mentioned the codes were modified afterwards ... ?
I'm not sure I understand your question. Please paraphrase.

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Mon Mar 05, 2018 8:29 am

Your steps above are not the instructions I provided on the above ...

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cheeseus » Mon Mar 05, 2018 3:33 pm

straightlight wrote:
Mon Mar 05, 2018 8:29 am
Your steps above are not the instructions I provided on the above ...
Yes, they are not the exact steps. I have simplified them.
Instead of adding your code to catalog\controller\account\account.php, which was supposed to show the number of items in the wish list, if any – but didn't work – I've added the same code as found in 2.0.3.1 that gets the language string. Then, I've added a new language string ('text_wishlist_account') as per your suggestion but with a different content – again because the %s variable didn't work and because I find it pointless to include in that menu, even if it had worked. You said the language string should be added only to my language, but that is not a good idea as the site is bilingual – having the same string in both languages is required to avoid issues, which is why I also added it to the English language file. And then, not wanting to also edit the template file, I simply assign the 'text_wishlist_account' language string to the 'text_wishlist' variable – not best practice, I know, but this is just a test, waiting for the new build to roll out.

Meanwhile, I've had a look at the code in the new beta build (3.0.3.0b) – the code has been slightly modified but I need to install it to see if it solves the problem:

Code: Select all

$data['wishlist'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language'));
This is a shorter way of writing what was in v. 2.x:

Code: Select all

$data['text_wishlist'] = $this->language->get('text_wishlist');
 ...
 $data['wishlist'] = $this->url->link('account/wishlist');

New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by cheeseus » Mon Mar 05, 2018 4:21 pm

Just made a clean install of v.3.0.3.0b and the Account menu looks as it's supposed to be.

I had to delete this installation, however, because the Admin is buggy. So, cleaned everything – files and database – and reinstalled 3.0.2.0... and the Account menu looks the way it should not, screenshot attached.

Attachments

account_menu_3.0.2.0.png

account_menu_3.0.2.0.png (18.35 KiB) Viewed 2380 times


New member

Posts

Joined
Sat Apr 18, 2015 3:59 am

Post by straightlight » Mon Mar 05, 2018 7:59 pm

OC 3.0.3.0b has a new switch case for languages inside the $this->url->link method to keep the SEOs on track based on language preferences.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by LordThanatos » Sat Mar 24, 2018 5:35 pm

cheeseus wrote:
Sun Mar 04, 2018 11:41 pm
So, I have solved the problem as follows:
Ah, thanks cheeseus. Quick and 'dirty' solution. And, personally, I don't mind editing these files again after a new update rolls out...

OpenCart 3.0.2.0. in English & Dutch
Extensions: Inverted Dark Opencart Theme // Dependent Options // PDF Invoice Pro // (2.x/3.x) New Returns E-mail // iSenseLabs GDPR // (2.x/3.x) Total-Based Shipping // PostNL Wereld OC3.x


User avatar
Newbie

Posts

Joined
Sun Feb 18, 2018 5:54 am
Who is online

Users browsing this forum: No registered users and 6 guests