Пример #1
0
 /**
  * Returns array of bundled discount articles
  *
  * @param object $oBasketItem basket item object
  * @param array  $aBundles    array of found bundles
  *
  * @return array
  */
 protected function _getItemBundles($oBasketItem, $aBundles = array())
 {
     if ($oBasketItem->isBundle()) {
         return array();
     }
     // does this object still exists ?
     if ($oArticle = $oBasketItem->getArticle()) {
         $aDiscounts = oxDiscountList::getInstance()->getBasketItemBundleDiscounts($oArticle, $this, $this->getBasketUser());
         foreach ($aDiscounts as $oDiscount) {
             $iAmnt = $oDiscount->getBundleAmount($oBasketItem->getAmount());
             if ($iAmnt) {
                 //init array element
                 if (!isset($aBundles[$oDiscount->oxdiscount__oxitmartid->value])) {
                     $aBundles[$oDiscount->oxdiscount__oxitmartid->value] = 0;
                 }
                 if ($oDiscount->oxdiscount__oxitmmultiple->value) {
                     $aBundles[$oDiscount->oxdiscount__oxitmartid->value] += $iAmnt;
                 } else {
                     $aBundles[$oDiscount->oxdiscount__oxitmartid->value] = $iAmnt;
                 }
             }
         }
     }
     return $aBundles;
 }
Пример #2
0
 /**
  * @param object $entity
  * @return Backlog
  */
 private function getUpdateBacklog($entity)
 {
     switch (true) {
         case $entity instanceof ArticleModel:
             return new Backlog(self::EVENT_ARTICLE_UPDATED, ['id' => $entity->getId()]);
         case $entity instanceof VariantModel:
             return new Backlog(self::EVENT_VARIANT_UPDATED, ['number' => $entity->getNumber()]);
         case $entity instanceof PriceModel:
             return new Backlog(self::EVENT_PRICE_UPDATED, ['number' => $entity->getDetail()->getNumber()]);
         case $entity instanceof VoteModel:
             return new Backlog(self::EVENT_VOTE_UPDATED, ['articleId' => $entity->getArticle()->getId()]);
         case $entity instanceof SupplierModel:
             return new Backlog(self::EVENT_SUPPLIER_UPDATED, ['id' => $entity->getId()]);
         case $entity instanceof UnitModel:
             return new Backlog(self::EVENT_UNIT_UPDATED, ['id' => $entity->getId()]);
         case $entity instanceof TaxModel:
             return new Backlog(self::EVENT_TAX_UPDATED, ['id' => $entity->getId()]);
         case $entity instanceof PropertyGroupModel:
             return new Backlog(self::EVENT_PROPERTY_GROUP_UPDATED, ['id' => $entity->getId()]);
         case $entity instanceof PropertyOptionModel:
             return new Backlog(self::EVENT_PROPERTY_OPTION_UPDATED, ['id' => $entity->getId(), 'groupId' => $entity->getOption()->getId()]);
     }
 }