Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,194
    Plugin Contributions
    63

    Default Invoice products sort order

    ZC 1.5.8

    I need to sort the items order by manufacturer. I know people will say orders are picked with the packing slip, but these orders contain OTC medical items, so the packing slip is sparce due to PMI requirements and they pick with the invoice.

    I have tried a bunch of things and can't get this going in 1.5.8.

    Any help is appreciated =)

    ~Melanie
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,292
    Plugin Contributions
    125

    Default Re: Invoice products sort order

    Look at includes/classes/order.php line 285. That's the product select for the products in the order. You want to join orders_products with products on the products_id field so you can get products.manufacturers_id, and order on that.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,194
    Plugin Contributions
    63

    Default Re: Invoice products sort order

    Quote Originally Posted by swguy View Post
    Look at includes/classes/order.php line 285. That's the product select for the products in the order. You want to join orders_products with products on the products_id field so you can get products.manufacturers_id, and order on that.
    Yep, I tried that but the following doesn't work

    Code:
            $this->billing['zone_id'] = $this->getCountryZoneId((int)$this->billing['country'], $this->billing['state']);
    //Melanie sort orders by manufacturer
            $index = 0;
            $orders_products_query = "SELECT *
                                      FROM " . TABLE_ORDERS_PRODUCTS . "
                                      WHERE orders_id = " . (int)$this->orderId . "                                  
                                      ORDER BY products_manufacturers ASC";
    
            $orders_products = $db->Execute($orders_products_query);
    
            while (!$orders_products->EOF) {
                // convert quantity to proper decimals - account history
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,365
    Plugin Contributions
    94

    Default Re: Invoice products sort order

    Quote Originally Posted by swguy View Post
    Look at includes/classes/order.php line 285. That's the product select for the products in the order. You want to join orders_products with products on the products_id field so you can get products.manufacturers_id, and order on that.
    ... or, without modifying a core file, check out the NOTIFY_ORDER_AFTER_QUERY notification, through which you can modify the sort/display order of the products in the order after the order's information has been gathered.

    That notification is issued on (zc158a) the /includes/classes/order.php module's line 375.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,292
    Plugin Contributions
    125

    Default Re: Invoice products sort order

    > Yep, I tried that but the following doesn't work

    You didn't try that. Reread what I wrote.

    a) join orders_products with products on the products_id field
    b) [order by] products.manufacturers_id

    You are attempting to order by products_manufacturers, which doesn't exist in the default schema.
    If you created it and added it to the orders_products table, you likely not populating it at order creation time.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #6
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,845
    Plugin Contributions
    11

    Default Re: Invoice products sort order

    Quote Originally Posted by lat9 View Post
    ... or, without modifying a core file, check out the NOTIFY_ORDER_AFTER_QUERY notification, through which you can modify the sort/display order of the products in the order after the order's information has been gathered.

    That notification is issued on (zc158a) the /includes/classes/order.php module's line 375.
    i suppose this is a good way to do it. one would need to ensure that the script being called is the invoice script, else all uses of the order when queried will now be sorted this way.

    the other alternative is to the use the NOTIFY_ADMIN_INVOICE_SORT_DISPLAY notifier. it looks like you need to return an array with all of the original array element numbers in the sorted order. a little confusing, but i think i see how that would work.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Invoice products sort order

    Quote Originally Posted by carlwhat View Post
    i suppose this is a good way to do it. one would need to ensure that the script being called is the invoice script, else all uses of the order when queried will now be sorted this way.

    the other alternative is to the use the NOTIFY_ADMIN_INVOICE_SORT_DISPLAY notifier. it looks like you need to return an array with all of the original array element numbers in the sorted order. a little confusing, but i think i see how that would work.

    best.
    Don't have to use an "either/or" notifier situation. A single observer class listens for the invoice notifier, noting that condition and then as the associated order notifier is triggered while the invoice was hit, then obviously in the invoice loop reading from the orders....

    Notifiers are not 100% to be used all alone. There is a flow of operation, data made available and points at which additional operations should be performed.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,845
    Plugin Contributions
    11

    Default Re: Invoice products sort order

    mc, i can only assume your comment is for the good of the community as opposed to me specifically. i have used indicators in the past to process code based on hitting multiple notifiers within a single observer class. it can be pretty slick and powerful. a plug-in i did for edit orders uses that strategy to great effect.

    unfortunately that will not work in this case. the order object gets created prior to the invoice notifier.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,292
    Plugin Contributions
    125

    Default Re: Invoice products sort order

    Hopefully @mprough you have enough to go on based on this thread.

    Yet another option would be to create a new admin utility, based on some hybrid of packing slip and invoice, that created exactly what you needed for the pick-and-pack crew (without whatever you don't need). Lots of possibilities here.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v151 Products Sort Order
    By DigiBooks in forum General Questions
    Replies: 2
    Last Post: 19 Jan 2018, 12:02 AM
  2. Product sort order on invoice
    By Gonzon in forum Setting Up Categories, Products, Attributes
    Replies: 17
    Last Post: 9 Jun 2009, 09:48 PM
  3. Changing the sort order of the Products on the super invoice + packing slip
    By DisgruntledGeorge in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 14 Nov 2007, 12:24 PM
  4. Attributes sort order for invoice/packing slip
    By aeolidia in forum Managing Customers and Orders
    Replies: 6
    Last Post: 8 Nov 2006, 11:15 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