UnknownPromotionDiscountTypeException example

case PromotionDiscountEntity::TYPE_FIXED_UNIT:
                $promotionValue = -abs($this->getCurrencySpecificValue($discount$discount->getValue()$currencyId$currencyFactor));
                $promotionDefinition = new AbsolutePriceDefinition($promotionValue$targetFilter);

                break;

            default:
                $promotionDefinition = null;
        }

        if ($promotionDefinition === null) {
            throw new UnknownPromotionDiscountTypeException($discount);
        }

        // build our discount line item         // and make sure it has everything as dynamic content.         // this is necessary for the recalculation process.         $promotionItem = new LineItem($discount->getId(), PromotionProcessor::LINE_ITEM_TYPE);
        $promotionItem->setLabel($promotion->getTranslation('name'));
        $promotionItem->setDescription($promotion->getTranslation('name'));
        $promotionItem->setGood(false);
        $promotionItem->setRemovable(true);
        $promotionItem->setPriceDefinition($promotionDefinition);

        
Home | Imprint | This part of the site doesn't use cookies.