Пример #1
0
 /**
  * Modify money 
  * 
  * @param float                $value     Value
  * @param \XLite\Model\AEntity $model     Model
  * @param string               $property  Model's property
  * @param array                $behaviors Behaviors
  * @param string               $purpose   Purpose
  *  
  * @return void
  */
 public static function modifyMoney($value, \XLite\Model\AEntity $model, $property, array $behaviors, $purpose)
 {
     $obj = $model instanceof \XLite\Model\Product ? $model : $model->getProduct();
     return \XLite\Module\CDev\VAT\Logic\Product\Tax::getInstance()->deductTaxFromPrice($obj, $value);
 }
Пример #2
0
 /**
  * Remove entity
  *
  * @param \XLite\Model\AEntity $entity Entity
  *
  * @return boolean
  */
 protected function removeEntity(\XLite\Model\AEntity $entity)
 {
     $product = $entity->getProduct();
     if ($this->isNeedUpdateStock() && !$entity->isDeleted()) {
         // Return items to stock
         $entity->changeAmount($entity->getAmount());
     }
     $attributes = $this->getAttributeValuesAsString($entity);
     \XLite\Controller\Admin\Order::setOrderChanges('Removed 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 parent::removeEntity($entity);
 }
Пример #3
0
 /**
  * Build entity page URL
  *
  * @param \XLite\Model\AEntity $entity Entity
  * @param array                $column Column data
  *
  * @return string
  */
 protected function buildEntityURL(\XLite\Model\AEntity $entity, array $column)
 {
     if ('product' == $column[static::COLUMN_CODE]) {
         $result = \XLite\Core\Converter::buildURL('product', '', array('product_id' => $entity->getProduct()->getProductId()));
     } else {
         $result = parent::buildEntityURL($entity, $column);
     }
     return $result;
 }
Пример #4
0
 /**
  * Return attribute values
  *
  * @param \XLite\Model\AEntity $model Model
  *
  * @return array
  */
 protected static function getAttributeValues(\XLite\Model\AEntity $model)
 {
     return $model instanceof \XLite\Module\XC\ProductVariants\Model\ProductVariant ? $model->getProduct()->getAttrValues() : parent::getAttributeValues($model);
 }
Пример #5
0
 /**
  * Modify money
  *
  * @param \XLite\Model\AEntity $model Model
  *
  * @return \XLite\Model\AEntity
  */
 protected static function getObject(\XLite\Model\AEntity $model)
 {
     return $model instanceof \XLite\Model\Product ? $model : $model->getProduct();
 }