adrianpasita Posted January 30, 2014 Share Posted January 30, 2014 Incerc sa pun produsele din featured-products sa ruleze random. Acum imi apar aceleasi produse de fiecare data, cele pe care le-am adaugat primele. Am incercat sa modific homefeatured.php cum zic cei de pe forum de AICI dar nu imi merge. Ma poate ajuta cineva? Merci. Link to comment Share on other sites More sharing options...
cristic Posted January 30, 2014 Share Posted January 30, 2014 (edited) Solutia ar trebui sa functioneze. Incearca sa pui un print_r($products); chiar dupa shuffle($products);. Ce iti arata la fiecare refresh (CTRL+R)? Edited January 30, 2014 by cristic (see edit history) Link to comment Share on other sites More sharing options...
adrianpasita Posted January 30, 2014 Author Share Posted January 30, 2014 Am pus, uite cum arata: public function hookDisplayHome($params) { if (!$this->isCached('homefeatured.tpl', $this->getCacheId('homefeatured'))) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('HOME_FEATURED_NBR'); $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), "position"); shuffle($products); print_r($products); $this->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), )); } return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId('homefeatured')); } Site-ul este www.ncp.ro/presta. La PRODUSE RECOMANDATE vreau sa aplic aceasta functie random. Link to comment Share on other sites More sharing options...
cristic Posted January 30, 2014 Share Posted January 30, 2014 Am vazut ca acum nu mai apare. Ce iti arata la fiecare refresh? Se modifica ordinea textului afisat? Link to comment Share on other sites More sharing options...
adrianpasita Posted January 30, 2014 Author Share Posted January 30, 2014 Dupa ce am salvat codul cum mi-ai zis tu la primul refresh pe pagina mi-a aparut textul, codul. La urmatorul mi-a arata pagina OK cu produsele acelea 8 aranjate un pic altfel. Dar acum nu se mai schimba la refresh. La fiecare refresh imi arata produsele in aceasi ordine. Am observat ca daca nu sunt logat sunt aranjate altfel, dar aceleasi produse. 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