X-Cart Product Images on X-Cart Invoices and Order Confirmation Emails
Thursday, April 24, 2008
Recently we received a request for product images to appear on x-cart order invoices as well as in the x-cart order confirmation emails. As this is not a default x-cart feature, I had to wonder why. I hit the x-cart forums to see what if anything had been done, and found a four-year-old topic with no resolution. Hmm. I grabbed my 10pm cup of coffee and started code digging.
I quickly found that the thmb_url x-cart variable was not passed to the x-cart order confirmation page so any image displayed would use a dynamic php link, which would then not appear in the order confirmation email. The last thing I wanted to do was add another foreach loop to x-cart, so I added the existing "func_translate_products" function and created a solution as follows:
Open include/func/func.order.php
FIND:
$products[$k] = func_array_merge($products[$k], preg_grep("/\S/S", $local));
AFTER ADD:
// WCM - Invoice Images
$products[$k]['tmbn_url'] = func_get_image_url($pid, "T");
Open skin1/mail/html/order_data.tpl
<td><font style="FONT-SIZE: 11px">{$product.product}</font>
AFTER ADD:
{* WCM - Invoice Images *}
{if $product.tmbn_url ne ""}
<br />
{include file="product_thumbnail.tpl" full_url=Y productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="T"}
<br />
{/if}
{* / WCM - Invoice Images *}