Totally Zenned
- Join Date:
- Dec 2005
- Location:
- Perth, Western Australia, Australia
- Posts:
- 782
- Plugin Contributions:
- 0
Product images on order confirmation email
Hi,
I am trying to get product images to show on the order confirmation email. However because I don't know much about php, I will need some guidance. I located the code that draws the table of ordered product details in /includes/classes/order.php.
// build output for email notification
$this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
$this->products_ordered_attributes . "\n";
$this->products_ordered_html .=
'<tr>' .
'<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . ' x</td>' .
'<td class="product-details" valign="top">' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') .
'<nobr><small><em> '. $this->products_ordered_attributes .'</em></small></nobr></td>' .
'<td class="product-details-num" valign="top" align="right">' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ?
'</td></tr><tr><td class="product-details">' . TEXT_ONETIME_CHARGES_EMAIL . '</td>' .
'<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
'</td></tr>';
I need to somehow integrate the following code in the above code to show product images on the order confirmation email.
$products = $db->Execute("SELECT products_image
FROM " . TABLE_PRODUCTS . "
WHERE products_id ='" . $order->products[$i]['id'] . "'");
echo '' . zen_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $products->fields['products_image'] , $order->products[$i]['name'], SMALL_IMAGE_HEIGHT, SMALL_IMAGE_WIDTH) . '</a> ';
I am thinking to join them together this way but I am not sure if it will work. Can someone smarter than me please help check? Changes are highlighted in italic and bold. Thanks in advance :)
// build output for email notification
$this->products_ordered .= $this->products[$i]['qty'] . ' x ' [I][B]. zen_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $products->fields['products_image'] , $order->products[$i]['name'], SMALL_IMAGE_HEIGHT, SMALL_IMAGE_WIDTH)[/I][/B] . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
$this->products_ordered_attributes . "\n";
[I][B]$products = $db->Execute("SELECT products_image FROM " . TABLE_PRODUCTS . " WHERE products_id ='" . $order->products[$i]['id'] . "'");[/I][/B]
$this->products_ordered_html .=
'<tr>' .
'<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . ' x</td>' .
[I][B]'<td class="product-details" valign="top">' . zen_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $products->fields['products_image'] , $order->products[$i]['name'], SMALL_IMAGE_HEIGHT, SMALL_IMAGE_WIDTH) .</td>' .[/I][/B]
'<td class="product-details" valign="top">' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') .
'<nobr><small><em> '. $this->products_ordered_attributes .'</em></small></nobr></td>' .
'<td class="product-details-num" valign="top" align="right">' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ?
'</td></tr><tr><td class="product-details">' . TEXT_ONETIME_CHARGES_EMAIL . '</td>' .
'<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
'</td></tr>';