Source of file OrderManipulation.php
Size: 1,358 Bytes - Last Modified: 2021-12-23T10:05:17+00:00
/var/www/docs.ssmods.com/process/src/code/Extensions/OrderManipulation.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 | <?php namespace Milkyway\SS\Shop\OrderHistory\Extensions; /** * Milkyway Multimedia * OrderManipulation.php * * @package milkyway-multimedia/ss-shop-order-history * @author Mellisa Hankins <mell@milkywaymultimedia.com.au> */ use Milkyway\SS\Shop\OrderHistory\Contracts\HasOrderFormActions; use Object; use Extension; class OrderManipulation extends Extension { private static $allowed_actions = [ 'orders', ]; protected $handler; protected $order; /* * Yup, we are hijacking the order action */ public function beforeCallActionHandler($request, &$action = '') { if($action != 'order' || !$request->param('OtherID')) { return; } $this->order = $this->owner->orderfromid(); if(!$this->order || !$this->handler()->hasAction($request->param('OtherID'))) { return; } $action = 'orders'; } public function orders() { if(!$this->order) { return $this->owner->httpError(404, "Order could not be found"); } return $this->handler(); } protected function handler() { if(!$this->handler) { $this->handler = $this->handler = Object::create('Milkyway\SS\Shop\OrderHistory\Actions\Handler', $this->owner, $this->order); } return $this->handler; } } |