[Skip to main content](#vessel-content)

#   Insert datas to db via the backend (form.php)

##

- **[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")**
- [![Storm15's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1649-storm15 "View Storm15's Profile") Topic Author
- [ Offline](/forum/user/1649-storm15)

Less More

- Posts: 39
- Thank you received: 0
-
-

13 years 7 months ago [\#96829](#96829) by [Storm15](/forum/user/1649-storm15 "View Storm15's Profile")  *[Insert datas to db via the backend (form.php)](/forum/2-general-talk-about-hikashop/79796-insert-datas-to-db-via-the-backend-form-php#96829 "Hello Everybody,  I wanted to add some extra options in the backend when creating/editing a product (availability for 3 kinds of conditions (new, used etc). I added 3 checkboxes in the form.php file (administrator/com&#95;hikashop/views/product/...) and now wanted to insert a boolean to the database if the checkbox was selected (=1) or not (=0). I already created 3 columns in jos&#95;hikashop&#95;product, but I need the file or the function which inserts/updates the data to the database after clicking on &quot;Save&quot; in the backend.  It would be great if someone could help me with that one, greetings, David")* was created by *[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")*

Hello Everybody,

I wanted to add some extra options in the backend when creating/editing a product (availability for 3 kinds of conditions (new, used etc).
I added 3 checkboxes in the form.php file (administrator/com_hikashop/views/product/...) and now wanted to insert a boolean to the database if the checkbox was selected (=1) or not (=0).
I already created 3 columns in jos_hikashop_product, but I need the file or the function which inserts/updates the data to the database after clicking on "Save" in the backend.

It would be great if someone could help me with that one,
greetings,
David

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5Nzk2LWluc2VydC1kYXRhcy10by1kYi12aWEtdGhlLWJhY2tlbmQtZm9ybS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

13 years 7 months ago [\#96855](#96855) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert datas to db via the backend (form.php)](/forum/2-general-talk-about-hikashop/79796-insert-datas-to-db-via-the-backend-form-php#96855 "Hello Everybody,  I wanted to add some extra options in the backend when creating/editing a product (availability for 3 kinds of conditions (new, used etc). I added 3 checkboxes in the form.php file (administrator/com&#95;hikashop/views/product/...) and now wanted to insert a boolean to the database if the checkbox was selected (=1) or not (=0). I already created 3 columns in jos&#95;hikashop&#95;product, but I need the file or the function which inserts/updates the data to the database after clicking on &quot;Save&quot; in the backend.  It would be great if someone could help me with that one, greetings, David")*

Hi,

You should just set an input name like that: data[product][column_name]
where column name is the name of the column in the product table in the database and then the system will handle the field automatically without you doing anything.

Otherwise, you're lookinf for the function saveForm of the file administrator/components/com_hikashop/classes/product.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5Nzk2LWluc2VydC1kYXRhcy10by1kYi12aWEtdGhlLWJhY2tlbmQtZm9ybS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")**
- [![Storm15's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1649-storm15 "View Storm15's Profile") Topic Author
- [ Offline](/forum/user/1649-storm15)

Less More

- Posts: 39
- Thank you received: 0
-
-

13 years 7 months ago [\#96985](#96985) by [Storm15](/forum/user/1649-storm15 "View Storm15's Profile")  Replied by *[Storm15](/forum/user/1649-storm15 "View Storm15's Profile")* on topic *[Insert datas to db via the backend (form.php)](/forum/2-general-talk-about-hikashop/79796-insert-datas-to-db-via-the-backend-form-php#96985 "Hello Everybody,  I wanted to add some extra options in the backend when creating/editing a product (availability for 3 kinds of conditions (new, used etc). I added 3 checkboxes in the form.php file (administrator/com&#95;hikashop/views/product/...) and now wanted to insert a boolean to the database if the checkbox was selected (=1) or not (=0). I already created 3 columns in jos&#95;hikashop&#95;product, but I need the file or the function which inserts/updates the data to the database after clicking on &quot;Save&quot; in the backend.  It would be great if someone could help me with that one, greetings, David")*

Okay I will try it with the data[product]...
But what does it exactly do? In form.php there are a few lines e.g Code:

$this-&gt;product_name_input = "data[product][product_name]"; $this-&gt;product_url_input = "data[product][product_url]";

It would be great if someone could explain how it works and what happens to the $this-&gt;product.. Variables.

How do I set it?
In the form itself it looks like this: Code:

&lt;div class="availability"&gt;&lt;u&gt;Verf&amp;uuml;gbarkeit&lt;/u&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="checkbox" name ="nl" value="newlabel" /&gt; Neu, versiegelt &lt;br /&gt; &lt;input type="checkbox" name ="n" value="newopened" /&gt; Neu, in offener Originalverpackung &lt;br /&gt; &lt;input type="checkbox" name ="u" value="used" /&gt; Gebraucht &lt;br /&gt; &lt;/div&gt;

I know that there is no form-tag, I wanted to ask how to combine this form with the saveform()-function as the trigger.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5Nzk2LWluc2VydC1kYXRhcy10by1kYi12aWEtdGhlLWJhY2tlbmQtZm9ybS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

13 years 7 months ago [\#97069](#97069) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert datas to db via the backend (form.php)](/forum/2-general-talk-about-hikashop/79796-insert-datas-to-db-via-the-backend-form-php#97069 "Hello Everybody,  I wanted to add some extra options in the backend when creating/editing a product (availability for 3 kinds of conditions (new, used etc). I added 3 checkboxes in the form.php file (administrator/com&#95;hikashop/views/product/...) and now wanted to insert a boolean to the database if the checkbox was selected (=1) or not (=0). I already created 3 columns in jos&#95;hikashop&#95;product, but I need the file or the function which inserts/updates the data to the database after clicking on &quot;Save&quot; in the backend.  It would be great if someone could help me with that one, greetings, David")*

The form tag is in the "form" view file.
Suppose that you have a text input, it should be: Code:

&lt;input type="text" name ="data[product][column_name]" value="&lt;?php echo @$this-&gt;element-&gt;column_name; ?&gt;" /&gt;

and the rest will be automatic.

The following user(s) said Thank You: [Storm15](/forum/user/1649-storm15 "View Storm15's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc5Nzk2LWluc2VydC1kYXRhcy10by1kYi12aWEtdGhlLWJhY2tlbmQtZm9ybS1waHA/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.065 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
