Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Change the Coupon code to description

Change the Coupon code to description

Locked

Views: 1,533

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
8 Aug 2010, 12:15 PM
#1
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Change the Coupon code to description

Hi,
Can I display the 'coupon description' instead of the 'coupon code' in the:

  1. Order Information detail page (Account History Info).
  2. in the email that the customer get after he made an order

(Especially in the occurrences i describe above but also in all the places the customer can see it)

Thank you!

8 Aug 2010, 8:36 PM
#2
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: Change the Coupon code to description

Anyone? please.

9 Aug 2010, 12:19 PM
#3
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: Change the Coupon code to description

All I'm asking is how I'm showing to my buyer the "coupun description" or at least the "coupon name" instead of the coupon code in the order confirmation email and in the order history info page???? please...

9 Aug 2010, 5:25 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change the Coupon code to description

Sorry we are not as fast as you like to write the custom code for you but sometimes ...

1 we are not here 24/7

2 it takes quite some time to write the custom code

See if this works if you customize the order class code with:

    //comments area
    if ($this->info['comments']) {
      $email_order .= zen_db_output($this->info['comments']) . "\n\n";
      $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
    } else {
      $html_msg['ORDER_COMMENTS'] = '';
    }

// bof: add coupon_description here
    global $db;
    $chk_coupon_code_query = "SELECT coupon_code
                  from " . TABLE_ORDERS . "
                  where orders_id ='" . $zf_insert_id . "'";
    $chk_coupon_code = $db->Execute($chk_coupon_code_query);

    $chk_coupon_id_query = "SELECT coupon_id
                  from " . TABLE_COUPONS . "
                  where coupon_code ='" . $chk_coupon_code->fields['coupon_code'] . "'";
    $chk_coupon_id = $db->Execute($chk_coupon_id_query);

    $chk_coupon_description_query = "SELECT coupon_description
                  from " . TABLE_COUPONS_DESCRIPTION . "
                  where coupon_id ='" . $chk_coupon_id->fields['coupon_id'] . "'";
    $chk_coupon_description = $db->Execute($chk_coupon_description_query);

    if ($chk_coupon_description->fields['coupon_description']) {
      // if found add to the comments
      $email_order .= 'Discount code should be: ' . $chk_coupon_code->fields['coupon_code'] . "\n\n" . zen_db_output($chk_coupon_description->fields['coupon_description']) . "\n\n";
      $html_msg['ORDER_COMMENTS'] .= nl2br(zen_db_output($chk_coupon_description->fields['coupon_description']));
    }
// eof: add coupon_description here

    //products area
9 Aug 2010, 7:00 PM
#5
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: Change the Coupon code to description

First, Sorry!
Second Thank you!!
(I guess I got a little bit swept away by my haste...)

I will check it and update you.

9 Aug 2010, 10:08 PM
#6
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: Change the Coupon code to description

Thaks,

  1. The coupon code still appear in the Order confirmation email. How can I remove it?
  2. How can I replace it also with the coupon description in the Order Information page (account_history_info)?
10 Aug 2010, 3:53 AM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change the Coupon code to description

You would need to customize the Discount Coupon Order Total module ot_coupon.php

I believe the section of code you want to change would be:

      $this->output[] = array('title' => $this->title . ': ' . $this->coupon_code . ' :',
                              'text' => '-' . $currencies->format($od_amount['total']),
                              'value' => $od_amount['total']);

NOTE: removing that from the code will remove it from display on the order in the Customers ... Orders ... and it will remove it from the Customer's Account when review the order ...

10 Aug 2010, 12:52 PM
#8
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: Change the Coupon code to description

Thanks Ajeh,
As you said removing it removes it from all other places,

Is there any way to replace the $this->coupon_code with $this->coupon_description in the above code?

I want to show the buyer the coupon description and not the coupon code.

10 Aug 2010, 4:33 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change the Coupon code to description

What would happen is you would have the Totals section of the order displaying the Discount Coupon Description right in the middle ...

Currently ...

In the Order, the Store Owner can click on the link for the Discount Coupon for a popup for the description ...

On the My Account the Customer can click on the link for the Discount Coupon to get a popup with the description ...

The Customer can go to the Information box and click on a link for the Discount Coupons and get a page with the description ...

In the email, just the Discount Coupon code is displayed in the Totals section of the Order email ...

Adding the Discount Coupon description in the middle of the Order Totals is going to make things very difficult to read ...

This is why I suggest adapting the email that is being sent out where you can add the code I posted somewhere in the email to give the summary in a clear and concise manner so as not to confuse the Customer or cause confusion on lost of information in the Admin Order for the Store Owner ...

10 Aug 2010, 8:08 PM
#10
timontom avatar

timontom

New Zenner

Join Date:
Aug 2010
Posts:
25
Plugin Contributions:
0

Re: Change the Coupon code to description

Ok. Got it.
But how can i display also the Discount Coupon description in the ot_coupon.php (account history info - the order Information page)?

Thanks.

10 Aug 2010, 9:30 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change the Coupon code to description

Without sitting down and writing all of the custom code for you it is going to take a while before I can ...

You should be able to use a lot of the code that I posted to search for the coupon code on the order and then display the coupon_description on the pages that you need it ...

For the account_history_info, I think you can access the orders_id with:
$_GET['order_id']

And for the orders.php in the Admin, I think you can access the orders_id with the:
$_GET['oID']

see if that doesn't help you get the information that you need ...