Post by todavy » Thu Mar 10, 2022 7:18 pm

How do I put a specific text at the botton on all products belong to a specific category (so I dont have to copy-past in on every single product)?
Opencart 3.0.3.7.

New member

Posts

Joined
Tue Jun 10, 2014 5:00 pm

Post by paulfeakins » Thu Mar 10, 2022 7:56 pm

todavy wrote:
Thu Mar 10, 2022 7:18 pm
How do I put a specific text at the botton on all products belong to a specific category (so I dont have to copy-past in on every single product)?
Opencart 3.0.3.7.
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


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by Gergely » Thu Mar 10, 2022 9:09 pm

Hi todavy,

Without extensions, this is the method that comes to mind:
  1. 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.
  2. 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.
  3. 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.
  4. (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.
This is of course not the most convenient solution imaginable, but can be done within the opencart system without modifications.
Hope this helps,
Gergely

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by straightlight » Thu Mar 10, 2022 9:11 pm

Yes, agreed. No custom modifications are required with this request.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by todavy » Thu Mar 10, 2022 9:59 pm

Thanks! The problem here is that the HTML-modules appear under the "Related products" section. I want it to be above that, as a continuing part of the product text. Is it possible to move the position of my new HTML-module to above the "Related products" module?

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?
Last edited by todavy on Thu Mar 10, 2022 10:15 pm, edited 1 time in total.

New member

Posts

Joined
Tue Jun 10, 2014 5:00 pm

Post by halfhope » Thu Mar 10, 2022 10:15 pm

todavy wrote:
Thu Mar 10, 2022 9:59 pm
Thanks! I'll try that right away! 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 "Hellp 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.
todavy wrote:
Thu Mar 10, 2022 9:59 pm
Wouldn't that be a faster sollution?
Yes, it's a quick hardcoded solution.

My FREE extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by mikeinterserv » Thu Mar 10, 2022 10:15 pm

So what do you have just ONE text for ONE category or will it change over time.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by todavy » Thu Mar 10, 2022 10:59 pm

The 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.

New member

Posts

Joined
Tue Jun 10, 2014 5:00 pm

Post by straightlight » Thu Mar 10, 2022 11:07 pm

todavy wrote:
Thu Mar 10, 2022 10:59 pm
The 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.
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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by halfhope » Thu Mar 10, 2022 11:18 pm

todavy wrote:
Thu Mar 10, 2022 10:59 pm
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.
"Extended layout" can also show/hide modules for selected products.
todavy wrote:
Thu Mar 10, 2022 10:59 pm
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.
To display modules before related products you can simply move {{ content_bottom }} in product.twig file

My FREE extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by todavy » Fri Mar 11, 2022 12:41 am

Thanks, but how do I I make a special .twig for the new layout? I might not want the "Related products" to be under every HTML-module... ::)

New member

Posts

Joined
Tue Jun 10, 2014 5:00 pm

Post by halfhope » Fri Mar 11, 2022 1:49 am

todavy wrote:
Fri Mar 11, 2022 12:41 am
Thanks, but how do I I make a special .twig for the new layout? I might not want the "Related products" to be under every HTML-module... ::)
  • 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
All products will have the default "Product" layout, the selected ones will have the "Product2" layout. The product.twig template will be common for all products. Due to the movement of the module output position, all modules displayed on the product page in the content_bottom position will be displayed before the "related products" module, regardless of the 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 ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by todavy » Fri Mar 11, 2022 6:56 am

Thank you halfhope! You saved my day.

New member

Posts

Joined
Tue Jun 10, 2014 5:00 pm

Post by straightlight » Fri Mar 11, 2022 9:34 pm

todavy wrote:
Fri Mar 11, 2022 6:56 am
Thank you halfhope! You saved my day.
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


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 19 guests