Jump to content

Query to fetch discounts/vouchers for products in cart


Recommended Posts

Hi, 

I'm trying to write a query to fetch all the discounts/vouchers for product(s) in the shopping cart. But I'm having trouble having to relate the tables of product and cart_rule.

So far I've managed to write this query.

SELECT PCRL.name, PCR.id_cart_rule, PCR.code, PCR.date_from, PCR.date_to, PCR.active, PCR.reduction_amount FROM ps_cart_rule_lang PCRL JOIN ps_cart_rule PCR ON PCR.id_cart_rule = PCRL.id_cart_rule;

This query only fetches all the vouchers irrespective of the products. I need to add a where clause to it. I'm not able to get what should be in the where clause. Please help.

Regards

Bhagirath

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