If you can't find an extension, you could pay a developer such as ourselves or post a job in the Commercial Support Forum.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Without extensions, this is the method that comes to mind:
- Create the message
Go to Admin > Extensions > Extensions > Modules > HTML Content. If you haven't used this before you'd need to install it first (click on the green + icon), otherwise just create a new module. Name your module something like "Message for Products in Category X", leave the Heading Title empty, and write the required message in Description. - Create layout
Go to Admin > Design >Layouts. Create a new layout with the same details as your current product layout, and name it something like "Product - Category X". Delete the route part and add the module created in the previous step to the top of the Content Bottom section. - Assign layout to product
Go to Admin > Products and find one of the products you want to display this message for. Edit the product, and on the Layout Override section of the Design tab choose the layout created in the previous step. - (Optional) Assign layout to the rest of the products
Either assign this layout for all necessary products, or use one of the Import/Export tools to do this for the whole category at once.
Hope this helps,
Gergely
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I'm curious though to know how the same would be done with a little code in the product.twig-file like: if category_id = 25 then print "Hello world!". Wouldn't that be a faster sollution?
Hi.
Check out my Extended layout extension. It can display any module (For example, HTML) only for products in a certain category.
Yes, it's a quick hardcoded solution.
My FREE extensions in marketplace. [ security | flexibility | speedup ]
Choosing another Design/Layout override for supplements might be the closest I could come, if I could just move the "Related products" under this HTML-disclimer.
Correct. An extension module would be needed for this since what you're looking for is to filter specific categories that would match every product of the same kind. Thankfully, in OC v3.x releases, path IDs can be tracked in the product page. If you cannot find a specific extension on the Marketplace that could achieve this already, you could either duplicate an existing module and lookup for the category ID, create a new service request in the Commercial Support section of the forum, or contact me directly via the forum PM to get this done as a custom job.todavy wrote: ↑Thu Mar 10, 2022 10:59 pmThe text will be the same for every product of the same kind (dietary supplements must have a specific disclaimer accordning to regulation). Supplements are put in a specific category so I thought that the category could be used for this. But I see now that this is not the optimal way as there are categories that mix those products with others that are not supplements (and those should not have this disclaimer). An optimal solution would be to activate this disclaimer for each product in the Admin/catalog/product but this might not be done without a module. I cant use attributes as they have to be entered for each product.
Choosing another Design/Layout override for supplements might be the closest I could come, if I could just move the "Related products" under this HTML-disclimer.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
"Extended layout" can also show/hide modules for selected products.todavy wrote: ↑Thu Mar 10, 2022 10:59 pmBut I see now that this is not the optimal way as there are categories that mix those products with others that are not supplements (and those should not have this disclaimer). An optimal solution would be to activate this disclaimer for each product in the Admin/catalog/product but this might not be done without a module. I cant use attributes as they have to be entered for each product.
To display modules before related products you can simply move {{ content_bottom }} in product.twig file
My FREE extensions in marketplace. [ security | flexibility | speedup ]
- Move content_bottom before "related products"
- Create new layout (e.g. Product2) with path "product/product" (copy of Product layout)
- Edit product > Layout tab > Select new layout (Product2) for each product
- Create HTML module with your content
- Place HTML module on new layout
I also have an extension that can change product.twig for selected products (Custom Templates Pro) to yours (e.g. product_2.twig).
My FREE extensions in marketplace. [ security | flexibility | speedup ]
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 19 guests