Question

I have added translation in my locale folders and even loaded templates and assigned them in system config. Nothing seems to translate this email. When i look in the table product_alert_stock i also see only the website is saved, but my locales are different on storeview level.

So when i go to my french storeview and click the link to subscribe, put the product back in stock and run the catalog_product_alert cron, i keep getting the english mail.

Any ideas on what might went wrong or if it is a bug?

Was it helpful?

Solution

The TD;DR: I would classify it as a bug.

A bit of background:

The store for the product alerts always is determined as follows in Mage_ProductAlert_Model_Email::send():

....
    $store      = $this->_website->getDefaultStore();
    $storeId    = $store->getId();
....
    $templateId = Mage::getStoreConfig($templateConfigPath, $storeId);
....
    Mage::getModel('core/email_template')
        ->setDesignConfig(array(
            'area'  => 'frontend',
            'store' => $storeId
        ))->sendTransactional(...)

The so it always uses the default store of the specified website. The website in turn is set during the subscription. That is when a customer subscribes to notifications the current website ID is stored with the subscription record:

    $model  = Mage::getModel('productalert/price')
        ->setCustomerId(Mage::getSingleton('customer/session')->getId())
        ->setProductId($product->getId())
        ->setPrice($product->getFinalPrice())
        ->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
    $model->save();

So even if the customer has registered in, lets say, the french store view, and has subscribed to the notifications in the french store view, if the default store for the website happens to be the english store view, that specifies which template will be used.

To fix the behavior, rewrite Mage_ProductAlert_Model_Email::send() and use the customers store_id instead (for example).

OTHER TIPS

I don't know what might go wrong, but I would start debugging as follows:

Check if you're 100% sure you're editing the right template. Try to edit the English one you're getting, and check if the e-mail reflects your changes. If not, bingo, find the right one.

If it does: try if other store variables are correctly inserted in the email, like store url:

<a href="{{store url=""}}">Store URL</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top