tags:

views:

54

answers:

1

Hi there,

I'm installing some tracking code into the checkout_success.php page. I need to be able to grab the coupon code/discount code name from the order, if one was used so that I can echo it out in my tracking script.

I was wondering if anyone knows how to do this?

Thank you.

A: 

Hi Neil

which contribution are you using for discount coupons? It depends on which on you currently have.

Regards Shiva

shiva
Hey Shiva,I'm using this one;ot_discount_coupons.php, August 4, 2006, author: Kristen G. Thorson, ot_discount_coupon_codes version 3.0
Neil Bradley
hmm actually it is a order line.. so there must be a corresponding record in order_totals table. you can get the unique discount value using ot_<order line name> and the order value. Also, I believe you are passing the coupon code into the session..( not very sure here .. this might be just a post variable from checkout_payment.php to checkout_confirmation.php ).. you can use that variable for recording the exact coupon code being used ( or you can just use the text in the order totals table which will have the coupon code i believe). Let me know if that helps.Cheers
shiva
hey. it seems that the coupon code is not actually stored in the order_totals, but in a seperate discount_coupons_to_orders table. is there a query i can do on this table to find the matching coupon code used for this order? i tried the following but it return nothing;$coupon_query = tep_db_query("select coupons_id from discount_coupons_to_orders where orders_id = '".(int)$orders['orders_id']."' ORDER BY orders_id DESC LIMIT 1");$coupon_id = tep_db_fetch_array($coupon_query);$couponid = $coupon_id['coupon_id'];
Neil Bradley