title: Send a product's custom feature in order confirmation email
body: <p>I want to send the "units per box" custom feature in my confirmation mails in prestashop. </p>
  
  <p>Here's an example if what I want to do</p>
  
  <pre><code>$myprod = new Product($product['id_product']);
  $features = $myprod-&gt;getFrontFeatures(1));
  
  foreach(from=$features item=feature)
  {
    if ($feature.name == "Units per box")
    {
       $UnitsPerBox = $feature.value|escape:'htmlall':'UTF-8';
    }
  }
  </code></pre>
  
  <p>However I need to do this within a php file (<code>PaymentModule.php</code>) rather than a tpl file, so that code won't work. 
  If anybody could point me in the right direction of how to achieve this with php it'd be greatly appreciated. </p>
  
  <p>EDIT: </p>
  
  <p>I used the example code provided which seems to get inside the array but doesn't return any values</p>
  
  <p>When I run some test code like this </p>
  
  <pre><code>$myprod = new Product($product['id_product']);
  $features = $myprod-&gt;getFrontFeatures(1);
  $UnitsPerBox .= '100';
  foreach ($features as $feature) 
  {
    $UnitsPerBox .= '200';
    if ($feature-&gt;name == 'Units Per Box') 
    {
      $UnitsPerBox .= htmlentities($feature-&gt;value, 'ENT_QUOTES', 'UTF-8');   
      $UnitsPerBox .= $feature-&gt;name;
    }
    else
    {
      $UnitsPerBox .= $feature-&gt;name;
      $UnitsPerBox .= htmlentities($feature-&gt;name, 'ENT_QUOTES', 'UTF-8');
      $UnitsPerBox .= htmlentities($feature-&gt;value, 'ENT_QUOTES', 'UTF-8');
    }
  }
  </code></pre>
  
  <p>I get this output: "100200200200200200"</p>
  
  <p>Any help would be great, thanks.</p>
  
  <p>Thanks, 
  Andrew</p>
  
  <p><strong>EDIT: Solution</strong></p>
  
  <p>Got it working in the end, thanks for the help </p>
  
  <pre><code>$myprod = new Product($product['id_product']);
  $features = $myprod-&gt;getFrontFeatures(1);
  foreach ($features as $feature) 
  {
  foreach ($feature as $key =&gt; $value) 
  {
      if($value == "Units per box")
      {
          $UnitsPerBox = $feature['value'];
      }
  }
  </code></pre>
  
  <p>}</p>