Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento Shipment email and adding survey URL
    primarykey
    data
    text
    <p>I'm trying to add a custom survey URL at the top and bottom of the email template.</p> <p>I'm using a very basic/stock template from magento. I have developed two templates to help with generating the URL:</p> <p>surveyurl.phtml - contains some logic to generate a URL</p> <pre><code>$surveys = array("somesurvey.com/1", "somesurvey.com/2"); $pick_survey_key = array_rand($surveys); $url = $surveys[$pick_survey_key]; if($_order){ $survey_url = $url ."?order=". $_order-&gt;getIncrementId(); } if ($coupon_code){ $survey_url .= "&amp;code=". $coupon_code; } echo $survey_url; </code></pre> <p>survey.phtml - contains the html that shows up in the footer of the email.</p> <pre><code>&lt;?php $_shipment=$this-&gt;getShipment() ?&gt; &lt;?php $_order=$this-&gt;getOrder() ?&gt; &lt;?php $coupon_code = $_order-&gt;getCouponCode(); ?&gt; &lt;?php if($_order) { //get $survey_url from surveyurl.phtml } ?&gt; &lt;?php if ($_shipment &amp;&amp; $_order): ?&gt; &lt;table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"&gt;&lt;?php echo $this-&gt;__('Help us by taking a survey!') ?&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php $i=0; foreach ($_shipment-&gt;getAllTracks() as $_item): $i++ ?&gt; &lt;tr &lt;?php echo $i%2?'bgcolor="#F6F6F6"':'' ?&gt;&gt; &lt;td align="center" valign="top" style="padding:3px 9px"&gt; &lt;a href ="&lt;?php echo $survey_url ?&gt;"&gt;Take our survey!&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="padding:3px 9px" colspan="1"&gt; *You will get something cool at the end ;) &lt;/td&gt; &lt;/tr&gt; &lt;?php endforeach ?&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;?php endif; ?&gt; </code></pre> <p>in my local.xml i added:</p> <pre><code>&lt;sales_email_order_surveyurl&gt; &lt;block type="core/template" name="survey_url" template="email/order/shipment/surveyurl.phtml"&gt; &lt;/block&gt; &lt;/sales_email_order_surveyurl&gt; </code></pre> <p>then in my email template i add this to get it at the top:</p> <pre><code>&lt;p&gt;Survey URL: {{layout handle="sales_email_order_surveyurl" order=$order}}&lt;/p&gt; </code></pre> <p>and I add this at the bottom:</p> <pre><code>&lt;td&gt;{{block type='core/template' area='frontend' template='email/order/shipment/survey.phtml' order=$order}}&lt;/td&gt; </code></pre> <p>So my question: how can I pass the url that is generated in surveyurl.phtml into survey.phtml? Or how do I need to set it up differently to do this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload