Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    113
    Plugin Contributions
    0

    red flag Add "Product_Name" to each line in Orders.php

    Hi All,

    One of my stores sells "Classes", and each class date is a product. In the admin, while viewing orders.php, I see the Customers Name, and Company Name on the next line.

    I would like to add a 3rd line under Company Name that displays the "product_name" (aka: class date) that the customer has ordered!

    It looks like this code needs to be added in orders.php around line 820, but have had no luck with the proper code to add!

    Tried adding $order->products[$i]['name'], which is the code that displays in the right sidebox, and displays the product (class) ordered, but this is visible ONLY when that individual customer is highlighted!

    I would like to display the product_name for EACH customer order listing!

    Can someone please help me with the code that I need to use?

    Thanks in advance....

  2. #2
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    113
    Plugin Contributions
    0

    Default Re: Add "Product_Name" to each line in Orders.php

    Does no one have any ideas about this?

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Add "Product_Name" to each line in Orders.php

    So if there is 1 to 100 Products, you want them listed on the main listing and not just the right panel?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #4
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    113
    Plugin Contributions
    0

    Default Re: Add "Product_Name" to each line in Orders.php

    Quote Originally Posted by Ajeh View Post
    So if there is 1 to 100 Products, you want them listed on the main listing and not just the right panel?
    Well, yes, but in my case I give classes, and each customer will have only 1 per year (for yearly continuing education). In very few instances, there will be no more then 3, but only for a small hand-full!

    I know that I can filter the list to just show me the customers for a certain product (class), but just wanted to have the purchased class visible with a quick glance.

    I could even remove the "company name", as I don't really need this displayed, and it would give me the extra line for the urchased class!

    Thanks for your reply....

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Add "Product_Name" to each line in Orders.php

    See if adding this below the row works for you:
    Code:
    <tr>
      <td class="dataTableContent" colspan="2">&nbsp;</td>
      <td class="dataTableContent" colspan="6">
    <?php
          $order = new order($orders->fields['orders_id']);
          for ($i=0; $i<sizeof($order->products); $i++) {
            echo $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name'];
            if (sizeof($order->products[$i]['attributes']) > 0) {
              for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {
                echo '&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</i></nobr>';
              }
            }
            if ($i > MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) {
              echo TEXT_MORE;
              break;
            }
            echo '<br/>';
          }
    ?>
    </td>
    </tr>
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Jan 2011
    Location
    Ohio
    Posts
    113
    Plugin Contributions
    0

    Default Re: Add "Product_Name" to each line in Orders.php

    Quote Originally Posted by Ajeh View Post
    See if adding this below the row works for you:
    Code:
    <tr>
      <td class="dataTableContent" colspan="2">&nbsp;</td>
      <td class="dataTableContent" colspan="6">
    <?php
          $order = new order($orders->fields['orders_id']);
          for ($i=0; $i<sizeof($order->products); $i++) {
            echo $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name'];
            if (sizeof($order->products[$i]['attributes']) > 0) {
              for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {
                echo '&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</i></nobr>';
              }
            }
            if ($i > MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) {
              echo TEXT_MORE;
              break;
            }
            echo '<br/>';
          }
    ?>
    </td>
    </tr>
    Outstanding! Thank you so much, Linda!

    Just needed a little formatting for your code, and it worked like a charm. I removed the attribute code, as I have 3-4 attributes defined, but just needed the "qty & name".

    I just enclosed within the existing <td> to keep the formatting straight!

    Code:
    <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $orders->fields['customers_id'], 'NONSSL') . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW . ' ' . TABLE_HEADING_CUSTOMERS) . '</a>&nbsp;' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br />' . $orders->fields['customers_company'] : ''); ?>
    <br />
    
    <?php
          $order = new order($orders->fields['orders_id'])
          for ($i=0; $i<sizeof($order->products); $i++) {
             echo $order->products[$i]['qty'] . '&nbsp;x&nbsp;' .   $order->products[$i]['name'];
    
             if ($i > MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) {
                 echo TEXT_MORE;
    	     break;
    	 }
    	 echo '<br/>';
         }
    ?>
    </td>
    The code in Blue above is all I needed to add!

    Once again, thank you very much for your quick help!

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Add "Product_Name" to each line in Orders.php

    You are most welcome ... glad this worked for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. "Add to cart" function for each product?
    By petergy in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 10 Apr 2013, 08:55 PM
  2. Replies: 4
    Last Post: 16 Oct 2011, 12:58 AM
  3. Need to change the default quanity for "each" to "Set" on certain products
    By whiskermouse in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 24 Apr 2010, 02:46 AM
  4. Replies: 5
    Last Post: 11 Sep 2009, 04:51 AM
  5. Replies: 1
    Last Post: 8 May 2009, 10:43 PM

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