Create Table From Controller


I'm getting values from a form in my controller after click submit.

Untill here everything ok.

What I need now is to save these values in the DB and I don't know if:

  • I have to create a new table in the DB

    Ex: db_query("CREATE TABLE IF NOT EXESTS bla bla bla bla]);

  • or if I cscart has a method to do that automaticly.

If your controller is an addon then you are responsible for creating whatever tables it may require during installation.

If you are using another controller (like products) then there are means to save/retrieve additional product properties. This is usually done via the 'extra' element in a product. I.e. $product_data['extra']['my_stuff']['my_attribute'].

The system should save the data and fetch it when it gets product data.