Jump to content

Category page latest product slider


Recommended Posts

Hi

 

I have been looking all over for a product slider for the category list page, which can display the latest products in that category. Can anyone suggest one that I could use?

 

If not, could you point me in the direction of a related tutorial so that I can try and build a module to do this? (I am new to Prestashop and have only managed to build a very basic module so far.. so I just need to somehow pull in a list of the latest products in a category and use a for each loop to interate through - like on product-list.tpl.. the slider bit is no problem because that's all jquery and css.)

 

Many thanks!

Link to comment
Share on other sites

Thanks for the reply.. I have managed to find a way to pull in a list of latest products into a new hook on the category page and will use these to create a slider (created a new .tpl page based on product-list.tpl).

Link to comment
Share on other sites

  • 1 month later...

Hi sure, I'm new to prestashop so not sure if this is the correct way to do things but it seems to work just fine:

 

1) Copied the product-list.tpl and named it slider-list.tpl (in the theme root folder)

2) Created a new variable in CategoryController.php (this should actually be done in the override folder but I just edited the original which is bad, still need to go back and sort that out). To make the variable accesible on categroy.tpl

 

add the following

$this->slide_products = $this->category->getProducts($this->context->language->id, 1, 10, 'date_add', 'desc');

directly under the following line

$this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);

then assigning the variable to smarty page by adding the following

'slide_products' => (isset($this->slide_products) && $this->slide_products) ? $this->slide_products : null,

after

'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null,

3) in category.tpl include the slider-list.tpl file and pass it the variable like so:

{include file="./slider-list.tpl" slide_products=$slide_products}

4) now you can replace the $products variable in slider-list.tpl with $slide_products and build the list using a for each loop.

5) The last thing to do is to use a slider plugin to create slides from the list (I used flexslider)

 

Hope that makes sense :)

Cheers

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...