示例#1
0
 /**
  * Remove entity
  *
  * @param \XLite\Model\AEntity $entity Entity
  *
  * @return boolean
  */
 protected function removeEntity(\XLite\Model\AEntity $entity)
 {
     $result = parent::removeEntity($entity);
     if ($result) {
         foreach ($entity->getPrivateAttachments() as $attachment) {
             $attachment->getRepository()->delete($attachment, false);
         }
     }
     return $result;
 }
示例#2
0
 /**
  * Postprocess inserted entity
  *
  * @param \XLite\Model\OrderItem $entity OrderItem 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 ($result && \XLite\Controller\Admin\Order::isNeedProcessStock()) {
         // Process PIN codes on order save
         $order = $this->getOrder();
         if ($order->isProcessed()) {
             $order->processPINCodes();
         }
     }
     return $result;
 }
示例#3
0
 /**
  * Check order item and return true if this is valid
  *
  * @param \XLite\Model\OrderItem $entity Order item entity
  *
  * @return boolean
  */
 protected function isValidEntity($entity)
 {
     $result = parent::isValidEntity($entity);
     if ($result && ($entity->getProduct()->mustHaveVariants() || $entity->getVariant())) {
         $variant = $entity->getProduct()->getVariantByAttributeValuesIds($entity->getAttributeValuesIds());
         $result = $variant && $entity->getVariant() && $variant->getId() == $entity->getVariant()->getId();
     }
     return $result;
 }