| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
form getDefaultParams is not working | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Handling forn
How can I add a form handler to my module that adds record in database? after adding record it must redirect to same page.
__________________
xcart5 |
|||||||
#2
|
|||||||
|
|||||||
form getDefaultParams is not working
I have this model form:
PHP Code:
PHP Code:
This code adds form to page with credit field and with hidden date field, but when I submit form it does not insert date field to sql query, it just uses null, and I get this error An exception occurred while executing 'INSERT INTO xc_order_item_activations (order_item_id, date, credit, activation_code, ip_address) VALUES (?, ?, ?, ?, ?)' with params [null, null, "2", null, null]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date' cannot be null
__________________
xcart5 |
|||||||
#3
|
|||||||
|
|||||||
Re: form getDefaultParams is not working
Also tell me please next:
I added multiple forms(as above) on my order page, every order item has its own form, how can I add hidden field to this form that must have valu of order_item_id?
__________________
xcart5 |
|||||||
#4
|
|||||||||
|
|||||||||
Re: form getDefaultParams is not working
Quote:
This is because your $schemaDefault describes the "credit" field only, so X-Cart uses "null" value for the rest of the entity fields. You may try to set the missing properties in the View\Model\OrderItemActivation ::setModelProperties() method. Quote:
You can add hidden fields to a form by declaring them in the getDefaultParams() method of your form class that extends \XLite\View\Form\AForm. For example, check the \XLite\View\Form\Profile class.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|