コード例 #1
0
 /**
  * @param int $shopId
  * @param null|int $currencyId
  * @param null|int $customerGroupKey
  * @return Struct\ProductContext
  */
 public function createProductContext($shopId, $currencyId = null, $customerGroupKey = null)
 {
     $shopContext = $this->createShopContext($shopId, $currencyId, $customerGroupKey);
     $locationContext = new Struct\LocationContext(null, null, null, null);
     $rules = $this->createTaxRulesStruct($shopContext, $locationContext->getArea(), $locationContext->getCountry(), $locationContext->getState());
     $priceGroups = $this->priceGroupDiscountGateway->getPriceGroups($shopContext->getCurrentCustomerGroup(), $shopContext);
     return Struct\ProductContext::createFromContexts($shopContext, $rules, $priceGroups);
 }
コード例 #2
0
ファイル: Context.php プロジェクト: GerDner/luck-docker
 /**
  * @param ProductContext  $productContext
  * @param LocationContext $locationContext
  * @return Context
  */
 public static function createFromContexts(ProductContext $productContext, LocationContext $locationContext)
 {
     return new self($productContext->getBaseUrl(), $productContext->getShop(), $productContext->getCurrency(), $productContext->getCurrentCustomerGroup(), $productContext->getFallbackCustomerGroup(), $productContext->getTaxRules(), $productContext->getPriceGroups(), $locationContext->getArea(), $locationContext->getCountry(), $locationContext->getState());
 }
コード例 #3
0
ファイル: TestCase.php プロジェクト: GerDner/luck-docker
 /**
  * @param $number
  * @param ProductContext $context
  * @param Category $category
  * @return array
  */
 protected function getProduct($number, ProductContext $context, Category $category = null)
 {
     $product = $this->helper->getSimpleProduct($number, array_shift($context->getTaxRules()), $context->getCurrentCustomerGroup());
     $product['categories'] = [['id' => $context->getShop()->getCategory()->getId()]];
     if ($category) {
         $product['categories'] = array(array('id' => $category->getId()));
     }
     return $product;
 }