SonoguN Posted July 24, 2013 Share Posted July 24, 2013 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 More sharing options...
vekia Posted July 25, 2013 Share Posted July 25, 2013 unfortunately i don't know module like this, you can of course build module but in this case you have to be familiar with whole prestashop engine, and of course in php, smarty and javascript / jquery Link to comment Share on other sites More sharing options...
SonoguN Posted July 25, 2013 Author Share Posted July 25, 2013 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 More sharing options...
vekia Posted July 25, 2013 Share Posted July 25, 2013 awesome, if it will be ready - don't forget to share the url to the shop page, i will check how it works with pleasure, im so curious Link to comment Share on other sites More sharing options...
SonoguN Posted July 26, 2013 Author Share Posted July 26, 2013 Ok will do Link to comment Share on other sites More sharing options...
ankchats Posted September 3, 2013 Share Posted September 3, 2013 Ok will do Hey, did you get the solution for the thing? Would love to see what you did for the problem..... cheers Link to comment Share on other sites More sharing options...
SonoguN Posted September 4, 2013 Author Share Posted September 4, 2013 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 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