en Jump to content
  • 0
cippoco

Catalog rules work only without condition ps 1.7.1

Question

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

Share this post


Link to post
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Hi Nemo, yes, just a condition over the standard config couse the catalog rule stop to work, ps version is 1.7.1.1 and i use webservice to populate store facets and products.

Share this post


Link to post
Share on other sites
  • 0

I'm gone to create it and i let you know, i've tryed to run the rule whit the default theme and whit 3rd part modules disabled but was the same...

Share this post


Link to post
Share on other sites
  • 0

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?

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

That's very odd. Something on your live site is preventing the code before the query from retrieving product ids.
How many products does your catalog have on the live site?

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
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

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More