silberstern Posted October 28, 2012 Share Posted October 28, 2012 (edited) Salut, Caut de ceva vreme solutie la o problema si nu am reusit sa o gasesc. Poate are cineva o idee. Am un shop caruia i-am duplicat modulul HomeFeatured. Toate bune si frumoase. Modulul este adaugat si vizibil in shop. Am modificat si metoda function hookHome($params) { global $smarty; $category = new Category(80, (int)Configuration::get('PS_LANG_DEFAULT')); $nb = (int)Configuration::get('HOME_FEATURED1_NBR'); $smarty->assign(array( 'products' => $category->getProducts((int)$params['cookie']->id_lang, 80, ($nb ? $nb : 10)), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize('home'))); return $this->display(__FILE__, 'homefeatured1.tpl'); } pentru a afisa produsele dintr-o anumita categorie. Problema caruia nu i-am gasit inca raspuns este legata de faptul ca nu sunt afisate produsele din anumite categorii in acest nou modul si nu inteleg unde gresesc. Am verificat definitia categoriilor si au acelsi nivel de acces. Mentionez ca exista produse in toate categoriile. Multumesc. Edited October 28, 2012 by silberstern (see edit history) Link to comment Share on other sites More sharing options...
valentin.g Posted October 29, 2012 Share Posted October 29, 2012 ce vrei tu nu se face doar modificand acolo asa iti afiseaza produsele care sunt definite si in categoria 80 Link to comment Share on other sites More sharing options...
silberstern Posted October 29, 2012 Author Share Posted October 29, 2012 Multumesc pentru raspuns. Ai putea sa imi dai mai multe directii in care sa gasesc solutia? Metoda getProducts din clasa Category este restrictionata pe id-ul categoriei primite ca input. 80 in cazul meu. "Return current category products". Eu nu inteleg care este motivul pentru care ea functioneaza preferential in functie de id-ul categoriei. Link to comment Share on other sites More sharing options...
valentin.g Posted October 30, 2012 Share Posted October 30, 2012 Nu functioneaza preferential. Modulul HomeFeatured afiseaza produsele care sunt setate si in categoria cu Id=80 Deci ar trebui ca la produsele pe care le vrei listate sa setezi in lista de categorii si categoria 80. Numarul de produse afisate este cel seatat de tine in configurare Link to comment Share on other sites More sharing options...
cristic Posted October 30, 2012 Share Posted October 30, 2012 Valentin.g are dreptate. Trebuie sa mergi la produsele pe care vrei sa le afisezi si sa le atasezi si la categoria cu id-ul 80. Link to comment Share on other sites More sharing options...
silberstern Posted November 1, 2012 Author Share Posted November 1, 2012 Am facut lucrul asta. Exista produse atasate categoriei si cu toate acestea nu sunt afisate. Link to comment Share on other sites More sharing options...
costi43 Posted November 1, 2012 Share Posted November 1, 2012 la id_lang nu ar trebui sa fie 5-6-7 numai stiu care e romana Link to comment Share on other sites More sharing options...
cristic Posted November 1, 2012 Share Posted November 1, 2012 la id_lang nu ar trebui sa fie 5-6-7 numai stiu care e romana Pai nu foloseste id_lang in clar. Ci: (int)Configuration::get('PS_LANG_DEFAULT') si (int)$params['cookie']->id_lang silberstern, poate poti sa pui aici modulul, sa il putem testa. Si versiunea PS pe care e instalat. Link to comment Share on other sites More sharing options...
cristic Posted November 1, 2012 Share Posted November 1, 2012 (edited) Tocmai ce am vazut cum e definita getProducts in clasa Category: * @param integer $id_lang Language ID * @param integer $p Page number * @param integer $n Number of products per page * @param boolean $getTotal return the number of results instead of the results themself * @param boolean $active return only active products * @param boolean $random active a random filter for returned products * @param int $randomNumberProducts number of products to return if random is activated * @param boolean $checkAccess set to false to return all products (even if customer hasn't access) * @return mixed Products or number of products Al doilea parametru nu e id-ul categoriei, ci numarul paginii. Din cauza asta nu iti merge. Tu practic ii spui sa afiseze categoria 80, dar incepand de la pagina 80. Deci schimba in codul tau asa: $smarty->assign(array( 'products' => $category->getProducts((int)$params['cookie']->id_lang, 1, ($nb ? $nb : 10)), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize('home'))); Edited November 1, 2012 by cristic (see edit history) Link to comment Share on other sites More sharing options...
silberstern Posted November 9, 2012 Author Share Posted November 9, 2012 Multumesc tuturor pentru raspunsuri, in special lui cristic. Ultimul post al tau rezolva problema. 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