presta_man_neewbee Posted March 16, 2011 Share Posted March 16, 2011 salutje cherche à avoir le même rendu que product-list.tpl mais depuis ma catégorieon clique sur la catégorie qui contient des sous catégoriesje cherche à les afficher comme les une en dessous des autres avec leurs produits associésj'ai pu modifié le fichier categorie.php et assigner un array contenant les sous catégories avec leurs produits(cf.getProducts(attr))l'affichage est correct mais je n'arrive qu'à afficher les noms et description.ma question est:comment récupérer TOUS les attributs du produit ??categorie.php $category->name = Category::hideCategoryPosition($category->name); $category->description = $category->description; $subCategories = $category->getSubCategories(intval($cookie->id_lang)); $smarty->assign('category', $category); if (Db::getInstance()->numRows()) $smarty->assign('subcategories', $subCategories); $smarty->assign(array( 'subcategories_nb_total' => sizeof($subCategories), 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2))); if ($category->id != 1) { $nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true); include(dirname(__FILE__).'/pagination.php'); $smarty->assign('nb_products', $nbProducts); $cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay); } foreach($subCategories as $subCat) { $tmp_cat_obj = new Category($subCat['id_category'], $cookie->id_lang); $subProducts[$subCat['id_category']] = $tmp_cat_obj->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay); } $smarty->assign('subProducts', $subProducts); $smarty->assign(array( 'products' => (isset($cat_products) AND $cat_products) ? $cat_products : NULL, 'id_category' => intval($category->id), 'id_category_parent' => intval($category->id_parent), 'return_category_name' => Tools::safeOutput(Category::hideCategoryPosition($category->name)), 'path' => Tools::getPath(intval($category->id), $category->name), 'homeSize' => Image::getSize('home') )); category.tpl > </pre> <ul> {foreach from=$subcategories item=subcat name=subcategories} </ul> <h2>{$subcat.name|upper}</h2> <br>{assign var='tmp_prod' value=$subProducts[$subcat.id_category]}<br>{foreach from=$tmp_prod item=prod name=tmp_prod}<br> {$prod.name}<br>{/foreach}<br>{/foreach} <br Link to comment Share on other sites More sharing options...
presta_man_neewbee Posted March 16, 2011 Author Share Posted March 16, 2011 petit UP !zutaprès moult recherches je vois pas comment faire Link to comment Share on other sites More sharing options...
hulk Posted December 5, 2011 Share Posted December 5, 2011 moi aussi ça m’intéresse cette manipulation. je n'ai que les images et les prix qui sont affichés en FO. up plz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now