Jump to content

What hook is responsible for querying products in 1.7 ?


Recommended Posts

I basically need to set up custom rules for which products should be displayed based on various conditions. E.g. is user with the user group "X" is logged in, only display products that has a specific price for group "X" set up, the rest should be hidden completely. Is there a hook, or a core function in which I could add my code?

Thank you.

Link to comment
Share on other sites

Thank you, but I need to make an automated solution, so I won't have to set these rules for each product individually.

I just want to set up a rule in code (e.g. if [column] in [ps_products] table for current product equals 0, do not display it for users in [group_x], etc.).

For example in WooCommerce I can easily hook into 'woocommerce_product_query' and alter the query settings with custom rules. I'm looking for a similar solution for PS. :)

Link to comment
Share on other sites

  • 6 months later...
  • 2 weeks later...
En 13/7/2020 a las 10:39 AM, TinoArts dijo:

Thank you, but I need to make an automated solution, so I won't have to set these rules for each product individually.

I just want to set up a rule in code (e.g. if [column] in [ps_products] table for current product equals 0, do not display it for users in [group_x], etc.).

For example in WooCommerce I can easily hook into 'woocommerce_product_query' and alter the query settings with custom rules. I'm looking for a similar solution for PS. :)

You can do it with this module, it's not needed to set a rule for each product.

For example, you could set: "If product price is between X and Y, hide for customers group Z".

Link to comment
Share on other sites

I understand, but I've checked their back end demo and it really seems it doesn't fit my use case.

I need to hide all products for [customer group X], that do not have a specific price set explicitly for [customer group X]. In that module I can only filter the products to be hidden by price, sale, stock, etc., not this specific condition.

Link to comment
Share on other sites

hace 17 horas, TinoArts dijo:

I understand, but I've checked their back end demo and it really seems it doesn't fit my use case.

I need to hide all products for [customer group X], that do not have a specific price set explicitly for [customer group X]. In that module I can only filter the products to be hidden by price, sale, stock, etc., not this specific condition.

Yes you can, with this option:

image.thumb.png.45443900d69735036f375f1a5f06f5a4.png

 

Please send a message here https://addons.prestashop.com/contact-form.php?id_product=7422 to configure exactly what you need.

Link to comment
Share on other sites

Do you mean the "Hide products without discount" setting?

That is not my use case unfortunately.

I have three customer groups: B2B-1, B2B-2, B2B-3
For some products I have the Specific prices set only for group B2B-1, B2B-2, or B2B-3

For example, some product might not have any of those specific prices, it should be completely hidden for all three B2B user groups. Some products might only have a B2B-1 specific price set, it would only show to B2B-1 customer group. Some products might have all three, they would be visible to all three groups.

In WooCommerce I can hook into 'woocommerce_is_purchasable' for this, or even alter the query completely with 'pre_get_posts' hook, which would totally fit my use case based on my custom conditions. Isn't there anything similar in Presta 1.7?

Link to comment
Share on other sites

hace 3 horas, TinoArts dijo:

Do you mean the "Hide products without discount" setting?

That is not my use case unfortunately.

I have three customer groups: B2B-1, B2B-2, B2B-3
For some products I have the Specific prices set only for group B2B-1, B2B-2, or B2B-3

For example, some product might not have any of those specific prices, it should be completely hidden for all three B2B user groups. Some products might only have a B2B-1 specific price set, it would only show to B2B-1 customer group. Some products might have all three, they would be visible to all three groups.

In WooCommerce I can hook into 'woocommerce_is_purchasable' for this, or even alter the query completely with 'pre_get_posts' hook, which would totally fit my use case based on my custom conditions. Isn't there anything similar in Presta 1.7?

I'm pretty sure you can configure this with this module. Please send a message here https://addons.prestashop.com/contact-form.php?id_product=7422 and we will help you to configure exactly what you need.

Link to comment
Share on other sites

OK I just got confirmation that it is not doable with the mentioned module.

Is there anyone who would help me finding the code that queries the products on category/catalog pages? I can get all the necessary information from the database, I just need to know where can I put my conditions and filters. Something like 'pre_get_posts' in WP. Anyone? Thank you.

  • Like 1
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...