Source of file OrderItem.php
Size: 0,773 Bytes - Last Modified: 2021-12-23T10:05:16+00:00
/var/www/docs.ssmods.com/process/src/code/Extensions/OrderItem.php
1234567891011121314151617181920212223242526272829303132 | <?php namespace Milkyway\SS\Shop\Inventory\Extensions; /** * Milkyway Multimedia * OrderItem.php * * @package milkyway-multimedia/ss-shop-inventory * @author Mellisa Hankins <mell@milkywaymultimedia.com.au> */ use Object; use DataExtension; class OrderItem extends DataExtension { private $prevQuantity; public function onBeforeWrite() { if ($this->owner->isChanged('Quantity')) { $changed = $this->owner->getChangedFields(); $this->prevQuantity = isset($changed['Quantity']) && isset($changed['Quantity']['before']) ? $changed['Quantity']['before'] : 0; } } public function onAfterWrite() { $this->owner->PreviousQuantity = $this->prevQuantity; $this->prevQuantity = null; } } |