I'm looking for a way to insert a snippet of text or html/php into several products via text I choose in the product-text.
Example: I have several products that have the same options and I want the product-text to show some info about it, but I don't want to edit all the products if I need to change the text a bit.
How can I enter a tag into the product-text, and have opencart swap out the tag with the text I want?
If I just do a php include in the product-text opencart comments out the php code.
running Opencart 3.0.2.0, and I have vqmod installed. There is no mod in question, rather where to parse the product-text for a specific tag.
Edit: cleared up question.
Example: I have several products that have the same options and I want the product-text to show some info about it, but I don't want to edit all the products if I need to change the text a bit.
How can I enter a tag into the product-text, and have opencart swap out the tag with the text I want?
If I just do a php include in the product-text opencart comments out the php code.
running Opencart 3.0.2.0, and I have vqmod installed. There is no mod in question, rather where to parse the product-text for a specific tag.
Edit: cleared up question.
Last edited by tstirler on Tue Feb 20, 2018 2:57 pm, edited 1 time in total.
______________________________
Out of my mind. Back in five minutes.
Code example / attachment un-provided nor knowing if this request is about a specific extension being used.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I'll rephrase the question a bit then.
What file parses out the Product Info (vanilla OC 3)? I think it should be catalog/model/catalog/product.php.
So that I can scan it for a tag I choose to make and if I find it insert my text/html/php code there.
I see that the query around line 10 fetches and returns the array of data.
But I've not found a place where I can actually do something with that piece of text.
What I want to insert is a standard set of info, say from my own php-file somewhere, pulled in via a standard php-include. That way I have one place to change the included text and it'll change for all products that use it.
I have no proper code example yet since I've not managed to find where I want said code.
Although it will be a simple: if tag found replace with php-include
What file parses out the Product Info (vanilla OC 3)? I think it should be catalog/model/catalog/product.php.
So that I can scan it for a tag I choose to make and if I find it insert my text/html/php code there.
I see that the query around line 10 fetches and returns the array of data.
Code: Select all
if ($query->num_rows)
What I want to insert is a standard set of info, say from my own php-file somewhere, pulled in via a standard php-include. That way I have one place to change the included text and it'll change for all products that use it.
I have no proper code example yet since I've not managed to find where I want said code.
Although it will be a simple: if tag found replace with php-include
______________________________
Out of my mind. Back in five minutes.
Better to use OCMod, VQMod or the override engine to do this without overriding core files. You could also create an extension module and route it to the product page to make things easier by also adding a new model file (might use a bit more SQL resource but still works).
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I thought as much. I've no problem doing this with vqmod, if I could just get it to work.
Do I need to hook into product.php to catch this?
I tried earlier to do it via the template (now twig) but it didn't change it for me.
Do I need to hook into product.php to catch this?
I tried earlier to do it via the template (now twig) but it didn't change it for me.
______________________________
Out of my mind. Back in five minutes.
Who is online
Users browsing this forum: No registered users and 94 guests