Apply a coupon to a manual order

canuckistani - August 25, 2009 - 17:43
Project:Ubercart Discount Coupons
Version:6.x-1.3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

We have a fair number of orders created by staff for customers, and want to use coupons to provide standard discounts for these customers ( resellers, actually ). I've implemented the ability to apply a coupon directly to an order in the order edit form:

- and order / edit pane for the coupon input form
- a JS callback to apply the coupon to the order
- a copy of uc_coupon that takes the order_id as the second param, loads the order instead of the cart, then loops through the order->products array to calculate the total discount.

It occurred to me while doing this that a) this might be useful to somebody else, and b) this could be made simpler by re-factoring uc_coupon_validate() to take either the cart contents *or* the order products as a param.

I realize you're already thinking about version 2; if this feature is interesting enough to you I could roll a patch against uc_coupon 1.x HEAD in the next week or so.

#1

longwave - September 17, 2009 - 18:59

Version 2 is a long way off (or may never come, as uc_discount seems to be coming along well enough that it could eventually replace uc_coupon entirely), so if you have time to provide a patch for this, please do!

 
 

Drupal is a registered trademark of Dries Buytaert.