How to extend a mshop_order_base table

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
IvanIgniter
Posts: 58
Joined: 01 Dec 2021, 07:41

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 27 Jun 2022, 05:02

Yes.. I have done it many times just the exact new field name as what I did in orders table decorator with no problem inserting new added field. But only in order_base table, any added extra fields in my decorator are the only fields that are not stored after saving?

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

Re: How to extend a mshop_order_base table

Post by aimeos » 27 Jun 2022, 06:42

You can check here what happens during saving:
https://github.com/aimeos/aimeos-core/b ... d.php#L676
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
IvanIgniter
Posts: 58
Joined: 01 Dec 2021, 07:41

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 27 Jun 2022, 12:18

Thank you for that information.. I was able to trace the flow or data up to the last part in the core. I noticed that my added array has no chance to be stored and part of the added fields to be inserted just as what happen in order saving process.

I traced in this part fromArray() of order base part. The add() function has no way to be stored in the object to save "order_base" returning itself without saving the added array compared to "order" add() function which returns the added array and saved the added new field.

I have found a work around the only way I can save the added array in line 387 to store it in the object but this is in the aimeos core code part which is not the best solution. Kindly provide us the best solution without touching the aimeos core code.
5.jpg
5.jpg (86.55 KiB) Viewed 761 times
5aaa.jpg
5aaa.jpg (96.76 KiB) Viewed 761 times

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

Re: How to extend a mshop_order_base table

Post by aimeos » 27 Jun 2022, 15:20

Thanks for tracking this down!

This is a left-over from the past where order base item doesn't extend from the common item class and where the code was duplicated in the order base item - but not for the custom properties. This has been fixed now in 2021.10.x-dev. Can you please test?

In dev-master, the order base item extends from common item class so this won't be a problem any more :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
IvanIgniter
Posts: 58
Joined: 01 Dec 2021, 07:41

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 28 Jun 2022, 05:34

Your welcome..

I switch now from aimeos/aimeos-core from 2021.10.19 to 2021.10.x-dev and it work. My added new fields are successfully saved to order_base table. Thank you so much.

Post Reply