no

How to Fix Magento Email to a Friend Not Working

After we have successfuly setup our magento store, we've been testing its functionality and found out that email to a friend is not work...

After we have successfuly setup our magento store, we've been testing its functionality and found out that email to a friend is not working properly. The product link and image are missing. What we did: 1.) After checking the controller for sendfriend, I've found out that the variables used in the email template are initialize here: app/code/core/Mage/Sendfriend/Model/Sendfriend.php (about line: 85), check if it's like this:
array(
 'name'          => $this->_names[$key],
    'email'         => $email,
    'product_name'  => $this->_product->getName(),
    'product_url'   => $this->_product->getProductUrl(),
    'message'       => $message,
    'sender_name'   => strip_tags($this->_sender['name']),
    'sender_email'  => strip_tags($this->_sender['email']),    
 //resize    
 'product_image' => Mage::helper('catalog/image')->init($this->_product, 'small_image')->resize(250), 
)
Then check the email to a friend template and compare to this:
Welcome, {{htmlescape var=$name}}<br /><br />Please look at <a href="{{var product_url()}}">{{var product_name}}</a><br /><br />Message: <br />{{var message}}<br /><br /> <img src="{{var product_image}}" />
Take note of the variables used: like product_name, product_url and product_image. Each must be initialized properly. Now, in our case even after making sure that the two files are updated, still email doesn't show the product link and image. Looking at the model I found out that the magento system queries the template from the database. So you need to update the template from there: Table: core_email_template; template_code: Send product to a friend, with template_text:
Welcome, {{var name}}<br /><br />Please look at <a href="{{var product.getProductUrl()}}">{{var product.name}}</a><br /><br />Here is message: <br />{{var message}}<br /><br />
Now update the variables, product.getProductUrl(), etc. Refer to the variable we have defined above.

Related

web 805907272289944011

Post a Comment Default Comments

1 comment

Konstantinfo Blogs said...
This comment has been removed by the author.
item