Jump to content

[free tutorial] how to display homefeatured products randomly?


vekia
 Share

Recommended Posts

In this tutorial you will read step-by-step guide about changing home featured module to display products randomly. It's simple procedure and You'll do it by yourself, even if you havn't programming skills. What do you need? Need some time. Access to files on the server, and plain text editor. So, are you ready? Let's go! :)

 

read the tutorial about: How to display products randomly in "home featured"?

  • Like 2

Share this post


Link to post
Share on other sites

  • 2 weeks later...
In this tutorial you will read step-by-step guide about changing home featured module to display products randomly. It's simple procedure and You'll do it by yourself, even if you havn't programming skills. What do you need? Need some time. Access to files on the server, and plain text editor. So, are you ready? Let's go! :) read the tutorial about: How to display products randomly in "home featured"?

 

El código del tutorial lo que me ha hecho es hacer aleatorio la posición de los 10 primeros artículos de la categoría inicio en el homefeatured.

Si lo que pretendemos es que sean aleatorios todos los artículos de la categoría inicio, entonces el código debería ser:

public function hookDisplayHome($params){
$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 : 10));*/
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10), 'date_add', 'DESC', false, true, true, $nb);

shuffle($products);
$this->smarty->assign(array(
'products' => $products,
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'homeSize' => Image::getSize('home_default'),
));
return $this->display(__FILE__, 'homefeatured.tpl');
}

Edited by jagh3d (see edit history)

Share this post


Link to post
Share on other sites

  • 1 year later...

Hola , me sucede una cosa , efectivamente de esta forma, los productos son aleatorios todos los que esten en inicio, pero

en ls tres pestañas nuevos, populares y mas vendidos, cuando entro por primera vez en la pagina, los populares, es decir homefeatured, salen debajo de lo sproducos nuevos y cuando pulso en populares entonces ya en l apestaña nuevos slaen solo nuevos y en populares solo populres, pero como digo , al entrar por primer vez en l apagina , los destacados o populares salen a continuacion debajo de los nuevos, agluna solucion saludos, ahor amismo no lo tengo puesto para evitar peso en la pagina.

http://www.punto-de-cruz.es/

Share this post


Link to post
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More