/** * @param null $limit * @param null $offset * @param array $uids * @return array */ public function getItems($limit = null, $offset = null, array $uids = array()) { $products = array(); foreach ($this->getProductIds($limit, $offset, $uids) as $product) { /* * prepare data */ if (version_compare(_PS_VERSION_, '1.5.0.0', '<')) { $this->currentProduct = new Product($product['id_product'], true, $this->getPlugin()->getLanguageId()); } else { $this->currentProduct = new Product($product['id_product'], true, $this->getPlugin()->getLanguageId(), $this->getPlugin()->getContext()->shop->id); } $resultProduct = get_object_vars($this->currentProduct); $this->currentAdditionalInfo = array(); $this->addAdditionalInfo('currency', $this->getPlugin()->getContext()->currency->iso_code); $this->addAdditionalInfo('deeplink', $this->prepareDeeplink()); $this->addAdditionalInfo('images', $this->prepareImages($this->currentProduct->getImages($this->getPlugin()->getLanguageId()))); $this->addAdditionalInfo('price', $this->preparePrice()); $this->addAdditionalInfo('categories', $this->prepareCategories()); $this->addAdditionalInfo('shipping', $this->prepareShipping()); $this->addAdditionalInfo('properties', $this->prepareProperties()); $this->addAdditionalInfo('stock', $this->prepareStock()); $this->addAdditionalInfo('identifiers', $this->prepareIdentifiers()); $this->addAdditionalInfo('tags', $this->prepareTags()); $this->addAdditionalInfo('attribute_groups', $this->prepareAttributeGroups()); $this->addAdditionalInfo('inputs', $this->prepareInputs()); $this->addAdditionalInfo('description', $this->prepareDescription()); $this->addAdditionalInfo('promotion', $this->preparePromotion()); $this->addAdditionalInfo('tax_percent', $this->prepareTaxPercent()); $this->addAdditionalInfo('tax_class', $this->prepareTaxClass()); $this->addAdditionalInfo('relations', $this->prepareRelations()); /** * prepare children */ $this->addAdditionalInfo('children', $this->prepareChildren()); /** * manufacturer */ $manufacturerItem = new Shopgate_Model_Catalog_Manufacturer(); $manufacturerItem->setUid($this->currentProduct->id_manufacturer); $manufacturerItem->setTitle($this->currentProduct->manufacturer_name); $this->addAdditionalInfo('manufacturer', $manufacturerItem); /** * visibility */ $visibilityItem = new Shopgate_Model_Catalog_Visibility(); $visibilityItem->setLevel($this->mapVisibility($this->currentProduct->visibility)); $this->addAdditionalInfo('visibility', $visibilityItem); $resultProduct['_additional_info'] = $this->currentAdditionalInfo; $resultProduct['id_product'] = $resultProduct['id']; $products[] = $resultProduct; } return $products; }
/** * set manufacturer */ public function setManufacturer() { $title = $this->_getExportHelper()->getManufacturer($this->item); if (!empty($title)) { $manufacturer = new Shopgate_Model_Catalog_Manufacturer(); $manufacturer->setUid($this->item->getManufacturer()); $manufacturer->setTitle($title); $manufacturer->setItemNumber(false); parent::setManufacturer($manufacturer); } }