Exemplo n.º 1
0
 /**
  * @param ImportProduct $productToAdd
  * @param bool $synchronizeImages
  * @throws Exception
  */
 private function addFromSource($productToAdd, $synchronizeImages = true)
 {
     $thumbnail = null;
     $images = array();
     if ($synchronizeImages) {
         $this->getImages($productToAdd, $images, $thumbnail);
         $productToAdd->setDescription($this->updateDescriptionImages($productToAdd->getId(), $productToAdd->getDescription()));
     }
     /// Preparing name, korean name, link and description
     $product_description = array();
     foreach ($this->load->model('localisation/language')->getLanguages() as $language) {
         $product_description[$language['language_id']] = array('name' => $productToAdd->getName(), 'description' => null);
     }
     $productId = $this->modelCatalogProduct->addProduct(array('date_available' => date('Y-m-d'), 'image_description' => $productToAdd->getDescription(), 'height' => null, 'image' => $thumbnail, 'length' => null, 'length_class_id' => 1, 'location' => null, 'manufacturer_id' => $productToAdd->getSourceSite()->getDefaultManufacturer()->getId(), 'meta_keywords' => null, 'meta_description' => null, 'minimum' => $productToAdd->getMinimalAmount(), 'model' => $productToAdd->getSourceProductId(), 'points' => null, 'price' => $productToAdd->getSourcePrice()->getPrice() * $productToAdd->getSourceSite()->getRegularCustomerPriceRate(), 'product_category' => $productToAdd->getCategories(), 'product_description' => $product_description, 'product_image' => $images, 'product_option' => $this->setProductOption($productToAdd), 'product_special' => $this->getSpecialPrices($productToAdd), 'product_store' => $productToAdd->getSourceSite()->getStores(), 'product_tag' => null, 'seo_title' => null, 'seo_h1' => null, 'shipping' => 1, 'sku' => null, 'sort_order' => null, 'status' => 0, 'stock_status_id' => 8, 'subtract' => null, 'supplier_id' => $productToAdd->getSourceSite()->getDefaultSupplier()->getId(), 'tax_class' => null, 'upc' => null, 'user_id' => 0, 'weight' => $productToAdd->getWeight(), 'weight_class_id' => 1, 'width' => null, 'koreanName' => $productToAdd->getName(), 'supplierUrl' => $productToAdd->getSourceUrl()));
     ImportProductDAO::getInstance()->pairImportedProduct($productToAdd->getId(), $productId);
 }