Extend Model/Manager, Query has syntax error (missing ,)

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!
heural
Posts: 86
Joined: 09 Jun 2022, 07:55

Extend Model/Manager, Query has syntax error (missing ,)

Post by heural » 19 Dec 2024, 14:01

Hi Aimeos-Team,

with the upgrade from 2023 -> 2024 i have some trouble with the queries, e.g. in the Dashboard.

I have extended the order model (added 3 attributes/columns: order.customexported, order.customcustomerid, order.customusername) - thats worked in 2023 so far:

Now in 2024 (2024.10.x-dev), there are some missing "," next to my custom-fields.

Code: Select all

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mord."id" AS "order.id", mord."channel" AS "order.channel",
mord."siteid...' at line 2:
SELECT mord."id" AS "order.id", mord."siteid" AS "order.siteid", mord."ctime" AS "order.ctime", mord."mtime" AS "order.mtime", mord."editor" AS "order.editor", mord."invoiceno" AS "order.invoiceno", mord."relatedid" AS "order.relatedid", mord."channel" AS "order.channel", mord."datepayment" AS "order.datepayment", mord."datedelivery" AS "order.datedelivery", mord."statusdelivery" AS "order.statusdelivery", mord."statuspayment" AS "order.statuspayment", mord."customerid" AS "order.customerid", mord."customerref" AS "order.customerref", mord."comment" AS "order.comment", mord."sitecode" AS "order.sitecode", mord."langid" AS "order.languageid", mord."currencyid" AS "order.currencyid", mord."price" AS "order.price", mord."costs" AS "order.costs", mord."rebate" AS "order.rebate", mord."tax" AS "order.taxvalue", mord."taxflag" AS "order.taxflag", mord."cdate" AS "order.cdate", mord."cmonth" AS "order.cmonth", mord."cweek" AS "order.cweek", mord."cwday" AS "order.cwday", mord."chour" AS "order.chour", mord."customexported" AS "order.customexported", mord."customcustomerid" AS "order.customcustomerid", mord."customusername" AS "order.customusername"
mord."id" AS "order.id", mord."channel" AS "order.channel",
mord."siteid" AS "order.siteid", mord."invoiceno" AS "order.invoiceno",
mord."datepayment" AS "order.datepayment", mord."datedelivery" AS "order.datedelivery",
mord."statuspayment" AS "order.statuspayment", mord."statusdelivery" AS "order.statusdelivery",
mord."relatedid" AS "order.relatedid",
mord."sitecode" AS "order.sitecode", mord."customerid" AS "order.customerid",
mord."langid" AS "order.languageid", mord."currencyid" AS "order.currencyid",
mord."price" AS "order.price", mord."costs" AS "order.costs",
mord."rebate" AS "order.rebate", mord."tax" AS "order.taxvalue",
mord."taxflag" AS "order.taxflag", mord."customerref" AS "order.customerref",
mord."comment" AS "order.comment", mord."ctime" AS "order.ctime",
mord."mtime" AS "order.mtime", mord."editor" AS "order.editor",
mord."customexported" AS "order.customexported", mord."customcustomerid" AS "order.customcustomerid",
mord."customusername" AS "order.customusername"
FROM "mshop_order" mord
LEFT JOIN "mshop_order_product" AS mordpr ON ( mord."id" = mordpr."parentid" )
WHERE ( ( mord."siteid" IN ('','1.') AND mordpr."siteid" IN ('','1.') ) AND ( mordpr."siteid" IN ('','1.') ) )
GROUP BY mord."id", mord."siteid", mord."ctime", mord."mtime", mord."editor", mord."invoiceno", mord."relatedid", mord."channel", mord."datepayment", mord."datedelivery", mord."statusdelivery", mord."statuspayment", mord."customerid", mord."customerref", mord."comment", mord."sitecode", mord."langid", mord."currencyid", mord."price", mord."costs", mord."rebate", mord."tax", mord."taxflag", mord."cdate", mord."cmonth", mord."cweek", mord."cwday", mord."chour", mord."customexported", mord."customcustomerid", mord."customusername" mord."id"
ORDER BY mord."ctime" DESC, mord."id" DESC
LIMIT 10 OFFSET 0


Thank you for your support!
Thanks a lot!

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

Re: Extend Model/Manager, Query has syntax error (missing ,)

Post by aimeos » 19 Dec 2024, 14:52

Check if your code and search configuration looks like this and remove any overwritten SQL for the managers:
https://aimeos.org/docs/latest/models/e ... /#easy-way
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

heural
Posts: 86
Joined: 09 Jun 2022, 07:55

Re: Extend Model/Manager, Query has syntax error (missing ,)

Post by heural » 19 Dec 2024, 15:22

Yes I have (the "custom way"),
the only "overwritten" for "SQL-like" is the saveItem-Func. Do I dont need this anymore?

btw in the docu:

Code: Select all

    public function getSearchAttributes( bool $withsub = true ) : array
    {
        return parent::getSearchAttributes( $withsub ) + $this->createAttributes( $this->attr );
    }
should be this ?

Code: Select all

public function getSearchAttributes( bool $withsub = true ) : array
    {
        return parent::getSearchAttributes( $withsub ) + $this->createAttributes( $this->searchConfig);
    }
Thanks a lot!

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

Re: Extend Model/Manager, Query has syntax error (missing ,)

Post by aimeos » 19 Dec 2024, 16:45

heural wrote: 19 Dec 2024, 15:22 Yes I have (the "custom way"),
the only "overwritten" for "SQL-like" is the saveItem-Func. Do I dont need this anymore?
It's not needed any more. We've update the article in the docs accordingly.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply