protected function getCategoryArray($id_product) { /* $controlFraude = new TPProductoControlFraude($id_product); return $controlFraude->codigo_producto; */ $controlFraude = new Product($id_product); $categories = $controlFraude->getDefaultCategory(); $category_id = $categories[0]; $category = new Category($category_id); $name = $category->getName(); if (empty($name)) { return "default"; } return $name; }
private function _isExportProduct($idProduct, $id_category = null) { $products = Tools::jsonDecode(Configuration::get('GOINTERPAY_EXPORT_PRODUCT')); if (!is_array($products)) { return false; } if (!$id_category) { $product = new Product((int) $idProduct); } $id_category = $id_category ? $id_category : $product->getDefaultCategory(); if (in_array("[{$id_category},{$idProduct}]", $products)) { return true; } return false; }
/** * @param \Product $product * @param bool $ids * * @return string * @throws \Exception * @author Panagiotis Vagenas <*****@*****.**> * @since 150213 */ protected function getProductCategories(\Product &$product, $ids = false) { $maxDepth = 3; // TODO Implement in options or remove $categories = array(); if ($this->Options->getValue('map_category') == 1) { $info = \Tag::getProductTags($product->id); if ($info && !isset($info[$this->defaultLang])) { $categories = (array) $info[$this->defaultLang]; } } else { $defaultCat = $product->getDefaultCategory(); if ($ids) { return $defaultCat; } $category = new \Category($defaultCat); do { array_push($categories, $ids ? $category->id : $category->name[$this->defaultLang]); $category = new \Category($category->id_parent); } while ($category->id_parent && !$category->is_root_category); $categories = array_reverse($categories); } return is_array($categories) ? implode($ids ? ' - ' : '->', $categories) : $categories; }