As from Opencart 3.x you are no longer aloud to add data to existing tables other then the settings table.
Some of my extensions add data to for example oc.product.description.
What is the best way/place to store data and call it for these extensions?
All my extensions: Click here or Click here
Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+
Thanks!
Create a new table per extension or create 1 new table and use it for all my extensions which need it?
All my extensions: Click here or Click here
One table to support all your extensions would be hard to maintain and possibly have a lot of overhead for unused columns.
Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+
Thanks!
Any tips on how to use the left joins for a table like oc_product_description.
Normally I would add a new column to it and it is linked to the product.
But when I create a new table I don't have all the product id's from the oc_product_description.
How would I link them with a left join?
All my extensions: Click here or Click here
oc_product.product_id
oc_mymodule_product with your additional columns and joined on product_id
Code: Select all
select * from oc_product p
left join oc_mymodule_product mp on p.product_id = mp.product_id
oc_mymodule_information with your additional columns and joined on information_id
Code: Select all
select * from oc_information i
left join oc_mymodule_information mi on i.information_id = mi.information_id
To join them you’ll need matching product_ids but with your own custom table you won’t have them.
All my extensions: Click here or Click here
That analogy would be incorrect. What it simply requires with your own modules is to load the database models. On this topic, the products are being used as an example. In this case, assuming you are posting your values from an HTML form:As from Opencart 3.x you are no longer aloud to add data to existing tables other then the settings table.
Code: Select all
$this->load->model('catalog/product');
$product_id = $this->model_catalog_product->addProduct($this->request->post);
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: OpenCode and 32 guests