Hikashop configuration is gone after every update

  • Posts: 7
  • Thank you received: 0
  • Hikashop Essential
2 months 4 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: 82867
  • Thank you received: 13374
  • MODERATOR
2 months 3 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.

Time to create page: 0.054 seconds
Powered by Kunena Forum