View Single Post
  #4  
Old 09-20-2012, 10:38 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Customize invoice based on product purchased

I am a little crunched for time so I am going to try and guide you through without testing what I am telling you, if it doesn't work, don't despair, just let me know. All of this is pseudo code.

First look at: /common_files/customer/main/order_message.tpl

Look for: {foreach from=$orders item=order}

Right under this is the included invoice template {include file="mail/html/order_invoice.tpl"...

We want to switch between templates so setup an if statement:
PHP Code:
{if $some_var eq 1}
  {include 
file="mail/html/special_invoice.tpl"...
{else}
  {include 
file="mail/html/order_invoice.tpl"...
{/if} 

Above that we need to test for the product, right after the foreach statement that loops through the orders, start another one and check for the product id. if it is found assign the $some_var we referenced in our if statement:
PHP Code:
{assign var="some_var" value=0}
{foreach 
from=$order.products item=product}
  {if 
$product.productid eq 23}
   {
assign var="some_var" value=1}
  {/if}
{/foreach} 

Make sense?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote