/** * @param ListProduct $listProduct * @param ListProduct $product */ public function assignProductData(ListProduct $listProduct, ListProduct $product) { $product->setShippingFree($listProduct->isShippingFree()); $product->setMainVariantId($listProduct->getMainVariantId()); $product->setAllowsNotification($listProduct->allowsNotification()); $product->setHighlight($listProduct->highlight()); $product->setUnit($listProduct->getUnit()); $product->setTax($listProduct->getTax()); $product->setPrices($listProduct->getPrices()); $product->setManufacturer($listProduct->getManufacturer()); $product->setCover($listProduct->getCover()); $product->setCheapestPrice($listProduct->getCheapestPrice()); $product->setName($listProduct->getName()); $product->setAdditional($listProduct->getAdditional()); $product->setCloseouts($listProduct->isCloseouts()); $product->setEan($listProduct->getEan()); $product->setHeight($listProduct->getHeight()); $product->setKeywords($listProduct->getKeywords()); $product->setLength($listProduct->getLength()); $product->setLongDescription($listProduct->getLongDescription()); $product->setMinStock($listProduct->getMinStock()); $product->setReleaseDate($listProduct->getReleaseDate()); $product->setShippingTime($listProduct->getShippingTime()); $product->setShortDescription($listProduct->getShortDescription()); $product->setStock($listProduct->getStock()); $product->setWeight($listProduct->getWeight()); $product->setWidth($listProduct->getWidth()); $product->setPriceGroup($listProduct->getPriceGroup()); $product->setCreatedAt($listProduct->getCreatedAt()); $product->setPriceRules($listProduct->getPriceRules()); $product->setCheapestPriceRule($listProduct->getCheapestPriceRule()); $product->setManufacturerNumber($listProduct->getManufacturerNumber()); $product->setMetaTitle($listProduct->getMetaTitle()); $product->setTemplate($listProduct->getTemplate()); $product->setHasConfigurator($listProduct->hasConfigurator()); $product->setSales($listProduct->getSales()); $product->setHasEsd($listProduct->hasEsd()); $product->setEsd($listProduct->getEsd()); $product->setIsPriceGroupActive($listProduct->isPriceGroupActive()); $product->setBlockedCustomerGroupIds($listProduct->getBlockedCustomerGroupIds()); $product->setVoteAverage($listProduct->getVoteAverage()); $product->setHasAvailableVariant($listProduct->hasAvailableVariant()); $product->setCheapestUnitPrice($listProduct->getCheapestUnitPrice()); $product->setFallbackPriceCount($listProduct->getFallbackPriceCount()); $product->setCustomerPriceCount($listProduct->getCustomerPriceCount()); foreach ($listProduct->getAttributes() as $name => $attribute) { $product->addAttribute($name, $attribute); } foreach ($listProduct->getStates() as $state) { $product->addState($state); } }
/** * Helper function which assigns the shopware article * data to the product. (data of s_articles) * * @param Struct\ListProduct $product * @param $data */ private function assignProductData(Struct\ListProduct $product, $data) { $product->setName($data['__product_name']); $product->setShortDescription($data['__product_description']); $product->setLongDescription($data['__product_description_long']); $product->setCloseouts((bool) $data['__product_laststock']); $product->setMetaTitle($data['__product_metaTitle']); $product->setHasProperties($data['__product_filtergroupID'] > 0); $product->setHighlight((bool) $data['__product_topseller']); $product->setAllowsNotification((bool) $data['__product_notification']); $product->setKeywords($data['__product_keywords']); $product->setTemplate($data['__product_template']); $product->setHasConfigurator($data['__product_configurator_set_id'] > 0); $product->setHasEsd((bool) $data['__product_has_esd']); $product->setIsPriceGroupActive((bool) $data['__product_pricegroupActive']); $product->setSales((int) $data['__topSeller_sales']); $product->setShippingFree((bool) $data['__variant_shippingfree']); $product->setStock((int) $data['__variant_instock']); $product->setManufacturerNumber($data['__variant_suppliernumber']); $product->setMainVariantId((int) $data['__product_main_detail_id']); if ($data['__variant_shippingtime']) { $product->setShippingTime($data['__variant_shippingtime']); } elseif ($data['__product_shippingtime']) { $product->setShippingTime($data['__product_shippingtime']); } if ($data['__variant_releasedate']) { $product->setReleaseDate(new \DateTime($data['__variant_releasedate'])); } if ($data['__product_datum']) { $product->setCreatedAt(new \DateTime($data['__product_datum'])); } $product->setAdditional($data['__variant_additionaltext']); $product->setEan($data['__variant_ean']); $product->setHeight((double) $data['__variant_height']); $product->setLength((double) $data['__variant_length']); $product->setMinStock((int) $data['__variant_stockmin']); $product->setWeight((double) $data['__variant_weight']); $product->setWidth((double) $data['__variant_width']); $customerGroups = explode('|', $data['__product_blocked_customer_groups']); $customerGroups = array_filter($customerGroups); $product->setBlockedCustomerGroupIds($customerGroups); $product->setHasAvailableVariant($data['__product_has_available_variants'] > 0); $product->setFallbackPriceCount($data['__product_fallback_price_count']); if (array_key_exists('__product_custom_price_count', $data)) { $product->setCustomerPriceCount($data['__product_custom_price_count']); } else { $product->setCustomerPriceCount($data['__product_fallback_price_count']); } }