stathis Posted November 20, 2013 Share Posted November 20, 2013 Hi, I'm building a shop for car auto parts. I've a product catalog with almost 50,000 products with no photos and besides that, i've some other car accessories that have photos and will be listed in other categories. I need to have a way to select between 2 different product list views depending on the product category. The first will be the regular one that will be set for the products that have a photo (in the car accessories categories) and the other one will have a tighter list view with no photo (something like an excel sheet view with product name, price, add to cart and view product links). I was thinking to implement that based on a "flag" that will be set on each category. In the product-list template, i will check for that flag and display the proper view. A better approach might be to have a different product-list.tpl file and select each time to load the proper one (though, i'm note quite sure how to implement that). Any ideas on how to set that "flag" on category? I prefer to have a solution that will be easy to set from within the categories view of the prestashop admin system. Thanks in advance! Link to comment Share on other sites More sharing options...
stathis Posted November 20, 2013 Author Share Posted November 20, 2013 I figured out myself a way to do this so i'm sharing it here i case any one else has a similar requirement. The initial idea was to add a field to the category table and then make the proper modifications to the prestashop admin for the categories view. I abandoned this plan as soon as i realized that it would need a lot of work and modifications to the core of prestashop. What i did, was to add a "smart code" in the category description field, something like [products-template-1]. The work then has to do with modifying the themes/default/category.tpl file. I read the $category->description and if it has the smart code, i load the proper product-list template file: {if $category->description|strstr:"[products-template-1]"} *load template 1* {include file="./product-list-template-1.tpl" products=$products} {elseif $category->description|strstr:"[products-template-2]"} *load template 2* {include file="./product-list-template-2.tpl" products=$products} {else} *load default template* {include file="./product-list.tpl" products=$products} {/if} In order to avoid displaying the smart code in the description area of the template view, i call the smarty replace function to remove the "smart code": {$category->description|replace:'[products-template-1]':''} thats all! 1 Link to comment Share on other sites More sharing options...
zahid44 Posted December 4, 2013 Share Posted December 4, 2013 Hi can you give here the link of the cart you made? Or can you attach a picture so its easy to understand the whole idea. I am also looking for same thing. I need to make it for a pizza shop where all the products will be listed all together in lines FOOD 1 ...... 10$ Add Drinks (pull down menu) add to cart FOOD 2 ...... 9$ Add Toppings (pull down menu) add to cart FOOD 3 ...... 5$ FOOD 4 ...... 20$ Add meal (pull down menu) add to cart and all add to cart will increase cart. While as I want a small cart view on the right side of the page shows how many items I have added. The checkout will take me to payment. Can you please guide me with this. 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