Magento Email to a friend not working, even after updating product_share.html
Tech-Today

Magento Email to a friend not working, even after updating product_share.html


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.




-
Send Email using MFMailComposer (Template)1.) Import MessageUI      import MessageUI 2.) Show Email func showMail() { let mailComposeViewController = configuredMailComposeViewController() if MFMailComposeViewController.canSendMail()...

- How To Create A Custom Bean Validation In Javaee6
Bean validation has been mentioned on many articles online but I found few that explain the actual class that implements the constraint validator. For example: the bean validation article from  oracle javaee6 documentation: http://docs.oracle.com/javaee/6/tutorial/doc/gkfgx.html....

- Mssql How To Update A Column Base On A Row Number
Just recently I was asked to normalized or divide a table into 2 tables. Unfortunately, the only column that linked them (email) allows multiple same values, even aggregate would not do (email, password, etc). This is because there's a field that...

- Magento Export And Import Products With Images
How to Export Magento Products 1.) login to the magento admin 2.) go to System->Import/Export->Profiles 3.) select Export All Products 4.) select Run Profile and on the middle-right click the "Run Profile in Popup", this will open a new tab...

- Codeigniter Attach Html To Email
If you have this kind of error, just check the way you'r calling the email library. Be sure to add this line. $config['mailtype'] = 'html'; $this->email->initialize($config); And it might save you from lots of trouble....



Tech-Today








.