Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    7,283
    Plugin Contributions
    8

    Default 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']; ?>&nbsp;x</td>
                  <td class="dataTableContent"><?php echo $order->products[$i]['name']; ?>
    and replace with
    Code:
    <thead>
    <tr class="dataTableHeadingRow">
                  <th class="dataTableHeadingContent">Image</th>
                <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 '<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 . '" />' . $order->products[$i]['qty']; ?>&nbsp;x</td>
                  <td class="dataTableContent" colspan="2"><?php echo $order->products[$i]['name']; ?>
    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.
    Last edited by dbltoe; 20 Nov 2019 at 07:10 AM.
    Did you read the posting tips?!?
    Responsive Color Changes for 155-156c demo here.
    Zen Cart PCI Compatible Hosting

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    7,283
    Plugin Contributions
    8

    Default Re: Placing Product Image on Packing Slip 1.5.6c

    As soon as I ran out of time to edit, I realized that we were putting 3 TDs under essentially 4 THs (one was colspan-"2")

    A more accurate fix 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>
              </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']; ?>&nbsp;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']; ?>&nbsp;x</td>
    Did you read the posting tips?!?
    Responsive Color Changes for 155-156c demo here.
    Zen Cart PCI Compatible Hosting

  3. #3
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    7,283
    Plugin Contributions
    8

    Default 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']; ?>&nbsp;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']; ?>&nbsp;x</td>
    Did you read the posting tips?!?
    Responsive Color Changes for 155-156c demo here.
    Zen Cart PCI Compatible Hosting

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    674
    Plugin Contributions
    0

    Default 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.
    Simon

  5. #5
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    7,283
    Plugin Contributions
    8

    Default Re: Placing Product Image on Packing Slip 1.5.6c

    Quote Originally Posted by simon1066 View Post
    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.
    Did you read the posting tips?!?
    Responsive Color Changes for 155-156c demo here.
    Zen Cart PCI Compatible Hosting

  6. #6
    Join Date
    Feb 2009
    Location
    UK
    Posts
    674
    Plugin Contributions
    0

    Default Re: Placing Product Image on Packing Slip 1.5.6c

    Quote Originally Posted by dbltoe View Post
    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.
    Simon

 

 

Similar Threads

  1. Product Attribute Image on Invoice and Packing Slip
    By corygatz in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Jan 2011, 08:55 PM
  2. How to add image in packing slip?
    By teflonchest in forum Managing Customers and Orders
    Replies: 1
    Last Post: 3 May 2010, 04:09 PM
  3. Truncate Product Name in Packing Slip
    By maineiac13 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Jun 2009, 03:09 PM
  4. Packing Slip Have product totals and shipping
    By Best Price Accessori in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 1 Apr 2009, 05:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR