Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    107
    Plugin Contributions
    1

    Default Product Attribute Image on Packing Slip

    Good morning Zenners,

    Is there anyone who has figured out how to put attribute images on the packing slip? I sell product with 3 choices (basic, senior, master) and it would make it easier when picking product to glance at an image then trying to read the text.

    I have already added the product image to the packing slip, but I would really like to add the attribute images as well.

    Thank you!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Product Attribute Image on Packing Slip

    For v1.5.7, how about something like this:
    Code:
    <?php
    /**
     * @copyright Copyright 2003-2020 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license https://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: DrByte 2020 Oct 06 Modified in v1.5.7 $
     */
    require('includes/application_top.php');
    
    
    $show_product_images = true;
    $show_attrib_images = true;
    $img_width = defined('IMAGE_ON_INVOICE_IMAGE_WIDTH') ? (int)IMAGE_ON_INVOICE_IMAGE_WIDTH : '100';
    $attr_img_width = '25';
    
    
    if (!function_exists('zen_get_attributes_image')) {
        function zen_get_attributes_image($product_id, $option_id, $value_id)
        {
            global $db;
            $sql = "SELECT attributes_image FROM " . TABLE_PRODUCTS_ATTRIBUTES . " 
                    WHERE products_id = " . (int)$product_id . "
                    AND options_id = " . (int)$option_id . "
                    AND options_values_id = " . (int)$value_id;
            $result = $db->Execute($sql, 1);
            if ($result->EOF) return '';
            return $result->fields['attributes_image'];
        }
    }
    
    
    require(DIR_WS_CLASSES . 'currencies.php');
    $currencies = new currencies();
    
    
    $oID = zen_db_prepare_input($_GET['oID']);
    
    
    include DIR_FS_CATALOG . DIR_WS_CLASSES . 'order.php';
    $order = new order($oID);
    
    
    // prepare order-status pulldown list
    $orders_statuses = array();
    $orders_status_array = array();
    $orders_status = $db->Execute("SELECT orders_status_id, orders_status_name
                                   FROM " . TABLE_ORDERS_STATUS . "
                                   WHERE language_id = " . (int)$_SESSION['languages_id']);
    foreach ($orders_status as $order_status) {
        $orders_statuses[] = array(
            'id' => $order_status['orders_status_id'],
            'text' => $order_status['orders_status_name'] . ' [' . $order_status['orders_status_id'] . ']');
        $orders_status_array[$order_status['orders_status_id']] = $order_status['orders_status_name'];
    }
    
    
    $show_customer = false;
    if ($order->billing['name'] != $order->delivery['name']) {
        $show_customer = true;
    }
    if ($order->billing['street_address'] != $order->delivery['street_address']) {
        $show_customer = true;
    }
    ?>
    <!doctype html>
    <html <?php echo HTML_PARAMS; ?>>
    <head>
        <meta charset="<?php echo CHARSET; ?>">
        <title><?php echo TITLE; ?></title>
        <link rel="stylesheet" href="includes/stylesheet.css">
    </head>
    <body>
    <div class="container">
        <!-- body_text //-->
        <table class="table">
            <tr>
                <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
                <td class="pageHeading" align="right"><?php echo zen_image(DIR_WS_IMAGES . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT); ?></td>
            </tr>
        </table>
        <div><?php echo zen_draw_separator(); ?></div>
        <table class="table">
            <?php
            if ($show_customer == true) {
                ?>
                <tr>
                    <td class="main" colspan="2"><b><?php echo ENTRY_CUSTOMER; ?></b></td>
                </tr>
                <tr>
                    <td class="main" colspan="2"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>
                </tr>
            <?php } ?>
            <tr>
                <td style="border: none">
                    <table>
                        <tr>
                            <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
                        </tr>
                        <tr>
                            <td class="main"><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'); ?></td>
                        </tr>
                        <tr>
                            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
                        </tr>
                        <tr>
                            <td class="main">
                                <?php echo ENTRY_TELEPHONE_NUMBER . ' ' . $order->customer['telephone']; ?>
                            </td>
                        </tr>
                        <tr>
                            <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '">' . $order->customer['email_address'] . '</a>'; ?></td>
                        </tr>
                    </table>
                </td>
                <td style="border: none">
                    <table>
                        <tr>
                            <td class="main"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
                        </tr>
                        <tr>
                            <td class="main"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td class="main"><strong><?php echo ENTRY_ORDER_ID; ?></strong></td>
                <td class="main"><?php echo $oID; ?></td>
            </tr>
            <tr>
                <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
                <td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
            </tr>
            <tr>
                <td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td>
                <td class="main"><?php echo $order->info['payment_method']; ?></td>
            </tr>
        </table>
        <div><?php echo zen_draw_separator('pixel_trans.gif', '', '10'); ?></div>
        <table class="table table-striped">
            <thead>
            <tr class="dataTableHeadingRow">
                <?php if ($show_product_images) { ?>
                <th class="dataTableHeadingContent" style="width: <?php echo (int)$img_width . 'px'; ?>">&nbsp;</th>
                <?php } ?>
                <th class="dataTableHeadingContent">&nbsp;</th>
                <th class="dataTableHeadingContent" style="width: 70%"><?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++) {
                $product_name = $order->products[$i]['name'];
                ?>
                <tr class="dataTableRow">
                    <?php if ($show_product_images) { ?>
                    <td class="dataTableContent">
                        <?php echo zen_image(DIR_WS_CATALOG . DIR_WS_IMAGES . zen_get_products_image($order->products[$i]['id']), $product_name, (int)$img_width); ?>
                    </td>
                    <?php } ?>
    
    
                    <td class="dataTableContent text-right">
                        <?php echo $order->products[$i]['qty']; ?>&nbsp;x
                    </td>
                    <td class="dataTableContent">
                        <?php echo $product_name; ?>
                        <?php
                        if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
                            ?>
                            <ul>
                                <?php
                                for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
                                    ?>
                                    <li>
                                        <?php
                                        $attribute_name = $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
                                        $attribute_image = zen_get_attributes_image($order->products[$i]['id'], $order->products[$i]['attributes'][$j]['option_id'], $order->products[$i]['attributes'][$j]['value_id']);
    
    
                                        if ($show_attrib_images && !empty($attribute_image)) {
                                            echo zen_image(DIR_WS_CATALOG.DIR_WS_IMAGES . $attribute_image, $attribute_name, (int)$attr_img_width);
                                        }
                                        ?>
                                        <small>
                                            <i>
                                                <?php echo $attribute_name; ?>
                                            </i>
                                        </small>
                                    </li>
                                    <?php
                                }
                                ?>
                            </ul>
                            <?php
                        }
                        ?>
                    </td>
                    <td class="dataTableContent">
                        <?php echo $order->products[$i]['model']; ?>
                    </td>
                </tr>
                <?php
            }
            ?>
            </tbody>
        </table>
        <?php if (ORDER_COMMENTS_PACKING_SLIP > 0) { ?>
            <table class="table table-condensed">
                <thead>
                <tr>
                    <th class="text-center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></th>
                    <th class="text-center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></th>
                    <th class="text-center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></th>
                </tr>
                </thead>
                <tbody>
                <?php
                $orders_history = $db->Execute("SELECT orders_status_id, date_added, customer_notified, comments
                                                FROM " . TABLE_ORDERS_STATUS_HISTORY . "
                                                WHERE orders_id = " . zen_db_input($oID) . "
                                                AND customer_notified >= 0
                                                ORDER BY date_added");
    
    
                if ($orders_history->RecordCount() > 0) {
                    $count_comments = 0;
                    foreach ($orders_history as $order_history) {
                        $count_comments++;
                        ?>
                        <tr>
                            <td class="text-center"><?php echo zen_datetime_short($order_history['date_added']); ?></td>
                            <td><?php echo $orders_status_array[$order_history['orders_status_id']]; ?></td>
                            <td><?php echo ($order_history['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($order_history['comments']))); ?>&nbsp;</td>
                        </tr>
                        <?php
                        if (ORDER_COMMENTS_PACKING_SLIP == 1 && $count_comments >= 1) {
                            break;
                        }
                    }
                } else {
                    ?>
                    <tr>
                        <td colspan="3"><?php echo TEXT_NO_ORDER_HISTORY; ?></td>
                    </tr>
                    <?php
                }
                ?>
                </tbody>
            </table>
        <?php } // order comments ?>
    </div>
    
    
    <!-- body_text_eof //-->
    </body>
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
    Last edited by DrByte; 6 Oct 2020 at 04:53 PM. Reason: Updated to use zen_image function
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Product Attribute Image on Packing Slip

    And here's what it looks like:
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Mar 2006
    Location
    Auckland, New Zealand
    Posts
    234
    Plugin Contributions
    0

    Default Re: Product Attribute Image on Packing Slip

    I like this! Is this a new file I create, or is there an existing file I add this code to? :-)
    Elemi

    The Art of Bespoke Aromatherapy
    www.AmorAromatherapy.co.nz

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Product Attribute Image on Packing Slip

    In v1.5.7 replace /admin/packingslip.php with the code above.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Mar 2006
    Location
    Auckland, New Zealand
    Posts
    234
    Plugin Contributions
    0

    Default Re: Product Attribute Image on Packing Slip

    Thank you Dr B :-)
    Elemi

    The Art of Bespoke Aromatherapy
    www.AmorAromatherapy.co.nz

  7. #7
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    107
    Plugin Contributions
    1

    Default Re: Product Attribute Image on Packing Slip

    Awesome!!

    But I would like to make just a few tweaks. The product image on the right column, the attribute on the next line down from the attribute text, and the attribute image larger. I'll play around with it when I get a chance, but those would be my only recommendations. I'll post what I come up with.

    Thank you Dr. Byte, as always awesome work!

    Quote Originally Posted by DrByte View Post
    For v1.5.7, how about something like this:

  8. #8
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    107
    Plugin Contributions
    1

    Default Re: Product Attribute Image on Packing Slip

    I found some other items that were of concern, the order ID was missing and such. I have played with it the best I can. I found where to change the attribute image size (easily spotted on line 13, made it bigger to 75) and merged my previous packing slip that had a better lay out. Please take a look and see what you think. The only thing I can't seem to find is how to move the attribute image to the next line after the attribute text vs. having it before the text. Other than that, this is 1000% better than what we had before.

    Code:
    <?php
    /**
     * @copyright Copyright 2003-2020 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license https://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: DrByte 2020 Oct 06 Modified in v1.5.7 $
     */
    require('includes/application_top.php');
    
    $show_product_images = true;
    $show_attrib_images = true;
    $img_width = defined('IMAGE_ON_INVOICE_IMAGE_WIDTH') ? (int)IMAGE_ON_INVOICE_IMAGE_WIDTH : '100';
    $attr_img_width = '75';
    
    
    if (!function_exists('zen_get_attributes_image')) {
        function zen_get_attributes_image($product_id, $option_id, $value_id)
        {
            global $db;
            $sql = "SELECT attributes_image FROM " . TABLE_PRODUCTS_ATTRIBUTES . " 
                    WHERE products_id = " . (int)$product_id . "
                    AND options_id = " . (int)$option_id . "
                    AND options_values_id = " . (int)$value_id;
            $result = $db->Execute($sql, 1);
            if ($result->EOF) return '';
            return $result->fields['attributes_image'];
        }
    }
    
    
    require(DIR_WS_CLASSES . 'currencies.php');
    $currencies = new currencies();
    
    $oID = zen_db_prepare_input($_GET['oID']);
    
    include DIR_FS_CATALOG . DIR_WS_CLASSES . 'order.php';
    $order = new order($oID);
    
    // prepare order-status pulldown list
    $orders_statuses = array();
    $orders_status_array = array();
    $orders_status = $db->Execute("SELECT orders_status_id, orders_status_name
                                   FROM " . TABLE_ORDERS_STATUS . "
                                   WHERE language_id = " . (int)$_SESSION['languages_id']);
    foreach ($orders_status as $order_status) {
      $orders_statuses[] = array(
        'id' => $order_status['orders_status_id'],
        'text' => $order_status['orders_status_name'] . ' [' . $order_status['orders_status_id'] . ']');
      $orders_status_array[$order_status['orders_status_id']] = $order_status['orders_status_name'];
    }
    
    $show_customer = false;
    if ($order->billing['name'] != $order->delivery['name']) {
      $show_customer = true;
    }
    if ($order->billing['street_address'] != $order->delivery['street_address']) {
      $show_customer = true;
    }
    ?>
    <!doctype html>
    <html <?php echo HTML_PARAMS; ?>>
    <head>
        <meta charset="<?php echo CHARSET; ?>">
        <title><?php echo TITLE; ?></title>
        <link rel="stylesheet" href="includes/stylesheet.css">
    </head>
    <body>
    <div class="container">
        <!-- body_text //-->
        <table class="table">
            <tr>
                <td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
                <td class="pageHeading" align="right"><?php echo zen_image(DIR_WS_IMAGES . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT); ?></td>
            </tr>
        </table>
    
        <table class="table">
            <?php
            if ($show_customer == true) {
                ?>
                <tr>
                    <td class="main" colspan="2"><b><?php echo ENTRY_CUSTOMER; ?></b></td>
                </tr>
                <tr>
                    <td class="main" colspan="2"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>
                </tr>
            <?php } ?>
            <tr>
              <td style="border: none">
                <table>
                  <tr>
                    <td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'); ?></td>
                  </tr>
                  <tr>
                    <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
                  </tr>
    
                </table>
              </td>
              <td style="border: none">
                <table>
                  <tr>
                    <td class="main"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
          <table width=100%>
                  <tr>
                    <td class="main">
                        <?php echo ENTRY_TELEPHONE_NUMBER . ' ' . $order->customer['telephone']; ?>
                    </td>
                    <td class="main" colspan="2">
    		<?php echo '<a href="mailto:' . $order->customer['email_address'] . '">' . $order->customer['email_address'] . '</a>'; ?></td>
                  </tr>        <tr>
              <td class="main" width=33% border=1><strong><?php echo ENTRY_ORDER_ID; ?></strong><?php echo $oID; ?></td>
              <td class="main" width=33% border=1><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong><?php echo zen_date_long($order->info['date_purchased']); ?></td>
              <td class="main" width=34% border=1><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong><?php echo $order->info['payment_method']; ?></td>
            </tr>
          </table>
          <div><?php echo zen_draw_separator('pixel_trans.gif', '', '10'); ?></div>
          <table class="table table-striped">
            <thead>
            <tr class="dataTableHeadingRow">
                
                <th class="dataTableHeadingContent" colspan="2" style="width: 50%"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
                <th class="dataTableHeadingContent" style="width: 25%"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></th>
                <?php if ($show_product_images) { ?>
                <th class="dataTableHeadingContent" style="width: 25%">Image <small><br/>(Actual item may vary)</small></th>
                <?php } ?>
            </tr>
            
            </thead>
            <tbody>
            <?php
            for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
                $product_name = $order->products[$i]['name'];
                ?>
                <tr class="dataTableRow">
                    <td class="dataTableContent text-right">
                        <?php echo $order->products[$i]['qty']; ?>&nbsp;x
                    </td>
                    <td class="dataTableContent">
                        <?php echo $product_name; ?>
                        <?php
                        if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
                            ?>
                            <ul>
                                <?php
                                for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
                                    ?>
                                    <li>
                                        <?php
    	$attribute_name = $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
    	$attribute_image = zen_get_attributes_image($order->products[$i]['id'], $order->products[$i]['attributes'][$j]['option_id'], $order->products[$i]['attributes'][$j]['value_id']);
    
    
                                        if ($show_attrib_images && !empty($attribute_image)) {
                                            echo zen_image(DIR_WS_CATALOG.DIR_WS_IMAGES . $attribute_image, $attribute_name, (int)$attr_img_width);
                                        }
                                        ?>
                                        <small>
                                            <i>
                                                <?php echo $attribute_name; ?>
                                            </i>
                                        </small>
                                    </li>
                                    <?php
                                }
                                ?>
                            </ul>
                            <?php
                        }
                        ?>
                        
                    </td>
                    <td class="dataTableContent">
                        <?php echo $order->products[$i]['model']; ?>
                    </td>
                                    <?php if ($show_product_images) { ?>
                    <td class="dataTableContent">
                        <?php echo zen_image(DIR_WS_CATALOG . DIR_WS_IMAGES . zen_get_products_image($order->products[$i]['id']), $product_name, (int)$img_width); ?>
                    </td>
                    <?php } ?>
    
    
                </tr>
                <?php
            }
            ?>
            </tbody>
          </table>
          <?php if (ORDER_COMMENTS_PACKING_SLIP > 0) { ?>
            <table class="table table-condensed" style="width:100%;">
              <thead>
                <tr>
                  <th class="text-center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></th>
                  <th class="text-center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></th>
                  <th class="text-center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></th>
                </tr>
              </thead>
              <tbody>
                  <?php
                  $orders_history = $db->Execute("SELECT orders_status_id, date_added, customer_notified, comments
                                                FROM " . TABLE_ORDERS_STATUS_HISTORY . "
                                                WHERE orders_id = " . zen_db_input($oID) . "
                                                AND customer_notified >= 0
                                                ORDER BY date_added");
    
                  
                  if ($orders_history->RecordCount() > 0) {
                    $count_comments = 0;
                    foreach ($orders_history as $order_history) {
                        $count_comments++;
                        ?>
                        <tr>
                            <td class="text-center"><?php echo zen_datetime_short($order_history['date_added']); ?></td>
                            <td><?php echo $orders_status_array[$order_history['orders_status_id']]; ?></td>
                            <td><?php echo ($order_history['comments'] == '' ? TEXT_NONE : nl2br(zen_db_output($order_history['comments']))); ?>&nbsp;</td>
                        </tr>
                        <?php
                        if (ORDER_COMMENTS_PACKING_SLIP == 1 && $count_comments >= 1) {
                            break;
                        }
                    }
                } else {
                    ?>
                    <tr>
                        <td colspan="3"><?php echo TEXT_NO_ORDER_HISTORY; ?></td>
                    </tr>
                    <?php
                }
                ?>
              </tbody>
            </table>
          <?php } // order comments ?>
        </div>
    
        <!-- body_text_eof //-->
      </body>
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
    Last edited by jwlamb; 12 Oct 2020 at 05:37 AM. Reason: line location

  9. #9
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Product Attribute Image on Packing Slip

    Quote Originally Posted by jwlamb View Post
    The only thing I can't seem to find is how to move the attribute image to the next line after the attribute text vs. having it before the text.
    you could just flip the echo's..

    Code:
                                    <li>
                                        <?php
        $attribute_name = $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
        $attribute_image = zen_get_attributes_image($order->products[$i]['id'], $order->products[$i]['attributes'][$j]['option_id'], $order->products[$i]['attributes'][$j]['value_id']);
        
                                        <small>
                                            <i>
                                                <?php echo $attribute_name; ?>
                                            </i>
                                        </small>
    
                                        if ($show_attrib_images && !empty($attribute_image)) {
                                            echo zen_image(DIR_WS_CATALOG.DIR_WS_IMAGES . $attribute_image, $attribute_name, (int)$attr_img_width);
                                        }
                                        ?>
                                        
                                    </li>
    I use a site function page to hold all my functions that are not core code yet so upgrading is simple and I can use them else where like the invoice page too. Also using his function on the catalog side fixed a problem I had with Attribute-image-replaces-main-product-image-on-select.. I can use the function to display the selected attribute image on user account order history and other pages such as order status page. Code chunk from order status part of return manager update.
    Code:
    <div class="ui-block-ee"><div class="ui-body ui-body-d">
    <?php  
    $attributeimage = '';
    $productimage = $db->Execute("select products_image from  " . TABLE_PRODUCTS . "  where products_id = '" . (int)$order->products[$i]['id'] . "'"); 
    
     if ( (isset($RTorders->products[$i]['attributes'])) && (sizeof($RTorders->products[$i]['attributes']) > 0) ) {
    
          for ($j=0, $n2=sizeof($RTorders->products[$i]['attributes']); $j<$n2; $j++) {
            
            $attributeimage = zen_get_attributes_image($order->products[$i]['id'], $order->products[$i]['attributes'][$j]['option_id'], $order->products[$i]['attributes'][$j]['value_id']);
       
          }
    
        }
    
    if ($attributeimage == '') {
    echo '<div>' . zen_image('images/' . $productimage->fields['products_image'], addslashes($order->products[$i]['name']), 50, 50) . '</div>';
    }else{
    echo '<div>' . zen_image('images/' . $attributeimage, addslashes($RTorders->products[$i]['name']), 50, 50) . '</div>';
    }
    ?>
    </div></div>
    Just another way the function can be used...
    Dave
    Always forward thinking... Lost my mind!

  10. #10
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    107
    Plugin Contributions
    1

    Default Re: Product Attribute Image on Packing Slip

    Quote Originally Posted by davewest View Post
    you could just flip the echo's..
    I tried that, it breaks the code and I get a HTTP 500 error.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Placing Product Image on Packing Slip 1.5.6c
    By dbltoe in forum Addon Admin Tools
    Replies: 4
    Last Post: 20 Nov 2019, 06:36 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

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