Jump to content

Fatal error: Call to undefined method Shop::addSqlRestriction() in Prestashop v1.4.8.2


Recommended Posts

Hi,

 

Can someone help me figuring out why this error message appears on a Prestashop installation v1.4.8.2?

 

Fatal error: Call to undefined method Shop::addSqlRestriction() in /home/www/modules/remarketing_emails_sms/remarketing_emails_sms.php on line 338

 

This is the code piece where, in the last line, this breaks:

$sql = 'SELECT c.id_cart, c.id_lang, cu.id_customer, c.id_shop, cu.firstname, cu.lastname, cu.email
        FROM '._DB_PREFIX_.'cart c
        LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = c.id_cart)
        LEFT JOIN '._DB_PREFIX_.'order_history oh ON (oh.id_order = o.id_order)
        RIGHT JOIN '._DB_PREFIX_.'customer cu ON (cu.id_customer = c.id_customer)
        RIGHT JOIN '._DB_PREFIX_.'cart_product cp ON (cp.id_cart = c.id_cart)
        WHERE DATE_SUB(CURDATE(),INTERVAL 90 DAY) <= c.date_add AND o.valid = 0 AND oh.id_order_state = "6"';

        $sql .= Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');

Any help will be much appreciated.

 

Thanks a lot.

 

Best regards,

Pedro Lima

Link to comment
Share on other sites

It would seem that module is not compatible with PrestaShop v1.4. It must be designed for PrestaShop v1.5 or later, since the Shop::addSqlRestriction function doesn't exist on your installation. You can try to remove that line, but it would be better for you to upgrade to a newer version of PrestaShop, since it's hard to find modules that are compatible with such an old version of PrestaShop.

Link to comment
Share on other sites

It would seem that module is not compatible with PrestaShop v1.4. It must be designed for PrestaShop v1.5 or later, since the Shop::addSqlRestriction function doesn't exist on your installation. You can try to remove that line, but it would be better for you to upgrade to a newer version of PrestaShop, since it's hard to find modules that are compatible with such an old version of PrestaShop.

 

First, let me thank you very much for your help.

 

Actually, this module was developed by me and it has backward compability. What I can do is, I can check for Prestashop version and not insert that line for versions bellow 1.5.

 

I have done that and then, a little more down on the code, there is an error on Shop::getContext on something I need to be shown. This is the line:

if (Shop::getContext() === Shop::CONTEXT_SHOP)

What do you say, can I simply remove this "if" when Prestashop version is belllow 1.5?

 

Thanks a lot.

Link to comment
Share on other sites

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...