/**
  * @param ChannelInterface $channel
  * @param string $configuration
  * @param array $data
  *
  * @return FormInterface
  */
 private function createConfigurationFieldForChannel(ChannelInterface $channel, $configuration, array $data)
 {
     $config = ['auto_initialize' => false, 'label' => $channel->getName(), 'currency' => $channel->getBaseCurrency()->getCode()];
     $data = empty($data) ? $data : $data[$channel->getCode()];
     return $this->factory->createNamed($channel->getCode(), $configuration, $data, $config);
 }
예제 #2
0
 /**
  * @When I change my current channel to :channel
  */
 public function iChangeMyCurrentChannelTo(ChannelInterface $channel)
 {
     $this->prepareSessionIfNeeded();
     $this->minkSession->setCookie('_channel_code', $channel->getCode());
 }
 /**
  * {@inheritdoc}
  */
 public function getPricingConfigurationForChannelAndCurrencyCalculator(ChannelInterface $channel, CurrencyInterface $currency)
 {
     $priceConfigurationElement = $this->getElement('pricing_configuration');
     $priceElement = $priceConfigurationElement->find('css', sprintf('label:contains("%s %s")', $channel->getCode(), $currency->getCode()))->getParent();
     return $priceElement->find('css', 'input')->getValue();
 }
예제 #4
0
 /**
  * @Given /^(it) has price ("[^"]+") for ("[^"]+" channel) and "([^"]+)" currency$/
  */
 public function itHasPriceForChannelAndCurrency(ProductInterface $product, $price, ChannelInterface $channel, $currency)
 {
     /** @var ProductVariantInterface $variant */
     $variant = $this->defaultVariantResolver->getVariant($product);
     $pricingConfiguration = $variant->getPricingConfiguration();
     $pricingConfiguration[$channel->getCode()][$currency] = $price;
     $variant->setPricingConfiguration($pricingConfiguration);
     $this->objectManager->flush();
 }
 /**
  * @Then /^(this channel) name should be "([^"]+)"$/
  * @Then /^(this channel) should still be named "([^"]+)"$/
  */
 public function thisChannelNameShouldBe(ChannelInterface $channel, $channelName)
 {
     $this->iWantToBrowseChannels();
     Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $channel->getCode(), 'name' => $channelName]), sprintf('Channel name %s has not been assigned properly.', $channelName));
 }
예제 #6
0
 /**
  * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee per unit for ("[^"]+" channel) and ("[^"]+") for ("[^"]+" channel)$/
  */
 public function storeHasShippingMethodWithFeePerUnitForChannels($shippingMethodName, $firstFee, ChannelInterface $firstChannel, $secondFee, ChannelInterface $secondChannel)
 {
     $configuration = [];
     $configuration[$firstChannel->getCode()] = ['amount' => $firstFee];
     $configuration[$secondChannel->getCode()] = ['amount' => $secondFee];
     $this->createShippingMethod($shippingMethodName, null, null, null, 'en', $configuration, DefaultCalculators::PER_UNIT_RATE, true, false, [$firstChannel, $secondChannel]);
 }
예제 #7
0
 /**
  * @param PromotionInterface $promotion
  * @param int $discount
  * @param array $configuration
  * @param PromotionRuleInterface|null $rule
  * @param ChannelInterface|null $channel
  */
 private function createFixedPromotion(PromotionInterface $promotion, $discount, array $configuration = [], PromotionRuleInterface $rule = null, ChannelInterface $channel = null)
 {
     $channelCode = null !== $channel ? $channel->getCode() : $this->sharedStorage->get('channel')->getCode();
     $this->persistPromotion($promotion, $this->actionFactory->createFixedDiscount($discount, $channelCode), $configuration, $rule);
 }
예제 #8
0
 /**
  * @Then /^(that channel) should use (that theme)$/
  */
 public function channelShouldUseTheme(ChannelInterface $channel, ThemeInterface $theme)
 {
     $this->channelIndexPage->open();
     Assert::same($this->channelIndexPage->getUsedThemeName($channel->getCode()), $theme->getName());
 }
예제 #9
0
 /**
  * @Then /^(that channel) should use (that theme)$/
  */
 public function channelShouldUseTheme(ChannelInterface $channel, ThemeInterface $theme)
 {
     $this->channelIndexPage->open();
     expect($this->channelIndexPage->getUsedThemeName($channel->getCode()))->toBe($theme->getName());
 }
예제 #10
0
 /**
  * @Given /^the store has "([^"]+)" shipping method with ("[^"]+") fee per unit for ("[^"]+" channel) and ("[^"]+") for ("[^"]+" channel)$/
  */
 public function storeHasShippingMethodWithFeePerUnitForChannels($shippingMethodName, $firstFee, ChannelInterface $firstChannel, $secondFee, ChannelInterface $secondChannel)
 {
     $configuration = [];
     $configuration[$firstChannel->getCode()] = ['amount' => $firstFee];
     $configuration[$secondChannel->getCode()] = ['amount' => $secondFee];
     $this->saveShippingMethod($this->shippingMethodExampleFactory->create(['name' => $shippingMethodName, 'enabled' => true, 'calculator' => ['type' => DefaultCalculators::PER_UNIT_RATE, 'configuration' => $configuration], 'channels' => [$firstChannel, $secondChannel]]));
 }