Jump to content

mail alerts module causing error with order status change


Recommended Posts

I need a help with mail alerts module. Everytime I'm trying to change order status same error appear: (in both PS 1.5.6.2 and 1.6.0.14). Any suggestions?

 

[PrestaShopDatabaseException]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND TO_DAYS(NOW()) - TO_DAYS(sm.`date_add`) <= 7 AND s.`id_product` = 472 ' at line 14

            SELECT SUM(view.quantity) as quantity_out
            FROM
            (    SELECT sm.`physical_quantity` as quantity
                FROM `ps_stock_mvt` sm
                LEFT JOIN `ps_stock` s ON (sm.`id_stock` = s.`id_stock`)
                LEFT JOIN `ps_product` p ON (p.`id_product` = s.`id_product`)
                 INNER JOIN ps_product_shop product_shop
        ON (product_shop.id_product = p.id_product AND product_shop.id_shop = p.id_shop_default)
                LEFT JOIN `ps_product_attribute` pa ON (p.`id_product` = pa.`id_product`)
                 LEFT JOIN ps_product_attribute_shop product_attribute_shop
        ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop IN (5, 6, 8, 7, 2, 1, 3, 4))
                WHERE sm.`sign` = -1
                AND sm.`id_stock_mvt_reason` !=
                AND TO_DAYS(NOW()) - TO_DAYS(sm.`date_add`) <= 7
                AND s.`id_product` = 472
                AND s.`id_product_attribute` = 6330 AND s.`id_warehouse` = 1
                GROUP BY sm.`id_stock_mvt`
            ) as view LIMIT 1


at line 646 in file classes/db/Db.php

641.             WebserviceRequest::getInstance()->setError(500, '

 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
642.         }
643.         elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
644.         {
645.             if ($sql)
646.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
647.             throw new PrestaShopDatabaseException($this->getMsgError());
648.         }
649.     }
650.
651.     /**

    DbCore->displayError - [line 340 - classes/db/Db.php] - [1 Arguments]
    DbCore->query - [line 558 - classes/db/Db.php] - [1 Arguments]
    DbCore->getRow - [line 583 - classes/db/Db.php] - [2 Arguments]
    DbCore->getValue - [line 661 - classes/stock/StockManager.php] - [1 Arguments]
    StockManagerCore->getProductCoverage - [line 617 - modules/mailalerts/mailalerts.php] - [4 Arguments]
    MailAlerts->hookActionProductCoverage - [line 510 - classes/Hook.php] - [1 Arguments]
    HookCore::exec - [line 427 - classes/stock/StockManager.php] - [2 Arguments]
    StockManagerCore->removeProduct - [line 223 - classes/order/OrderHistory.php] - [9 Arguments]
    OrderHistoryCore->changeIdOrderState - [line 520 - controllers/admin/AdminOrdersController.php] - [3 Arguments]
    AdminOrdersControllerCore->postProcess - [line 171 - classes/controller/Controller.php]
    ControllerCore->run - [line 373 - classes/Dispatcher.php]
    DispatcherCore->dispatch - [line 54 - admin/index.php]
Link to comment
Share on other sites

  • 1 month later...

in my case cleaning up database table sort out this problem (ps_mailalert_customer) - but remember - you will lost all "mailalert" customer's data. And remember to do mysql backup before in case it not sort the problem.

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...