Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello MisterBurns,
    Here’s what I would do: loop through the items as is already done in the code (foreach( $items as $item )) but don’t display anything yet. create a new array that uses the warehouse location as keys for the items. Then sort the items with ksort(), and loop through that new array again to display all information.

    Good luck!
    Ewout

    Hi Ewout,

    Thanks for this awesome plugin, you’ve allowed us to generate professional invoices so easily!

    I have an additional similar need to MisterBurns with a small difference:
    I would need to sort the order items according to product categories. Unfortunately, I have tried using ksort but I’m not successful at tweaking the code myself. Would you happen to have any pointers for this please? Many thanks once again!

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Cedlimed,
    The instructions are roughly the same, but you’ll need to put the category in the key of the item. You can get a comma separated list of the categories (note that a product can have multiple categories) with the following code (while in the foreach item loop):

    $categories = strip_tags($item['product']->get_categories());

    Good luck!
    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort on product custom fields on packing slip’ is closed to new replies.