/** * @access private * Ecrit les urls des images du catalogue (Google Image sitemap) */ private function writeImagesCatalog($idlang) { // instance la classe $sitemap = new magixcjquery_xml_sitemap(); // Les images des catégories du catalogue sur la racine de celui-ci foreach (parent::c_catalog_category($idlang) as $data) { if ($data['catimg'] != 0) { $sitemap->writeMakeNodeImage(magixcjquery_html_helpersHtml::getUrl() . magixglobal_model_rewrite::filter_catalog_root_url($data['iso'], true), 'img_c', magixcjquery_html_helpersHtml::getUrl() . '/upload/catalogimg/category/', parent::s_catalog_category($data['idlang'])); } } //Les images des sous catégories du catalogue de chaque catégorie foreach (parent::s_catalog_category($idlang) as $data) { $count = parent::c_catalog_subcategory($data['idclc']); if ($count['subcatimg'] != 0) { $uri_cat = magixglobal_model_rewrite::filter_catalog_category_url($data['iso'], $data['pathclibelle'], $data['idclc'], true); $sitemap->writeMakeNodeImage(magixcjquery_html_helpersHtml::getUrl() . $uri_cat, 'img_s', magixcjquery_html_helpersHtml::getUrl() . '/upload/catalogimg/subcategory/', parent::s_catalog_subcategory_images_by_lang($data['idclc'])); } } // Les images des produits du catalogue foreach (parent::s_catalog_sitemap($idlang) as $data) { $uri = magixglobal_model_rewrite::filter_catalog_product_url($data['iso'], $data['pathclibelle'], $data['idclc'], $data['pathslibelle'], $data['idcls'], $data['urlcatalog'], $data['idproduct'], true); if ($data['imgcatalog'] != null) { $sitemap->writeMakeNodeImage(magixcjquery_html_helpersHtml::getUrl() . $uri, $data['imgcatalog'], magixcjquery_html_helpersHtml::getUrl() . '/upload/catalogimg/product/'); } } }
/** * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre * @param $row * @param $current * @return array|null * @todo revoir le nommage de 'current', lui préférant 'active' */ public function setItemData($row, $current) { $ModelImagepath = new magixglobal_model_imagepath(); $ModelTemplate = new frontend_model_template(); $ModelRewrite = new magixglobal_model_rewrite(); $data = null; if ($row != null) { // *** Product if (isset($row['titlecatalog'])) { $subcat['id'] = isset($row['idcls']) ? $row['idcls'] : null; $subcat['name'] = isset($row['pathslibelle']) ? $row['pathslibelle'] : null; if (isset($row['imgcatalog'])) { $data['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $row['imgcatalog'], 'levelmod' => '')), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'medium/' . $row['imgcatalog'], 'levelmod' => '')), 'large' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'product/' . $row['imgcatalog'], 'levelmod' => ''))); } $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/product-default.png')); $data['url'] = $ModelRewrite->filter_catalog_product_url($row['iso'], $row['pathclibelle'], $row['idclc'], $subcat['name'], $subcat['id'], $row['urlcatalog'], $row['idproduct'], true); $data['active'] = false; if (is_array($current)) { $data['active'] = (isset($current['product']['id']) and $current['product']['id'] == $row['idproduct']) ? true : false; } elseif ($current === true) { $data['active'] = true; } $data['id'] = $row['idproduct']; $data['name'] = $row['titlecatalog']; $data['price'] = $row['price']; $data['content'] = $row['desccatalog']; // *** Subcategory } elseif (isset($row['slibelle'])) { $data['active'] = false; if (is_array($current) and isset($current['subcategory']['id'])) { $data['active'] = $current['subcategory']['id'] == $row['idcls'] ? true : false; } if (isset($row['img_s'])) { $data['imgSrc'] = array(); $data['imgSrc']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => $row['img_s'], 'levelmod' => 'subcategory')); $data['imgSrc']['medium'] = $data['imgSrc']['small']; $data['imgSrc']['large'] = $data['imgSrc']['small']; } $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/subcategory-default.png')); $data['url'] = $ModelRewrite->filter_catalog_subcategory_url($row['iso'], $row['pathclibelle'], $row['idclc'], $row['pathslibelle'], $row['idcls'], true); $data['id'] = $row['idcls']; $data['name'] = $row['slibelle']; $data['content'] = $row['s_content'] != '' ? $row['s_content'] : null; // *** Category } elseif (isset($row['clibelle'])) { $data['active'] = false; if (is_array($current) and isset($current['category']['id'])) { $data['active'] = $current['category']['id'] == $row['idclc'] ? true : false; } if (isset($row['img_c'])) { $data['imgSrc'] = array(); $data['imgSrc']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => $row['img_c'], 'levelmod' => 'category')); // I know it's like cheat $data['imgSrc']['medium'] = $data['imgSrc']['small']; $data['imgSrc']['large'] = $data['imgSrc']['small']; } $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/category-default.png')); $data['url'] = $ModelRewrite->filter_catalog_category_url($row['iso'], $row['pathclibelle'], $row['idclc'], true); $data['id'] = $row['idclc']; $data['name'] = $row['clibelle']; $data['content'] = $row['c_content'] != '' ? $row['c_content'] : null; // *** Micro-gallery (product page) } elseif (isset($row['idmicro'])) { $data['id'] = $row['idmicro']; $data['img_src']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $row['imgcatalog'], 'levelmod' => 'galery')); $data['img_src']['medium'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'maxi/' . $row['imgcatalog'], 'levelmod' => 'galery')); } return $data; } }
/** * Retourne l'url de la catégorie * @param $data */ private function json_uri_category($data) { if ($data != null) { $url = magixglobal_model_rewrite::filter_catalog_category_url($data['iso'], $data['pathclibelle'], $data['idclc'], true); $categoryinput = '{"categorylink":' . json_encode(magixcjquery_url_clean::rplMagixString($url)) . '}'; print $categoryinput; } }