S
S
Serge Tkach2017-01-09 12:59:07
opencart
Serge Tkach, 2017-01-09 12:59:07

How to add PREFIX tables to install.sql in OpenCart 2 OCMOD when installing the module?

By default, tables in the database have the prefix oc_
Among the installed modules, I see that people write like this: oc_table
But what happens if I have a different prefix?
How can I use it to modify tables with install.sql?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Serge Tkach, 2017-01-09
@SergeTkach

So far I have achieved the result using the install.php file

$query = "ALTER TABLE `".DB_PREFIX."category_description`
ADD `name_genitive` VARCHAR( 100 ) NOT NULL AFTER `name`,
ADD `name_singular` VARCHAR( 100 ) NOT NULL AFTER `name_genitive`; ";	
$result = $this->db->query($query);

E
Egor, 2017-01-09
@egormmm

Usually use the DB_PREFIX constant

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question