PDA

View Full Version : Set setting during product install based with value from query


ZexTasy
11-19-2010, 07:21 AM
Hi,

For the installation of a product I can write install code. In this install code I can run a query which inserts a record in a table and get the identifier back by using the $db->insert_id() statement. I also create a setting for my product in the product xml file.

Now I want to insert the value from the identifier inserted as default in that setting during installation. Is this possible and how?

Thanks in advance for any help!

- ZexTasy

Lynne
11-19-2010, 02:00 PM
I think you would have to do a query to get that id.

ZexTasy
11-19-2010, 04:56 PM
The ID I can get during the installation phase where the I run the installation query for the insert. The problem is that I don't know how to put it in the field, because the fields for the settings are created in a later phase and I don't know how to start a new query after that ...

taravasya
09-11-2015, 06:10 PM
I have the same problem. With installcode, I create a custom userfiled. Its always have name filedNN where NN incremently added number. It can be field6 or field154 who knows..... Anyway, then I import my product, I also add option field in setting, in which I want to insert value of ID from new added field from userfield table(for use it in my plugins).
Problem in what when I do this with installcode, I dont have yet field in option, and further, then I already HAVE field in option I can`t run installcode.
Ofcause, I always can use another product file to insert new userfield and then fill the needed value to my option field... but I think its inconveniently....

How I can interchange the order of execution: 1) Installcode from my product and 2)Import options from my product during single installation process?
Thanks!