Difficulty Adding a Custom Field in Aimeos Models Item and Issues with Saving

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
alababdiy
Posts: 40
Joined: 30 Apr 2023, 12:46

Difficulty Adding a Custom Field in Aimeos Models Item and Issues with Saving

Post by alababdiy » 26 Nov 2023, 17:34

I am currently working on extending the Aimeos e-commerce framework by adding a custom field to the order item. I have successfully created the corresponding database column by overwriting order.php file in the setup/default/schema directory. Additionally, I've declared the necessary setter and getter methods for the new field in the Standard.php file located in MShop/Order/Item.

I've followed the suggestions provided by a fellow member in a related forum post post5939.html However, I'm encountering difficulties in saving the new field using

Code: Select all

$manager->save(...)
. Despite attempting various implementations, the data doesn't persist when using this method.

I had to with using

Code: Select all

$context->db()->update(...)
after the default

Code: Select all

$manager->save(...)
, but this approach involves two separate database transactions, which is not an ideal solution.

I would greatly appreciate any guidance or insights from the community on the best practices for adding custom fields to the order item and ensuring their successful persistence using the

Code: Select all

$manager->save(...)
method.

php8.1 , laravel, linux

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Difficulty Adding a Custom Field in Aimeos Models Item and Issues with Saving

Post by aimeos » 27 Nov 2023, 11:53

It's much simpler, just read this article:
https://aimeos.org/docs/latest/models/extend-managers/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star


Post Reply