| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Working with ItemsList | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Working with ItemsList
I have an itemsList table. I want to save in my entity a field with value of param. such as admin.php?target=returned_products&order=<Some Value of Param>. For that task I put in class that defined the table this method :
/** * Create entity * * @return \XLite\Model\AEntity */ protected function createEntity() { $entity = parent::createEntity(); $entity->setFormId(\XLite\Core\Request::getInstance()->order); return $entity; } But stil didn't work and throw me error : An exception occurred while executing 'INSERT INTO xc_retur_product (position, enabled, form_id, code, qty) VALUES (?, ?, ?, ?, ?)' with params [0, 1, null, "<Value>", "<Value>"]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'form_id' cannot be null. What method do i need in order to set this field before i persist in database ? I don't want to show in table that particular column.
__________________
Soptareanu Alex |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Working with ItemsList
Hi @Alex,
First of all, do you even need this 'form_id' param in your model? Maybe you can just remove it. Otherwise, it looks like the problem is not while creating an entity, but rather while updating it. Can it be that your ItemsList has 'form_id' in defineColumns() method, but when the request is submitted, 'form_id' is not there? Tony Quote:
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#3
|
|||||||
|
|||||||
Re: Working with ItemsList
Quote:
__________________
Soptareanu Alex |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Working with ItemsList
Quote:
I see. Thanks for explanation. The problem looks to be that 'order' param is not in POST request when you submit the ItemsList. It is in GET parameters when you open the page with ItemsList, but when the ItemsList's form is submitted, it is not there. To add 'order' as a hidden input to your ItemsList's form, create the following method in your ItemsList class: Code:
Please, let me know if it helps. Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|