コード例 #1
0
 public function createProducts($products, ProductContext $context, Category $category)
 {
     $articles = parent::createProducts($products, $context, $category);
     Shopware()->Container()->get('shopware_searchdbal.search_indexer')->build();
     Shopware()->Container()->get('cache')->clean('all', array('Shopware_Modules_Search'));
     return $articles;
 }
コード例 #2
0
 /**
  * @param $number
  * @param \Shopware\Models\Category\Category $category
  * @param ProductContext $context
  * @param array $data
  * @return array
  */
 protected function getProduct($number, ProductContext $context, Category $category = null, $data = array('inStock' => 0, 'minPurchase' => 1))
 {
     $product = parent::getProduct($number, $context, $category);
     $product['lastStock'] = true;
     $product['mainDetail'] = array_merge($product['mainDetail'], $data);
     return $product;
 }
コード例 #3
0
 protected function getProduct($number, ProductContext $context, Category $category = null)
 {
     $product = parent::getProduct($number, $context, $category);
     $configurator = $this->helper->getConfigurator($context->getCurrentCustomerGroup(), $number, array('Farbe' => array('rot', 'blau', 'grün'), 'Größe' => array('L', 'M', 'S'), 'Form' => array('rund', 'eckig', 'oval')));
     $product = array_merge($product, $configurator);
     return $product;
 }
コード例 #4
0
 /**
  * @param $number
  * @param \Shopware\Models\Category\Category $category
  * @param Supplier $manufacturer
  * @param ProductContext $context
  * @return array
  */
 protected function getProduct($number, ProductContext $context, Category $category = null, Supplier $manufacturer = null)
 {
     $product = parent::getProduct($number, $context, $category);
     if ($manufacturer) {
         $product['supplierId'] = $manufacturer->getId();
     }
     return $product;
 }
コード例 #5
0
 protected function getProduct($number, ProductContext $context, Category $category = null, $imageCount)
 {
     $data = parent::getProduct($number, $context, $category);
     $data['images'][] = $this->helper->getImageData('sasse-korn.jpg', array('main' => 1));
     for ($i = 0; $i < $imageCount - 2; $i++) {
         $data['images'][] = $this->helper->getImageData();
     }
     return $data;
 }
コード例 #6
0
 /**
  * @param $number
  * @param ProductContext $context
  * @param \Shopware\Models\Category\Category $category
  * @param array $prices
  * @return array
  */
 protected function getProduct($number, ProductContext $context, Category $category = null, $prices = array())
 {
     $product = parent::getProduct($number, $context, $category);
     if (!empty($prices)) {
         $product['mainDetail']['prices'] = array();
         foreach ($prices as $key => $price) {
             $product['mainDetail']['prices'] = array_merge($product['mainDetail']['prices'], $this->helper->getGraduatedPrices($key, $price));
         }
     }
     return $product;
 }
コード例 #7
0
 /**
  * @param $number
  * @param \Shopware\Models\Category\Category $category
  * @param ProductContext $context
  * @param $prices
  * @return array
  */
 protected function getProduct($number, ProductContext $context, Category $category = null, $prices = array())
 {
     $product = parent::getProduct($number, $context, $category);
     $product['mainDetail']['prices'] = array();
     foreach ($prices as $key => $price) {
         if ($key === $context->getCurrentCustomerGroup()->getKey()) {
             $customerGroup = $context->getCurrentCustomerGroup()->getKey();
         } else {
             $customerGroup = $context->getFallbackCustomerGroup()->getKey();
         }
         $product['mainDetail']['prices'][] = array('from' => 1, 'to' => 'beliebig', 'price' => $price, 'customerGroupKey' => $customerGroup);
     }
     return $product;
 }
コード例 #8
0
 protected function createProduct($number, ProductContext $context, Category $category, $additionally)
 {
     if ($additionally['createVariants'] == true) {
         $fourth = $this->getProduct('fourth', $context, $category);
         $configurator = $this->helper->getConfigurator($context->getCurrentCustomerGroup(), 'fourth');
         $fourth = array_merge($fourth, $configurator);
         foreach ($fourth['variants'] as &$variant) {
             $variant['inStock'] = 4;
             $variant['minPurchase'] = 3;
         }
         return $this->helper->createArticle($fourth);
     } else {
         return parent::createProduct($number, $context, $category, $additionally);
     }
 }
コード例 #9
0
 protected function createProduct($number, ProductContext $context, Category $category, $additionally)
 {
     $article = parent::createProduct($number, $context, $category, $additionally);
     $this->helper->createVotes($article->getId(), $additionally);
     return $article;
 }
コード例 #10
0
 /**
  * @param $number
  * @param \Shopware\Models\Category\Category $category
  * @param ProductContext $context
  * @param bool $shippingFree
  * @return array
  */
 protected function getProduct($number, ProductContext $context, Category $category = null, $shippingFree = true)
 {
     $product = parent::getProduct($number, $context, $category);
     $product['mainDetail']['shippingFree'] = $shippingFree;
     return $product;
 }
コード例 #11
0
 protected function search($products, $expectedNumbers, $category = null, $conditions = array(), $facets = array(), $sortings = array(), $context = null)
 {
     $result = parent::search($products, $expectedNumbers, $category, $conditions, $facets, $sortings, $context);
     $this->assertSearchResultSorting($result, $expectedNumbers);
     return $result;
 }
コード例 #12
0
 protected function getProduct($number, ProductContext $context, Category $category = null)
 {
     $data = parent::getProduct($number, $context, $category);
     $data['mainDetail']['prices'] = array_merge($data['mainDetail']['prices'], $this->helper->getGraduatedPrices($context->getFallbackCustomerGroup()->getKey(), -20));
     return $data;
 }
コード例 #13
0
 protected function getProduct($number, ProductContext $context, Category $category = null, $properties = array())
 {
     $product = parent::getProduct($number, $context, $category);
     $product = array_merge($product, $properties);
     return $product;
 }
コード例 #14
0
 protected function getProduct($number, ProductContext $context, Category $category = null, $attribute = array('attr1' => 10))
 {
     $product = parent::getProduct($number, $context, $category);
     $product['mainDetail']['attribute'] = $attribute;
     return $product;
 }
コード例 #15
0
 protected function getProduct($number, ProductContext $context, Category $category = null)
 {
     $data = parent::getProduct($number, $context, $category);
     return $this->helper->createArticle($data);
 }
コード例 #16
0
ファイル: DownloadTest.php プロジェクト: GerDner/luck-docker
 /**
  * @param $number
  * @param ProductContext $context
  * @param \Shopware\Models\Category\Category $category
  * @return Article
  */
 protected function getProduct($number, ProductContext $context, Category $category = null)
 {
     $product = parent::getProduct($number, $context, $category);
     $product['downloads'] = array(array('name' => 'first-download', 'size' => 100, 'file' => '/var/www/first.txt', 'attribute' => array('id' => 20000)), array('name' => 'second-download', 'size' => 200, 'file' => '/var/www/second.txt', 'attribute' => array('id' => 20000)));
     return $product;
 }
コード例 #17
0
 protected function getProduct($number, ProductContext $context, Category $category = null, $additionally)
 {
     return parent::getProduct($number, $context, $additionally);
 }