Good evening. May someone help me to make php script with sql or few sql queries that must do the following:
First - there is a table made by extension and called (oc_product_newtabcontent)
Inside we have 2 records, it makes 2 or more records depending on how many languages the shop's got. In my case I have 2...
Here's how this table structure looks like:
This extension allow me to add extra tab (next to product description tab) - okay. But with all the products I have, doing this manually... will take time
So - Ive already added to 1 product the necesary information which has to contain - May you write a simple php cycle which gets all products from the main product table, and making new records in this table for each product id? Reminder: there are 2 records per product just because of the language
Here it is:
It has to make such records for all existing products, copying the (newtabcontent) column to each record. Also something important is that this column (newtabcontent) has different value in language_id 1 and language_id 2
I hope I've explained it correctly - It's not so hard but it's been years since I havent been web-developing ... - Thank you!
First - there is a table made by extension and called (oc_product_newtabcontent)
Inside we have 2 records, it makes 2 or more records depending on how many languages the shop's got. In my case I have 2...
Here's how this table structure looks like:
This extension allow me to add extra tab (next to product description tab) - okay. But with all the products I have, doing this manually... will take time
So - Ive already added to 1 product the necesary information which has to contain - May you write a simple php cycle which gets all products from the main product table, and making new records in this table for each product id? Reminder: there are 2 records per product just because of the language
Here it is:
It has to make such records for all existing products, copying the (newtabcontent) column to each record. Also something important is that this column (newtabcontent) has different value in language_id 1 and language_id 2
I hope I've explained it correctly - It's not so hard but it's been years since I havent been web-developing ... - Thank you!
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Not useful at all. You could at least provide with something closer to a solution. Thanks anyway
I was suggesting you ask there ..
but ok, fair enough .. how about these
https://www.google.com/search?client=sa ... 8&oe=UTF-8
https://www.w3schools.com/sql/sql_insert.asp
and far more importantly, make sure you back up your database before messing with it.
but ok, fair enough .. how about these
https://www.google.com/search?client=sa ... 8&oe=UTF-8
https://www.w3schools.com/sql/sql_insert.asp
and far more importantly, make sure you back up your database before messing with it.
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Is it the same content for each tab? You can probably do this with a simple query and loop from the product_description table.
Last edited by sw!tch on Mon Nov 30, 2020 4:23 am, edited 1 time in total.
Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!
Yes the same. In this table has to exist 2 records per each of the existing products... one with language_id 1 and one with language id 2 and with same content on (newtabcontent) *copied from the existing 2 rows*
You should be able to just query the product_description table and then exec your logic for the tab insert from the result loop. You can further get language id and product id from that same.. loop.
If you are not versed in coding or new to OC - Look at the admin/model/catalog/product.php. methods, probably some examples in there you can reference or build from.
Backup if messing with code and the DB, etc.
If you are not versed in coding or new to OC - Look at the admin/model/catalog/product.php. methods, probably some examples in there you can reference or build from.
Backup if messing with code and the DB, etc.
Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!
This should work but is probably not the best way to do it, just wrote this for you in a few minutes
change your database information to your opencart db (backup ur db first)
Change the $newtabcontent 1 and 2 and $name1 and $name2 to your data
if you need help pm me
change your database information to your opencart db (backup ur db first)
Change the $newtabcontent 1 and 2 and $name1 and $name2 to your data
if you need help pm me
Attachments
Who is online
Users browsing this forum: No registered users and 203 guests