Jump to content

Assign Order Status based on product category


fr333n3rgy

Recommended Posts

Hello,

 

I need some help ... 

 

I have free digital products (downloads) in my shop with a 0.00 value set for price. When the users select the files to download they can get the files and they receive the email with the link (which is great). The problem is they also receive a "Payment Accepted" email (for 0.00) ...

 

All of the downloads belong to the Download category.

 

I can create a status called FREE Digital Product and disable emailing, so that's ok.

 

My question is, is there a way that I can change the code and/or assign the default (first) status for the category Download to be the status FREE Digital Product so that it is classified correctly and the user won't get a hart attack?

 

Thank you.

 

Link to comment
Share on other sites

What happens when the customer "purchases" the free download, but also purchases another product that costs money with the same order?

Prestashop correctly sets shipping to "FREE Shipping" when selling digital content, so it's smart. If you add a normal phisical item with a price it then correctly adds shipping - so that part works great -- for that matter it all works fine. I just would like change the code so that if the cart has a 0.00 value, it then assigns the first status to "Order Processed" instead of "Payment Processed". If the cart has a value > 0.00 then it goes its normal way. I can do the code, I just wanted to know which module is the best place to put the patch in ...  ie:

 

if (cart_value == 0.00 and line_items > 0) {

  set status = 14 // id of status

} else {

....

  whatever the normal code is .

....

}

 

Or something along those lines ...

Link to comment
Share on other sites

you have 2 options

 

1) edit each payment module that you use, and change the invocation of validateOrder to use your order status.

2) you could also create an override of the PaymentModule class, overriding the validateOrder function so it would perform your logic and set the order status accordingly

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