LemonStand Forum: Change status when printing packing slip - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Change status when printing packing slip

#1 User is offline   Hexarobi 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 103
  • Joined: 10-August 11

Posted 20 December 2011 - 10:31 AM

We decided today it would be beneficial to track when orders have had a packing slip printed by automatically moving them to a different status. I couldn't find an existing hook so I added one to the shop_orders controller. Please either add this event hook to the core, or point me to the proper place to hook this event, Thanks!

Added to modules/shop/controllers/shop_orders.php Line:953, within the packing_slip function, just before setting viewData.
Backend::$events->fireEvent('shop:onPrintPackingSlip', $orders);


My module code:
    public function subscribeEvents() {
		Backend::$events->addEvent('shop:onPrintPackingSlip', $this, 'print_packing_slip');
    }
    public function print_packing_slip($orders) {

		$printed_status = Shop_OrderStatus::create()->find_by_code('printed');

		foreach ($orders as $order) {
			if ($order->status->code == 'paid') {
				Shop_OrderStatusLog::create_record($printed_status->id, $order);
			}
		}
	}

0

#2 User is offline   Hexarobi 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 103
  • Joined: 10-August 11

Posted 23 January 2012 - 08:48 AM

Bump. Currently adding this hook in by hand every time I do a core update.

Thanks!
0

#3 User is offline   activeholdingco 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 177
  • Joined: 23-September 10

Posted 26 January 2012 - 09:06 AM

Hey,

You may consider posting this on the tracker. I have had better luck getting core modifications and bug fixes completed by posting there. I would argue that it is easier for them to find and prioritize than coming through the forum as it is easy to miss something.
0

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users