[SOLVED] Magento 1.9 BUG FIX Cron email alerts sent in wrong language

I found a Magento bug which makes cron (price, stock) alerts emails being in the wrong language.

Issue

I have configured price alerts for a client (which originally registered into my shop with spanish language).

The user receives the email, but it is in english.

For instance, the text: “You are receiving this notification because you subscribed to receive alerts when the prices for the following products changed:” (in ./app/design/frontend/base/default/template/email/productalert/price.phtml) is not being translated to spanish.

I have checked and the translation is present in ./app/locale/es_ES/Mage_ProductAlert.csv: “You are receiving this notification because you subscribed to receive alerts when the prices for the following products changed:”,”Usted está recibiendo esta notificación porque está suscrito para recibir alertas cuando los precios de los siguientes productos cambien:”

I am using a custom theme.

I have also tried to add that translation to my theme: app/design/frontend/mytheme/default/locale/es_ES/translate.csv

I have flushed translations cache and deleted Magento cache. Still not being translated.

Fix

What I did to fix the issue:

Edit app/code/core/Mage/ProductAlert/Model/Email.php

Replace this (line 255):

       $appEmulation = Mage::getSingleton('core/app_emulation');
       $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);

With this:

        $appEmulation = Mage::getSingleton('core/app_emulation');
        $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
        //Dealing with uninitialized translator!
        Mage::app()->getTranslator()->init('frontend', true);

Flushed the cache and voila! Now magento is sending the email alerts in the right language 🙂

vBulletin: Invalid Security Token [SOLVED]

Problem: After upgrading to vBulletin 3.8.5, I am getting this Invalid Security Token errors on the Mark Forums as read tool.

This fix is quite easy:

1. In your forumhome template, find:

<a href="forumdisplay.php?$session[sessionurl]do=markread rel="nofollow">$vbphrase[mark_forums_read]</a>

And replace with:

<a href="forumdisplay.php?$session[sessionurl]do=markread&amp;markreadhash=$bbuserinfo[securitytoken]" rel="nofollow">$vbphrase[mark_forums_read]</a>

2. In your navbar template (twice), find:

<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread" rel="nofollow">$vbphrase[mark_forums_read]</a></td>

And replace with:

<a href="forumdisplay.php?$session[sessionurl]do=markread&amp;markreadhash=$bbuserinfo[securitytoken]" rel="nofollow">$vbphrase[mark_forums_read]</a>

If your search for those strings does not return any result, do the same search without rel=”nofollow”. This is:

FORUMHOME:

<a href="forumdisplay.php?$session[sessionurl]do=markread>$vbphrase[mark_forums_read]</a>

NAVBAR:

<td class="vbmenu_control"><a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a></td>

CDS Invenio: Webaccess admin lib bug-fix

Some days ago I found a bug in webaccess, more precisely when dealing with roles and authorizations which involve special characters.

The bug

Lets suppose I want to restrict the execution of bibedit to role named ‘EditoresTAZ’ (existing role in my repository).

I go to http://my.repository.url/admin/webaccess/webaccessadmin.py/addauthorization
Then select role=’EditoresTAZ’, action=’runbibedit’ and check “connect editoresTAZ to runbibedit for only these argument cases: “.

When I enter a word with accents (i.e. “Trabajos académicos”, the ‘primary collection of a record’ and confirm the creation of the new authorization, there is some issue with accents. If I later check the recently created authorization the stored value for parameter collection is “Trabajos acadmicos” instead of “Trabajos académicos”. I guess this is due to some input character escaping.

The dirty fix

I have checked the accARGUMENT table in database and changed the value to ‘Trabajos académicos’ and the authorizations work fine.

The cool patch

The guys from CDS Support Team have already fixed things and the patch is in their GIT!

Take a look: cds-invenio GIT.

Diffstat (limited to 'modules/webaccess/lib/webaccessadmin_lib.py') (more/less context) (ignore whitespace changes)
-rw-r--r--	modules/webaccess/lib/webaccessadmin_lib.py	6	
 
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/webaccess/lib/webaccessadmin_lib.py b/modules/webaccess/lib/webaccessadmin_lib.py
index ba8d77c..1dde940 100644
--- a/modules/webaccess/lib/webaccessadmin_lib.py
+++ b/modules/webaccess/lib/webaccessadmin_lib.py
@@ -2638,8 +2638,8 @@ def perform_addauthorization(req, id_role="0", id_action="0", optional=0, revers
for key in res_keys:
output += '<span class="adminlabel" style="margin-left: 30px;">%s </span>\n <input class="admin_wvar" type="text" name="%s"' % (key, key)
try:
- val = keywords[key] = cleanstring_argumentvalue(keywords[key])
- if val: output += 'value="%s" ' % (val, )
+ val = keywords[key] # = cleanstring_argumentvalue(keywords[key])
+ if val: output += 'value="%s" ' % (escape(val, True), )
else: allkeys = 0
except KeyError: allkeys = 0
output += ' /> <br />\n'
@@ -2662,7 +2662,7 @@ def perform_addauthorization(req, id_role="0", id_action="0", optional=0, revers
keywords = {}
else:
for key in keys:
- text += '<strong>%s</strong>: %s \n' % (key, keywords[key])
+ text += '<strong>%s</strong>: %s \n' % (escape(key), escape(keywords[key]))
output += createhiddenform(action="addauthorization",
text=text,

Working like a charm now 🙂