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: 42
Joined: 01 Dec 2021, 07:41

How to extend a mshop_order_base table

Post by IvanIgniter » 13 Jun 2022, 09:59

I am using laravel 6.x, PHP 7.4, Docker desktop/Ubuntu and the Aimeos 2021 (aimeos-laravel: 2021.10.4 / aimeos-core: 2021.10.13)

I have implemented different decorators like customers, product, orders but this time I want to create a decorator for sub-item for mshop_order_base table. From the documentation I can't find any examples. Kindly help me how to implement it or give me a link.

Thank you

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

Re: How to extend a mshop_order_base table

Post by aimeos » 14 Jun 2022, 19:23

It's the same like for the domain managers, only the configuration contains the type of the sub-manager:
https://github.com/aimeos/aimeos-core/b ... p#L78-L105
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 15 Jun 2022, 07:29

I am not sure what you mean only the configuration contains the type of the sub-manager and based on the link.
This how I understand and did it but after php artisan aimeos:setup. No additional field was added in mshop_order_base table.
Please guide how it is done to make it right.
1.jpg
1.jpg (79.28 KiB) Viewed 301 times
2.jpg
2.jpg (149.49 KiB) Viewed 301 times
3.jpg
3.jpg (73.91 KiB) Viewed 301 times
I also tried this way
1a.jpg
1a.jpg (37.79 KiB) Viewed 300 times
And this
1b.jpg
1b.jpg (33.7 KiB) Viewed 298 times
and moved the Myproject.php file to
ext\ai-admin-jqadm\lib\custom\src\MShop\Order\Manager\Base\Decorator\Myproject.php

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

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 17 Jun 2022, 05:21

Waiting for a respond.. Please help what is the solution?

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

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 21 Jun 2022, 03:02

Could anybody help or suggest what to do if they encounter the same issue?

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

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 21 Jun 2022, 04:06

I have figured it out how to add the new columns to mshop_order_base but I couldn't display those added new fields.
Please advise what is the correct configuration to show it in aimeos admin order list page.
3a.jpg
3a.jpg (115.3 KiB) Viewed 234 times

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

Re: How to extend a mshop_order_base table

Post by aimeos » 21 Jun 2022, 06:38

Your schema file is now correct (order.php) but your decorator configuration must be:

Code: Select all

'mshop' => [
	'order' => [
		'manager' => [
			'base' => [
				'decorators' => [
					'local' => [
						'MyProject'
					]
				]
			]
		]
	]
]
See: https://aimeos.org/docs/2022.x/config/m ... atorslocal
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 21 Jun 2022, 11:16

Thank you..

'order' => [
'manager' => [
'base' => [
'decorators' => [
'local' => [
'Myproject'
]
]
],
'decorators' => [
'local' => ['Myproject']
]
]
]

Works for me.
The second mistake was the Decorator/Myproject should be mordba.fieldname not mordbase.fieldname

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

Re: How to extend a mshop_order_base table

Post by IvanIgniter » 24 Jun 2022, 05:51

Can I have a last one more question using a decorator.
I was able to display now what records are stored in the db but storing into that extra fields along with existing fields is not working.

Why is the comment field was the only one stored in the db and the new field last_name did not?
I was tracing the whole codes as will as the aimeos core to make it right but I can't figure it out.
Attachments
4a.jpg
4a.jpg (90.38 KiB) Viewed 194 times
4.jpg
4.jpg (156.23 KiB) Viewed 194 times

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

Re: How to extend a mshop_order_base table

Post by aimeos » 26 Jun 2022, 07:46

You must hand over "last_name", not "order.base.last_name". The key is exactly the same as you use in your decorator.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply