0

I am new to Magento, and my same question on Magento stack exchange didn't get proper response, so I am posting this on the mighty SO now.

Background

I have installed an Abandoned Cart extension in my Magento CE 1.7 store and I have problem configuring the transactional email sent to remind people of their abandoned carts.

Here's how the relevant part of the default email template looks:

<p><strong>Hello {{var customer_name}},</strong></p>
<p>Thank you for stopping by {{var website_name}} and considering us for your purchase. We noticed that during your visit to our store you placed the following item(s) in your shopping cart, but did not complete the transaction.</p>
<p>Shopping Cart Contents: </p>
<p>{{var products}}</p>

{{depend real_quote}}
<!-- <p><a href="{{var recover_url}}" >Recover </a><br> (url:{{var recover_url}})</p> -->
{{/depend}} 

{{depend coupon}}
    <p>Please use this coupon: {{var coupon}} to avail 5% discount on your order value</p>
    <p>Please note that it expires in {{var coupon_days}} day(s)</p>
{{/depend}}

Note the {{var products}} that was used in the email. This thing prints the product details in the email (name, image, link to product etc).

Question

I need to change the product url that gets printed. I have some analytics code to append to these URLs and I can't figure out where this var products is defined to change its behavior.

Things I have tried:

  • tried to print {{var product_name}} and other product variables as defined here, but they all ended up as blank spaces
  • found a good resource that has info about changing these variables, but couldn't figure out how to use that to change this products variable
  • added utm parameters after {{var products}} only to get the utm text after product details table (defined somewhere as products).

I am not even sure if this {{var products}} is an inbuilt variable or something defined by the extension?

EDIT: The products is not a custom variable. Don't know if that would help.

Community
  • 1
  • 1
Bharadwaj Srigiriraju
  • 2,196
  • 4
  • 25
  • 45

1 Answers1

0

Figured this out myself, and wanted to post the answer.

The code that generates the products is in the models of the third-party extension I've installed for sending the cart emails. I have too many extensions installed, and couldn't find this one easily.

I understood that all the extension related code is in app/code/local/<extension-name>/Cartalert. (the Cartalert directory would be named differently depending on the extension). I did this by greping through my repository searching for "Save and Send out" text, which is used in CMS for manually sending these emails.

grep -Ril "Save and Send out" <directory>

This was my reference. Also, if you're dealing with custom emails like me, this would help.

Next I went to the model where these alerts are being generated, which was in app/local/<extension-name>/Cartalert/Model/Cartalert.php

This was the relevant code I had to change.

for ($i=0, $n=sizeof($prod); $i<$n; $i+=2){
            $product = Mage::getModel('catalog/product')
                ->setStoreId($this->getStoreId())
                ->load($prod[$i]);
            if(in_array($product->getStatus(),$status)&&in_array($product->getVisibility(),$visibility)&&$product->isSaleable())
            {
                $url = $baseUrl . 'catalog/product/view/id/'.$prod[$i];
                $name = $prod[$i+1];

I had to append the parameters to the $url string, and it got the job done. Never thought grep would help me more than the docs... :D

Community
  • 1
  • 1
Bharadwaj Srigiriraju
  • 2,196
  • 4
  • 25
  • 45