Placing Product Image on Packing Slip 1.5.6c
We have had the product image displayed on the packing slip for some time now. With the upgrade to 1.5.6c, the packing slip has gone through some PHP and layout revision.
In order to accomplish this in YOUR_ADMIN/packingslip.php on 1.5.6c find
Code:
<thead><tr class="dataTableHeadingRow">
<th class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
?>
<tr class="dataTableRow">
<td class="dataTableContent text-right"><?php echo $order->products[$i]['qty']; ?> x</td>
and replace with
Code:
<thead>
<tr class="dataTableHeadingRow">
<th class="dataTableHeadingContent">Image</th>
<th class="dataTableHeadingContent">Quantity</th>
<th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
?>
<tr class="dataTableRow">
<td class="dataTableContent"><?php echo '<img src="' . DIR_WS_CATALOG . DIR_WS_IMAGES . zen_get_products_image($order->products[$i]['id']) .'" align="left" width="' . IMAGE_ON_INVOICE_IMAGE_WIDTH . '" height="' . IMAGE_ON_INVOICE_IMAGE_HEIGHT . '">'; ?></td>
<td class="dataTableContent"><?php echo $order->products[$i]['qty']; ?> x</td>
Actual changes are highlighted in red.
There's a good chance this will adapt to other pages but we have not tried on other than the packing slip.
Re: Placing Product Image on Packing Slip 1.5.6c
And....
The fix for the image on the Invoice (YOUR_ADMIN/invoice.php) is to find
Code:
<thead> <tr class="dataTableHeadingRow">
<th class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></th>
</tr>
</thead>
<tbody>
<?php
$decimals = $currencies->get_decimal_places($order->info['currency']);
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
$priceIncTax = $currencies->format(zen_round(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), $decimals) * $order->products[$i]['qty'], true, $order->info['currency'], $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
?>
<tr class="dataTableRow">
<td class="dataTableContent text-right"><?php echo $order->products[$i]['qty']; ?> x</td>
and change it to
Code:
<thead> <tr class="dataTableHeadingRow">
<th class="dataTableHeadingContent">Image</th>
<th class="dataTableHeadingContent">Quantity</th>
<th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<th class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></th>
<th class="dataTableHeadingContent text-right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></th>
</tr>
</thead>
<tbody>
<?php
$decimals = $currencies->get_decimal_places($order->info['currency']);
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
$priceIncTax = $currencies->format(zen_round(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), $decimals) * $order->products[$i]['qty'], true, $order->info['currency'], $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
?>
<tr class="dataTableRow">
<td class="dataTableContent"><?php echo '<img src="' . DIR_WS_CATALOG . DIR_WS_IMAGES . zen_get_products_image($order->products[$i]['id']) .'" align="left" width="' . IMAGE_ON_INVOICE_IMAGE_WIDTH . '" height="' . IMAGE_ON_INVOICE_IMAGE_HEIGHT . '">'; ?></td>
<td class="dataTableContent"><?php echo $order->products[$i]['qty']; ?> x</td>
Re: Placing Product Image on Packing Slip 1.5.6c
For a site of mine that sells artwork this is a nice addition - thank you @dbltoe.
For those that need to know, I also added these lines to admin/includes/languages/english/packingslip.php
Code:
define('IMAGE_ON_INVOICE_IMAGE_WIDTH','200');
define('IMAGE_ON_INVOICE_IMAGE_HEIGHT','');
Similar would apply to the invoice language file.
Re: Placing Product Image on Packing Slip 1.5.6c
Quote:
Originally Posted by
simon1066
For a site of mine that sells artwork this is a nice addition - thank you @dbltoe.
For those that need to know, I also added these lines to admin/includes/languages/english/packingslip.php
Code:
define('IMAGE_ON_INVOICE_IMAGE_WIDTH','200');
define('IMAGE_ON_INVOICE_IMAGE_HEIGHT','');
Similar would apply to the invoice language file.
You are welcome.
Also, settings for these variables should not be in a page-layout file. They are either in the Configuration >> Images settings or in a define file generally in an extra-definitions folder.
In this case, the height and width are set in Configuration >> Images >> Image - On Invoice Height and Configuration >> Image >> Image - On Invoice Width
The current default in 1.5.6c is 80 for each. Remember that current html and css will error if you add "px" to an image's height or width.
Re: Placing Product Image on Packing Slip 1.5.6c
Quote:
Originally Posted by
dbltoe
You are welcome.
Also, settings for these variables should not be in a page-layout file. They are either in the Configuration >> Images settings or in a define file generally in an extra-definitions folder.
In this case, the height and width are set in Configuration >> Images >> Image - On Invoice Height and Configuration >> Image >> Image - On Invoice Width
The current default in 1.5.6c is 80 for each. Remember that current html and css will error if you add "px" to an image's height or width.
I haven't customised my Admin to include these Configuration entries, but I note your point about the extra_definitions file and will move the variables to a new file.