Sunday, 6 April 2014

Magento AW Followupemail extension : Show multiple products in email template.

As I discussed in my previous post, due to well-written documentation it was very easy to integrate AW Followupemail extension. I implemented the basic functionality using newsletter templates and it is working very fine. But, there was a confusion in Product Review follow-up email, in case there will be having more than one products in cart. I mean to say I have to loop through the cart items. Let’s do it.

1) Go to Admin Section -> Newsletter->Newsletter Templates

2) Create a Newsletter template with name ‘AW Product Feedback’ and copy following code in Template Content section.

<h1>Dear {{var customer_name}}!</h1>

<p> You have bought these products on {{var order.updated_at|formatDateTime:F j, Y}}</p>

<p>The order contains the following items:</p>

<table border="1" cellspacing="1" cellpadding="5" width="100%">
            <th>No</th> <th>Product</th> <th>Image</th> <th>Leave a Review</th>
        {{foreach var="$order.getAllVisibleItems()" template="nsltr:AW Review Product Row"}}       

<p>Thanks !</p>
<p><a href="{{store url=""}}">{{store url=""}}</a></p>

3) Create another Newsletter template with name ‘AW Review Product Row’ and copy following code in Template Content section.

                 <td>{{var row_item_row_number}}</td>
                  <td><a href="{{store url="catalog/product/view" 
                  <td align="center"><img src="{{thumbnail size="75" 
                   <td align="center"><a href="{{store url="review/product/list" 
                  id="$"}}">Leave a Review</a></td>


That’s it and in follow-up email it will show all the products which were there in the ordered cart. While implementing this please keep in mind following points as well.

Important :
1) Newsletter Templates must be of ‘text’ type not ‘html’ type.

2) In first template we have mentioned following line : template="nsltr:AW Review Product Row"

nsltr : means template will be of newsletter type.
 AW Review Product Row : is name of the other template.

If you need any other help regarding this topic please feel free to comment.

Thanks!!!!!!!! Enjoy Programming :)

Saturday, 5 April 2014

Magento : AW Followupemail extension

In e-commerce world, due to lot of competition, it has become compulsory to interact with your customers on regular basis. Follow Up Email is a powerful auto-responder and customer relationship tool that helps to keep your site in the customer's mind always. 

For example you want to send an automated email to customer :

1) For 10% discount on his/her birthday.
2) Product reviews after order is complete.
3) Send an offer in case of abandoned cart.
4) Delay in shipping due to bad weather etc…

You can read more about this extension from here.

Recently, I have integrated this extension in one of my project. Due to well written documentation it has become very easy to implement it and would like to recommend it as well.

Thanks!!!!!!!!!! Enjoy Programming :)

Sunday, 30 March 2014

window.onbeforeunload ajax request problem

From last few hours I was facing a problem with window.onbeforeunload. My need was to save form data(partial saving) by ajax, in case user opts to close the browser, reload the window or close the window. I was using following code :

//Old Code
window.onbeforeunload = function () {
  return msg;

It was saving my content but the return statement was showing me a confirmation message with options ‘Leave Page’ and ‘Stay on Page’. It was so embarrassing. Without return statement it was not saving my data at all.

After spending lot of time on internet and brainstorming a little found the following solution:

//New Code

$(window).bind('beforeunload', function () {
                //this will work only for Chrome

$(window).bind("unload", function () {
 //this will work for other browsers

It worked like a charm for me. Hopefully it will help someone else as well on internet.

Thanks!!!!! Enjoy Programming :)

Sunday, 23 March 2014

Magento : Add “Subscribe to Newsletter” checkbox on Contact Form

To add "Subscribe to Newsletter" checkbox on Contact form, follow following steps: 

1) Go to contacts/form.phtml file of your selected theme.

2) Place following code in the file as per your requirement :
    <input type="checkbox" name="subscribe_newsletter"><?php echo    
     Mage::helper('contacts')->__(' Subscribe to Newsletter ') ?>

3) Now go to \app\code\core\Mage\Contacts\controllers\IndexController.php file 
    and put following code in postAction() function :

/*Start of code*/


                        $email = $_POST['email'];
                        $status = Mage::getModel('newsletter/subscriber')->subscribe($email);
                        if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
Mage::getSingleton('customer/session') ->addSuccess($this->__('Confirmation request has been sent.'));
Mage::getSingleton('customer/session') ->addSuccess($this->__('Thank you for your newsletter subscription.'));

       /*End of code*/

That’s it and you are done. Hopefully it will help you guys as well.

Thanks!!!!!!!! Enjoy Programming J


Sunday, 16 March 2014

Magento 1.7 not showing Google Analytics code in application.

Recently, faced an issue with Google Analytics code implementation in Magento version 1.7. Done with all the settings to implement Google Analytics, still it was not showing Google Analytics code in my Magento application.

Searched a little and came up with following solution.

Go to \app\design\frontend\default\mytheme\layout\googleanalytics.xml file :

<reference name="after_body_start">
        <block type="googleanalytics/ga" name="google_analytics" as="google_analytics" />

Code Block 

<reference name="after_body_start">
        <block type="googleanalytics/ga" name="google_analytics" as="google_analytics" 
            template="googleanalytics/ga.phtml" />

Above code worked for me. Hopefully it will work for others as well.

Thanks!!!!!!!!! Enjoy Programming :)