/** * Get modifier * * @return \XLite\Model\Order\Modifier */ protected function getModifier() { if (null === $this->modifier) { $this->modifier = $this->getOrderEntity()->getModifier(\XLite\Model\Base\Surcharge::TYPE_SHIPPING, 'SHIPPING'); $this->modifier->setMode(\XLite\Logic\Order\Modifier\AModifier::MODE_CART); $this->method = $this->modifier->getMethod(); } return $this->modifier; }
/** * Add order surcharge * * @param \XLite\Model\Order\Modifier $modifier Order modifier * @param float $value Surcharge value * * @return void */ protected function addOrderSurcharge($modifier, $value) { if (0 < $value && $modifier->getType() === \XLite\Model\Base\Surcharge::TYPE_DISCOUNT) { $value = $value * -1; } $modifier->getModifier()->addOrderSurcharge($modifier->getCode(), (double) $value); }
/** * {@inheritDoc} */ public function prepareEntityBeforeCommit($type) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'prepareEntityBeforeCommit', array($type)); return parent::prepareEntityBeforeCommit($type); }