Extend/Change Orders in admin

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!
ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Extend/Change Orders in admin

Post by ajrmzcs » 02 Aug 2018, 20:57

Hello,

Laravel 5.6,
Aimeos: 2018.07,
OS: Centos,

We are wondering which is the best method to extend/change the orders in admin in order to list unique orders (from mshop_order_base) with the latest invoice (mshop_order) information. At this moment we have extended to our custom module in ext, the template and Standard from orders.

As always, thank you very much for your help.

Regards,

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

Re: Extend/Change Orders in admin

Post by aimeos » 04 Aug 2018, 21:38

After discussing internally, we agreed that we don't understand your question :-)
Can you explain a bit more in detail?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Extend/Change Orders in admin

Post by ajrmzcs » 06 Aug 2018, 20:49

Hi Thanks for the response,

We are changing the way orders are listed... at this moment we have extended the search query and getting the info the way we want, also we managed to extend manager and item to get the required fields from query. Right now, we are trying yo make search filter work with a new field which is called order.base.total which is the sum of order.base.price + order.base.costs bu we are getting the following error:

Error Invalid name "order.base.total", /home/aimeos/aimeos-core/lib/mwlib/src/MW/Criteria/Expression/Compare/Base.php:97

Can you help me with that?

Thanks,

Regards.

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

Re: Extend/Change Orders in admin

Post by aimeos » 06 Aug 2018, 21:13

You have to add a search definition into your new manager like done here:
https://github.com/aimeos/aimeos-core/b ... rd.php#L24

The definiton is returned here when a search query is created:
https://github.com/aimeos/aimeos-core/b ... d.php#L426
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Extend/Change Orders in admin

Post by ajrmzcs » 06 Aug 2018, 22:55

Hi, thanks for your response... I was able to extend order managers and search criteria as you explained. However, when trying to buy any article, products are not added to the shopping cart and Im getting this error on laravel.log:

[2018-08-06 22:51:55] local.ERROR: serialize(): "modified" returned as member variable from __sleep() but does not exist {"userId":2,"email":"admin@exmaple.com","exception":"[object] (ErrorException(code: 0): serialize(): "modified" returned as member variable from __sleep() but does not exist at /home/aimeos/vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Order/Manager/Base/Base.php:119)
[stacktrace]

Can you help me with that?

Thank you very much.

Regards,

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

Re: Extend/Change Orders in admin

Post by aimeos » 07 Aug 2018, 08:15

The PHP serialize() method has problems with private variables. We released a new minor version of the Aimeos core which fixes that if you extend the order base item class. Please run "composer update"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Extend/Change Orders in admin

Post by ajrmzcs » 08 Aug 2018, 16:34

Hi,

Thanks for the quick fix. At this moment I'm capable of select a product and make the checkout process, but at the end Im getting the following SQL Exception:

An exception occurred while executing ' INSERT INTO "madmin_log" ( "facility", "timestamp", "priority", "message", "request", "siteid" ) VALUES ( 'client/html', '2018-08-08 16:27:24', 4, 'An exception occurred while executing '' INSERT INTO "madmin_log" ( "facility", "timestamp", "priority", "message", "request", "siteid" ) VALUES ( ''client/html'', ''2018-08-08 16:27:24'', 4, ''An exception occurred while executing '''' INSERT INTO "mshop_order_base_product" ( "baseid", "ordprodid", "type", "prodid", "prodcode", "suppliercode", "stocktype", "name", "mediaurl", "quantity", "currencyid", "price", "costs", "rebate", "tax", "taxrate", "taxflag", "flags", "status", "pos", "mtime", "editor", "target", "siteid", "ctime" ) VALUES ( 0, NULL, ''''default'''', ''''7'''', ''''T123456'''', '''''''', ''''default'''', ''''TestProduct'''', ''''preview/f/8/f8d1cbd29cb59c8df3ce739aeb8cb49d.png'''', ''''1'''', ''''USD'''', ''''100.00'''', ''''1.00'''', ''''0.00'''', ''''3.0300'''', ''''3.00'''', 0, 0, -1, 1, ''''2018-08-08 16:27:24'''', ''''admin@example.com'''', '''''''', 1, ''''2018-08-08 16:27:24'''' ) '''': SQLSTATE[23503]: Foreign key violation: 7 ERROR: insert or update on table "mshop_order_base_product" violates foreign key constraint "fk_msordbapr_baseid" DETAIL: Key (baseid)=(0) is not present in table "mshop_order_base".'', ''efec91882f37a7c819c02557a58dd3b0'', 1 ) '': SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block', 'efec91882f37a7c819c02557a58dd3b0', 1 ) ': SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block

being specific:

' INSERT INTO "madmin_log" ( "facility", "timestamp", "priority", "message", "request", "siteid" ) VALUES ( 'client/html', '2018-08-08 16:27:24', 4, 'An exception occurred while executing '' INSERT INTO "madmin_log" ( "facility", "timestamp", "priority", "message", "request", "siteid" ) VALUES ( ''client/html'', ''2018-08-08 16:27:24'', 4, ''An exception occurred while executing '''' INSERT INTO "mshop_order_base_product" ( "baseid", "ordprodid", "type", "prodid", "prodcode", "suppliercode", "stocktype", "name", "mediaurl", "quantity", "currencyid", "price", "costs", "rebate", "tax", "taxrate", "taxflag", "flags", "status", "pos", "mtime", "editor", "target", "siteid", "ctime" ) VALUES ( 0, NULL, ''''default'''', ''''7'''', ''''T123456'''', '''''''', ''''default'''', ''''TestProduct'''', ''''preview/f/8/f8d1cbd29cb59c8df3ce739aeb8cb49d.png'''', ''''1'''', ''''USD'''', ''''100.00'''', ''''1.00'''', ''''0.00'''', ''''3.0300'''', ''''3.00'''', 0, 0, -1, 1, ''''2018-08-08 16:27:24'''', ''''admin@example.com'''', '''''''', 1, ''''2018-08-08 16:27:24'''' ) '''': SQLSTATE[23503]: Foreign key violation: 7 ERROR: insert or update on table "mshop_order_base_product" violates foreign key constraint "fk_msordbapr_baseid" DETAIL: Key (baseid)=(0) is not present in table "mshop_order_base".'', ''efec91882f37a7c819c02557a58dd3b0'', 1 )

I've noticed that this also has to do with the order extension, because if I rollback "order" changes in my ext it works fine.

I really appreciate any help you can provide.

Thanks,

Regards.

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

Re: Extend/Change Orders in admin

Post by aimeos » 09 Aug 2018, 15:48

Seems like you don't update the "baseid" in the order product item after you've stored the record for mshop_order_base which returns the auto-generated ID for that new record
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ajrmzcs
Posts: 20
Joined: 09 Jul 2018, 21:59

Re: Extend/Change Orders in admin

Post by ajrmzcs » 09 Aug 2018, 19:31

Hi...
I didn't change any save action I only extended the search query for orders base in mshop.php and created some getters for my new fields in my order base Item class and added this fields to search config in my base manager class. Can you be more specific please?

I my extended order base manager class I bring the $searchConfig property and createItemBase, getSearchAttributes methods. Maybe there is something Im missing there?

Thanks for your help.

Regards,

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

Re: Extend/Change Orders in admin

Post by aimeos » 11 Aug 2018, 15:45

Maybe you've forgot the baseid field in one search SQL query so the baseid value isn't added to the item and saving that item then fails because of the database constraint?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply