コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function create(array $options = [])
 {
     $options = $this->optionsResolver->resolve($options);
     /** @var PromotionRuleInterface $promotionRule */
     $promotionRule = $this->promotionRuleFactory->createNew();
     $promotionRule->setType($options['type']);
     $promotionRule->setConfiguration($options['configuration']);
     return $promotionRule;
 }
コード例 #2
0
 /**
  * @Given /^([^"]+) gives ("[^"]+%") off on every product (classified as "[^"]+" or "[^"]+") if order contains any product (classified as "[^"]+" or "[^"]+")$/
  */
 public function itGivesOffOnEveryProductClassifiedAsOrIfOrderContainsAnyProductClassifiedAsOr(PromotionInterface $promotion, $discount, array $discountTaxons, array $targetTaxons)
 {
     $discountTaxonsCodes = [$discountTaxons[0]->getCode(), $discountTaxons[1]->getCode()];
     $targetTaxonsCodes = [$targetTaxons[0]->getCode(), $targetTaxons[1]->getCode()];
     $rule = $this->ruleFactory->createTaxon($targetTaxonsCodes);
     $this->createUnitPercentagePromotion($promotion, $discount, $this->getTaxonFilterConfiguration($discountTaxonsCodes), $rule);
 }
コード例 #3
0
 /**
  * @Given /^([^"]+) gives ("[^"]+%") off the order for customers from ("[^"]*" group)$/
  */
 public function thePromotionGivesOffTheOrderForCustomersFromGroup(PromotionInterface $promotion, $discount, CustomerGroupInterface $customerGroup)
 {
     $rule = $this->ruleFactory->createNew();
     $rule->setType(CustomerGroupRuleChecker::TYPE);
     $rule->setConfiguration(['group_code' => $customerGroup->getCode()]);
     $this->createPercentagePromotion($promotion, $discount, [], $rule);
 }
コード例 #4
0
ファイル: PromotionContext.php プロジェクト: loic425/Sylius
 /**
  * @Given /^([^"]+) gives ("(?:€|£|\$)[^"]+") off if order contains (?:a|an) ("[^"]+" product)$/
  */
 public function thePromotionGivesOffIfOrderContainsProducts(PromotionInterface $promotion, $discount, ProductInterface $product)
 {
     $rule = $this->ruleFactory->createContainsProduct($product->getCode());
     $this->createFixedPromotion($promotion, $discount, [], $rule);
 }