Jump to content

Catalog rules work only without condition ps 1.7.1


Recommended Posts

Dear all, 

 i'm tryng to apply a new specific cart rule that will discount by percentage a specific category of mine shop, if i add the rule whitout any condition it work and all the items in the shop will discounted, but if i add a condition (it can be indifferently a category, size, brand...) the rule doesn't work anymore.

Someone has encounter the same problem?

Attached the rule config, but the strange thing is whitout any condition it work, whit one it doesn't...

post-1325736-0-40773100-1493482782_thumb.png

Link to comment
Share on other sites

Hi Nemo, i've created a new developing website and install theme and module as the production website and logically here work rules work fine! :(

Is there a way to test the query the fornt office execute to display an article and check if there is something in the db corrupted?

Link to comment
Share on other sites

I've find a difference in a query return the specific price article between the two website installed, in the preduction website it doesn't take the id_product and doesn't return anything:

 

SELECT SQL_NO_CACHE *, ( IF (`id_group` = 3, 2, 0) + IF (`id_country` = 10, 4, 0) + IF (`id_currency` = 1, 8, 0) + IF (`id_shop` = 1, 16, 0) + IF (`id_customer` = 1, 32, 0)) AS `score`
FROM `ps_specific_price`
WHERE
`id_shop` IN (0, 1) AND
`id_currency` IN (0, 1) AND
`id_country` IN (0, 10) AND
`id_group` IN (0, 3) AND `id_product` = 0 AND `id_customer` = 0 AND `id_product_attribute` = 0 AND (`from` = '0000-00-00 00:00:00' OR '2017-05-06 00:00:00' >= `from`) AND (`to` = '0000-00-00 00:00:00' OR '2017-05-06 00:00:00' <= `to`)
AND IF(`from_quantity` > 1, `from_quantity`, 0) <= 1 ORDER BY `id_product_attribute` DESC, `id_cart` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC, `to` DESC, `from` DESC LIMIT 1

 

While in develop website the id_product as a value (also a difference between the statment, production use the '=' while dev use 'IN ()' but it doesn't influence the result)

 

SELECT SQL_NO_CACHE *, ( IF (`id_group` = 1, 2, 0) + IF (`id_country` = 10, 4, 0) + IF (`id_currency` = 1, 8, 0) + IF (`id_shop` = 1, 16, 0) + IF (`id_customer` = 0, 32, 0)) AS `score`
FROM `ps_specific_price`
WHERE
`id_shop` IN (0, 1) AND
`id_currency` IN (0, 1) AND
`id_country` IN (0, 10) AND
`id_group` IN (0, 1) AND `id_product` IN (0, 355) AND `id_customer` = 0 AND `id_product_attribute` = 0 AND (`from` = '0000-00-00 00:00:00' OR '2017-05-06 00:00:00' >= `from`) AND (`to` = '0000-00-00 00:00:00' OR '2017-05-06 00:00:00' <= `to`)
AND IF(`from_quantity` > 1, `from_quantity`, 0) <= 1 ORDER BY `id_product_attribute` DESC, `id_cart` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC, `to` DESC, `from` DESC LIMIT 1

 

Both query are taken from SpecificPrice.php that are the same file on both the website...

 

Now i'm stopping at this point and i can't understand why this difference, can you suggest something?

Edited by cippoco (see edit history)
Link to comment
Share on other sites

Yes there is, the threshold is set to 1000 actually

 

classes/SpecificPrice.php

 

protected static function filterOutField($fieldName, $fieldValue, $threshold = 1000)

Change the default threshold to like 10k instead

Fabio

  • Like 1
Link to comment
Share on other sites

Hi Fabio, 

 i've found it, i've created also a post under "bug report" forum section because i considered it as a bug, nowhere is explained how it work.

Why there is this limit? I can change it whitout any compromise?

Thank you

Link to comment
Share on other sites

Good question, I always wondered myself and it gave me plenty of headaches before finding out what it was.
Anyway I guess it's there to prevent excessive resource leakage, but if your server can handle it, no problem

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