/** * Postprocess inserted entity * * @param \XLite\Model\AEntity $entity Entity * @param array $line Array of entity data from request * * @return boolean */ protected function postprocessInsertedEntity(\XLite\Model\AEntity $entity, array $line) { $result = parent::postprocessInsertedEntity($entity, $line); if ($this->isNeedUpdateStock()) { // Get items from stock $entity->changeAmount(-1 * $entity->getAmount()); } $product = $entity->getProduct(); $attributes = $this->getAttributeValuesAsString($entity); \XLite\Controller\Admin\Order::setOrderChanges('Added items:' . $entity->getItemId(), sprintf('[%s] %s (%s x %d%s)', $product->getSku(), $product->getName(), static::formatPrice($entity->getPrice(), $entity->getOrder()->getCurrency(), true), $entity->getAmount(), $attributes ? ', ' . $attributes : '')); return $result; }