Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Custom Tracking Notifications Rate Topic   - - - - -

 
  • hptmotor
  • Member
  • Members
  • Join Date: 12-Oct 11
  • 32 posts

Posted 16 February 2014 - 03:38 AM #1

Hey guys,
I'm in the process of modifying the following file:
skins/{your store]/mail/shipments/shipment_products.tpl

I'm using some of the basic coding from the "invoice.tpl" file to create a custom looking tracking notification vs. the "ugly" one that comes with CS Cart by default. I'm currently running version 2.2.3.

I have a good start, except I'm having trouble listing the "item shipped" in a "item_list_row" format. In other words, I want to list each item that has shipped within a nice table.

The only problem is whenever I make a partial shipment.. say 1 out of 4 items have shipped, it will display the 1 item shipped correctly, but it will also create the tables for the other 3 items but just leave them blank. See attached image.

Here's my code for the shipment_products.tpl file:

{* $Id$ *}
<p>{include file="letter_header.tpl"} {$lang.dear} {$order_info.firstname},<br /><br />
{$lang.products_were_sent}
<br>
</p>
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main-table" style="height: 100%; background-color: #f4f6f8; font-size: 12px; font-family: Arial;">
<tr>
<td align="center" style="width: 100%; height: 100%;">
<table cellpadding="0" cellspacing="0" border="0" style=" width: 602px; table-layout: fixed; margin: 24px 0 24px 0;">
<tr>
  <td style="background-color: #ffffff; border: 1px solid #e6e6e6; margin: 0px auto 0px auto; padding: 0px 44px 0px 46px; text-align: left;">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 27px 0px 0px 0px; border-bottom: 1px solid #868686; margin-bottom: 8px;">
   <tr>
	<td align="left" style="padding-bottom: 3px;" valign="middle"><img border="0" alt="" src="image" width="300" height="56"></td>
	<td width="100%" valign="bottom" style="text-align: right;  font: bold 26px Arial; text-transform: uppercase;  margin: 0px;">SHIPMENT
				  Notification</td>
   </tr>
   </table>
   <table cellpadding="0" cellspacing="0" border="0" width="100%">
   <tr valign="top">
	<td style="padding-top: 14px;">
	 <table cellpadding="0" cellspacing="0" border="0" width="100%">
	 <tr valign="top">
	  <td style="color: #000000; padding-right: 10px; white-space: nowrap;"><h2 style="font: bold 17px Tahoma; margin: 0px;">Order&nbsp;#{$order_info.order_id}</h2>
				</td>
	  <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; color: #000000; padding-right: 10px; white-space: nowrap;" rowspan="2">
{hook name="orders:invoice_customer_info"}
   {if !$profile_fields}
   {assign var="profile_fields" value='I'|fn_get_profile_fields}
   {/if}
   {if $profile_fields}
{/if}
	{if $profile_fields.S}
	{assign var="profields_s" value=$profile_fields.S|fn_fields_from_multi_level:"field_name":"field_id"}
				</td>
	  <td style="color: #000000; padding-right: 10px; white-space: nowrap;">
					<h2 style="font: bold 17px Tahoma; margin: 0px;">Ship to:</h2>
				</td>
	 </tr>
	 <tr valign="top">
	  <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; color: #000000; padding-right: 10px; white-space: nowrap;">
<strong>{$lang.shipping_method}</strong>:&nbsp;{$shipment.shipping}<br />
<strong>{$lang.shipment_date}</strong>:&nbsp;{$shipment.timestamp|date_format:"`$settings.Appearance.date_format`"}<br />
{if $shipment.carrier}
{include file="common_templates/carriers.tpl" carrier=$shipment.carrier}
<!-- <strong>{$lang.carrier}</strong>:&nbsp;{$smarty.capture.carrier_name}<br /> -->
{/if}
{if $shipment.tracking_number}
{include file="common_templates/shipment_carriers.tpl" carrier=$shipment.carrier}
				{foreach from=$order_info.shipping item="shipping" name="f_shipp"}<strong><br>
						  Tracking #</strong>:&nbsp;<a class="underlined" {if $smarty.capture.carrier_url|strpos:"://"}target="_blank" href="{$smarty.capture.carrier_url}" {/if}>{$shipment.tracking_number}</a><br />
						  {/foreach}
						  {/if}
				</td>
	  <td style="font-size: 12px; font-family: arial; color: #000000; padding-right: 10px; white-space: nowrap;">
{if $order_info.s_firstname && $profields_s.s_firstname || $order_info.s_lastname &&
$profields_s.s_lastname}
	 <p style="margin: 2px 0px 3px 0px;">
	  {if $profields_s.s_firstname}{$order_info.s_firstname}
						{/if}{if $profields_s.s_lastname}{$order_info.s_lastname}{/if}
	 </p>
	 {/if}
	 {if $order_info.s_address && $profields_s.s_address || $order_info.s_address_2 && $profields_s.s_address_2}
	 <p style="margin: 2px 0px 3px 0px;">
	  {if $profields_s.s_address}{$order_info.s_address} {/if}{if $profields_s.s_address_2}<br />{$order_info.s_address_2}{/if}
	 </p>
	 {/if}
	 {if $order_info.s_city && $profields_s.s_city || $order_info.s_state_descr &&
$profields_s.s_state || $order_info.s_zipcode && $profields_s.s_zipcode}
	 <p style="margin: 2px 0px 3px 0px;">
	  {if $profields_s.s_city}{$order_info.s_city}{if $profields_s.s_state},{/if}
						{/if}{if $profields_s.s_state}{$order_info.s_state_descr}
						{/if}{if $profields_s.s_zipcode}{$order_info.s_zipcode}{/if}
	 </p>
	 {/if}
	 {if $order_info.s_country_descr && $profields_s.s_country}
	 <p style="margin: 2px 0px 3px 0px;">
						{$order_info.s_country_descr}
	 </p>
	 {/if}
	 {if $order_info.s_phone && $profields_s.s_phone}
	 <p style="margin: 2px 0px 3px 0px;">
	  {if $profields_s.s_phone}{$order_info.s_phone} {/if}
	 </p>
	 {/if}
	 {include file="profiles/profiles_extra_fields.tpl"
fields=$profile_fields.S}
					<p>
   {/if}
   {/hook}				</td>
	 </tr>
	 </table>
	</td>
   </tr>
   </table>

   <table width="100%" cellpadding="0" cellspacing="1" style="background-color: #dddddd;">
   <tr>
	<th width="70%" style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;">{$lang.product}</th>
	<th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;">Quantity
				  shipped</th>
   </tr>
			{foreach from=$shipment.items key="hash" item="amount"}
			{hook name="orders:items_list_row"}
	{if !$oi.extra.parent}
	<tr>
	 <td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
  
	{if $amount > 0}
	{$order_info.items.$hash.product}<br />
  {if $order_info.items.$hash.product_options}
   {include file="common_templates/options_info.tpl" product_options=$order_info.items.$hash.product_options}<br />
  {/if}
  <strong>{$lang.code}:</strong>&nbsp;{$order_info.items.$hash.product_code}{/if}
	 </td>
	 <td style="padding: 5px 10px; background-color: #ffffff; text-align: center; font-size: 12px; font-family: Arial;"> {if $amount > 0}{$amount}{/if}
	   </td>
	 </tr>
		{/if}
   {/hook} {/foreach}
   </table>
			<table border="0" width="100%" cellspacing="0" cellpadding="3">
			  <tr>
				<td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
				<br>{if $shipment.comments}
<strong>{$lang.comments}</strong>: {$shipment.comments}
{/if} </td>
			  </tr>
			  <tr>
				<td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;" height="30">
</td>
			  </tr>
			</table>
  </table>
  </td>
</tr>
</table>
{include file="letter_footer.tpl"}

Does anyone know how to modify code for the table so the items list correctly? I think it something fairly easy to fix... I just dont see it.

I need to make an adjustment near the this line (toward the bottom)
{foreach from=$shipment.items key="hash" item="amount"}

Thanks in advance!

Attached Files



 
  • hptmotor
  • Member
  • Members
  • Join Date: 12-Oct 11
  • 32 posts

Posted 16 February 2014 - 03:41 AM #2

--

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11429 posts

Posted 16 February 2014 - 07:49 AM #3

Assuming it needs to be bracketed within an if statement with some condition. It would take some study to advise the actual details, but hopefully you've stared at it long enough that a hint is all you need.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • hptmotor
  • Member
  • Members
  • Join Date: 12-Oct 11
  • 32 posts

Posted 16 February 2014 - 03:56 PM #4

Well here is the block of code that needs adjusting. This is the table that would contain the product information:
<table width="100%" cellpadding="0" cellspacing="1" style="background-color: #dddddd;">
   <tr>
	<th width="70%" style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;">{$lang.product}</th>
	<th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;">Quantity
				  shipped</th>
   </tr>
			{foreach from=$shipment.items key="hash" item="amount"}
			{hook name="orders:items_list_row"}
	{if !$oi.extra.parent}
	<tr>
	 <td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
  
	{if $amount > 0}
	{$order_info.items.$hash.product}<br />
  {if $order_info.items.$hash.product_options}
   {include file="common_templates/options_info.tpl" product_options=$order_info.items.$hash.product_options}<br />
  {/if}
  <strong>{$lang.code}:</strong>&nbsp;{$order_info.items.$hash.product_code}{/if}
	 </td>
	 <td style="padding: 5px 10px; background-color: #ffffff; text-align: center; font-size: 12px; font-family: Arial;"> {if $amount > 0}{$amount}{/if}
	   </td>
	 </tr>
		{/if}
   {/hook} {/foreach}
   </table>
			<table border="0" width="100%" cellspacing="0" cellpadding="3">
			  <tr>
				<td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
				<br>{if $shipment.comments}
<strong>{$lang.comments}</strong>: {$shipment.comments}
{/if} </td>
			  </tr>
			  <tr>
				<td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;" height="30">
</td>
			  </tr>
			</table>
  </table>
  </td>
</tr>
</table>

And if you paste that code into a web program like dreamweaver or frontpage, you get the following. See attached image. This will help show you what I'm trying to acheive. So far it does work and the notifications are sent fine, however, I just can't figure out why it's putting in all rows for products even though they didnt ship yet.

Attached Files



 
  • hptmotor
  • Member
  • Members
  • Join Date: 12-Oct 11
  • 32 posts

Posted 16 February 2014 - 03:59 PM #5

**EDIT** I was able to resolve the issue :) Just a simple code move as I thought. Literally took 1 sec to fix once I found it.

Thanks for anyone who view this.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11429 posts

Posted 16 February 2014 - 08:50 PM #6

So why don't you share what you had to change so others can benefit from your experience?

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • hptmotor
  • Member
  • Members
  • Join Date: 12-Oct 11
  • 32 posts

Posted 17 February 2014 - 02:45 AM #7

So why don't you share what you had to change so others can benefit from your experience?


Sorry, I didn't post my changes becuase it wasn't a "cart issue"... it was just my own personal issue playing around with code to customize my notification file.

Anyway, here's the line of code that I needed to move:
{if $amount > 0}
Shown here originally:
<table width="100%" cellpadding="0" cellspacing="1" style="background-color: #dddddd;">
   <tr>
		<th width="70%" style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;">{$lang.product}</th>
		<th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;">Quantity
								  shipped</th>
   </tr>
						{foreach from=$shipment.items key="hash" item="amount"}
						{hook name="orders:items_list_row"}
		{if !$oi.extra.parent}
		<tr>
		 <td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">

		{if $amount > 0}
{$order_info.items.$hash.product}<br />
  {if $order_info.items.$hash.product_options}
   {include file="common_templates/options_info.tpl" product_options=$order_info.items.$hash.product_options}<br />
  {/if}
  <strong>{$lang.code}:</strong>&nbsp;{$order_info.items.$hash.product_code}{/if}
		 </td>
		 <td style="padding: 5px 10px; background-color: #ffffff; text-align: center; font-size: 12px; font-family: Arial;"> {if $amount > 0}{$amount}{/if}
		   </td>
		 </tr>
				{/if}
   {/hook} {/foreach}
   </table>
						<table border="0" width="100%" cellspacing="0" cellpadding="3">
						  <tr>
								<td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
								<br>{if $shipment.comments}
<strong>{$lang.comments}</strong>: {$shipment.comments}
{/if} </td>
						  </tr>
						  <tr>
								<td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;" height="30">
</td>
						  </tr>
						</table>
  </table>
  </td>
</tr>
</table>

Moved up higher next to:
{foreach from=$shipment.items key="hash" item="amount"}
As shown here:
<table width="100%" cellpadding="0" cellspacing="1" style="background-color: #dddddd;">
   <tr>
	<th width="70%" style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; text-align: center; font-size: 12px; font-family: Arial;">{$lang.product}</th>
	<th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; text-align: center; font-family: Arial;">Quantity
				  shipped</th>
   </tr>
			{foreach from=$shipment.items key="hash" item="amount"}{if $amount > 0}
	<tr>
  
	 <td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
  
	{$order_info.items.$hash.product}<br />
  {if $order_info.items.$hash.product_options}
   {include file="common_templates/options_info.tpl"
	product_options=$order_info.items.$hash.product_options}<br />
  {/if} <strong>{$lang.code}:</strong>&nbsp;{$order_info.items.$hash.product_code}
	 </td>
	 <td style="padding: 5px 10px; background-color: #ffffff; text-align: center; font-size: 12px; font-family: Arial;">{$amount}</td>
	  
	 </tr>
	 {/if}
			{/foreach}
   </table>

			<table border="0" width="100%" cellspacing="0" cellpadding="0">
			{if $shipment.comments}
			  <tr>
			
				<td style="background-color: #dddddd; font-size: 12px; font-family: Arial;">
  
	<table border="0" width="100%" cellspacing="1" cellpadding="0">
	  <tr>
		<td style="padding: 5px 10px; background-color: #eeeeee; font-size: 12px; font-family: Arial;">
<strong>{$lang.comments}:</strong> {$shipment.comments} </td>
	  </tr>
	
	</table>