Hikashop configuration is gone after every update

  • Posts: 8
  • Thank you received: 1
  • Hikashop Essential
5 months 3 weeks ago #362851

-- HikaShop version -- : Essential 5.1.0
-- Joomla version -- : 3.10
-- PHP version -- : 7.4.33
-- Browser(s) name and version -- : Chrome

After every Hikashop-update my name, adress, e-mailadresses are overwritten by the default values in the configuration. There is a adres in the UK -we are in the Netherlands- and on a lot of places he fill in the e-mailadres of the webmaster (from the Joomla-system-configuration I think).

Is there a way to avoid that, so he update Hikashop, but leave my settings/config alone?

Thanks for your answer(s)!

Please Log in or Create an account to join the conversation.

  • Posts: 83303
  • Thank you received: 13467
  • MODERATOR
5 months 2 weeks ago #362946

Hi,

Sorry for not answering earlier.

I checked the situation on our end. No one else reported the problem and we can't reproduce it either.
These settings are set with the code in the function addPref of the file install.hikashop.php at the root of the install package of HikaShop.
At the end of the function, you can see the MySQL query running to set these parameters.
And yes, this MySQL is run each time HikaShop is installed or updated.
However, as you can read there, this MySQL query is like this:

INSERT IGNORE INTO `#__hikashop_config` (`config_namekey`,`config_value`,`config_default`) VALUES ...
What "INSERT IGNORE" means is that MySQL will look at the entries in the hikashop_config table. If a row in that table already exists with the same config_namekey, it will skip it, otherwise it will add it. So you can't have more than one row with the same namekey and once a row with a namekey is added after the first installation, subsequent updates won't add them again, unless you empty the hikashop_config table manually via your PHPMyAdmin.

What this all means for you is that I suspect that the primary key on the "config_namekey" column has been removed from the hikashop_config table on your website. Without the primary key there, this MySQL query I talked about above will add new rows each time HikaShop is installed. And when HikaShop loads the settings for that table, Joomla will group the rows with the same namekey and only keep the latest one.

I remember someone having a similar issue because of a problem during the migration of the database with the tool they were using which lost the primary key on the table.

To check if my theory is correct, go in your PHPMyAdmin and access the hikashop_config table. You can check its structure. There, it should mention the primary key, at the bottom, under the "indexes" section:
phpandmysql.com/extras/composite-primary...te-primary-key-2.png
You can also check if you have several entries with the same config_namekey in that table.

Supposing that we're in this scenario, in order to fix the problem, you won't be able to add the primary key directly. It will be refused by PHPMyAdmin because you have several entries with the same config_namekey. So, I think the simplest would be to delete the hikashop_config table completely and install HikaShop again. The installer will add the table with the proper primary key and set the default values. You'll have to reconfigure your HikaShop once again, but after this, further updates won't change your settings back to default.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 1
  • Hikashop Essential
3 weeks 5 days ago #365369

Thank you and sorry for the late answer, Nicolas!

You are right: the config-table keeps growing, it has more than 20.000 rows/items.
The table is different than the normal Joomla-tables, where (in phpMyAdmin) every item is a row, and you can edit, select and drop rows or empty the table. You can not do that in the Hikashop-config table: Above are 3 colums: "config_namekey", "config_value" and "config_default", and then every setting looks like a row, but you can't select that and there are no options to delete or drop the table.
In the top of the page there is a warning: "Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available."

I have tried your solution to delete the Hikashop-config-table, but then the administrator-section of Joomla don't work anymore and you can't instal extensions anymore.

Finaly it seems to work: I have renamed the original config-table, instal Hikashop in another Joomla 3.10 site, export that new config-table and import it in the original database. It looks good (like a normal table, with rows you can edit, delete etc.), so I now delete the renamed-table.

Just want to let you know, in case someone else has the same problem.

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum