Forums / Templates, Stylesheets, Page Layout / Only show gift certificate option on payment page if customer has a gift certificate

Only show gift certificate option on payment page if customer has a gift certificate

Views: 3,636

Results 1 to 20 of 26
16 Jul 2014, 6:34 PM
#1
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Only show gift certificate option on payment page if customer has a gift certificate

I want to Only show gift certificate option on payment page if customer has a gift certificate balance available
Is this possible?

16 Jul 2014, 11:54 PM
#2
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

ShopVille:

I want to Only show gift certificate option on payment page if customer has a gift certificate balance available Is this possible?How will you handle the situation where they have a gift code but haven't redeemed it yet?
Do you want to hide the redemption part as well?

17 Jul 2014, 3:28 PM
#3
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

In my case there's no gift codes, we add a gift card balance to the account so we only want to show the redemption option when the customer actually has a balance available

20 Jul 2014, 8:40 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

I believe to only show GVs when there is a customer balance and to not even ask for a GV code, you would change:

      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array('title' => MODULE_ORDER_TOTAL_GV_TEXT_ENTER_CODE,
                         'field' => zen_draw_input_field('gv_redeem_code', '', 'id="disc-'.$this->code.'" onkeyup="submitFunction(0,0)"'),
                         'tag' => 'disc-'.$this->code
                         )));

to read:

if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array(
                         'tag' => 'disc-'.$this->code
                         )));
}

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 4:42 PM
#5
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

I believe to only show GVs when there is a customer balance and to not even ask for a GV code, you would change:

  $selection = array('id' => $this->code,
                     'module' => $this->title,
                     'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                     'checkbox' => $this->use_credit_amount(),
                     'fields' => array(array('title' => MODULE_ORDER_TOTAL_GV_TEXT_ENTER_CODE,
                     'field' => zen_draw_input_field('gv_redeem_code', '', 'id="disc-'.$this->code.'" onkeyup="submitFunction(0,0)"'),
                     'tag' => 'disc-'.$this->code
                     )));
> 
> to read:
> ```
if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array(
                         'tag' => 'disc-'.$this->code
                         )));
}

Thanks but it didn't seem to change anything

21 Jul 2014, 4:44 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Are you saying a customer with a 0 GV balance still sees the GV info on the checkout_payment page?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 4:48 PM
#7
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

Are you saying a customer with a 0 GV balance still sees the GV info on the checkout_payment page?

Yes.
Oh i need 7 characters

21 Jul 2014, 4:53 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Could you post the code that you have for the function credit_selection() in the ot_gv.php file?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 5:01 PM
#9
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

 /**
   * check system to see if GVs should be made available or not. If true, then supply GV-selection fields on checkout pages
   */
  function credit_selection() {
    global $db, $currencies;
    $gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
    // checks to see if any GVs are in the system and active or if the current customer has any GV balance
    if ($gv_query->RecordCount() > 0 || $this->use_credit_amount()) {
    if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array(
                         'tag' => 'disc-'.$this->code
                         )));
}
    return $selection;
  }
  /**
21 Jul 2014, 5:15 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Looks like you have and error in the brackets, try using:

  function credit_selection() {
    global $db, $currencies;
    $gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
    // checks to see if any GVs are in the system and active or if the current customer has any GV balance
    if ($gv_query->RecordCount() > 0 || $this->use_credit_amount()) {

if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array(
                         'tag' => 'disc-'.$this->code
                         )));
}

    }
    return $selection;
  }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 5:21 PM
#11
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

Looks like you have and error in the brackets, try using:

function credit_selection() {
global $db, $currencies;
$gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
// checks to see if any GVs are in the system and active or if the current customer has any GV balance
if ($gv_query->RecordCount() > 0 || $this->use_credit_amount()) {

if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
$selection = array('id' => $this->code,
'module' => $this->title,
'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
'checkbox' => $this->use_credit_amount(),
'fields' => array(array(
'tag' => 'disc-'.$this->code
)));
}

}
return $selection;

}

No change
21 Jul 2014, 5:23 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Add to it:

[B]echo 'ot_gv Customer Balance: ' . $this->user_has_gv_account($_SESSION['customer_id']) . '<br>';
[/B]if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {

What displays on the checkout_payment page?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 5:26 PM
#13
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

Add to it:

[B]echo 'ot_gv Customer Balance: ' . $this->user_has_gv_account($_SESSION['customer_id']) . '<br>';
[/B]
if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {

> 
> What displays on the checkout_payment page?

Gift Certificates
To use Gift Certificate funds already in your account, type the amount you wish to apply in the box that says 'Apply Amount'. You will need to choose a payment method, then click the continue button to apply the funds to your shopping cart.

If you are redeeming a new Gift Certificate you should type the number into the box next to Redemption Code. The amount redeemed will be added to your account when you click the continue button.

Redemption Code
21 Jul 2014, 5:30 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Do you see anywhere on the checkout_payment a line that starts with:

ot_gv Customer Balance:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 5:34 PM
#15
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

Do you see anywhere on the checkout_payment a line that starts with:
Do you mean in /includes/templates/your_template/templates/tpl_checkout_payment_default.php
?

21 Jul 2014, 5:35 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Sorry, move that line to be higher in the code in the ot_gv.php file:

  function credit_selection() {
    global $db, $currencies;
    $gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
    // checks to see if any GVs are in the system and active or if the current customer has any GV balance
[B]echo 'ot_gv Customer Balance: ' . $this->user_has_gv_account($_SESSION['customer_id']) . '<br>';
[/B]    if ($gv_query->RecordCount() > 0 || $this->use_credit_amount()) {

if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array(
                         'tag' => 'disc-'.$this->code
                         )));
}

    }
    return $selection;
  }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 5:40 PM
#17
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

Sorry, move that line to be higher in the code in the ot_gv.php file:

function credit_selection() {
global $db, $currencies;
$gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
// checks to see if any GVs are in the system and active or if the current customer has any GV balance
[B]echo 'ot_gv Customer Balance: ' . $this->user_has_gv_account($_SESSION['customer_id']) . '<br>';
[/B]
if ($gv_query->RecordCount() > 0 || $this->use_credit_amount()) {

if ($this->user_has_gv_account($_SESSION['customer_id']) > 0) {
$selection = array('id' => $this->code,
'module' => $this->title,
'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
'checkbox' => $this->use_credit_amount(),
'fields' => array(array(
'tag' => 'disc-'.$this->code
)));
}

}
return $selection;

}


Still nothing
21 Jul 2014, 5:50 PM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

Look at your file on your computer for:
\includes\modules\order_total\ot_gv.php

What is its date and time?

Look at the file on the server for:
/includes/modules/order_total/ot_gv.php

What is its date and time? :lookaroun

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Jul 2014, 6:12 PM
#19
shopville avatar

shopville

Zen Follower

Join Date:
Aug 2012
Posts:
331
Plugin Contributions:
0

Re: Only show gift certificate option on payment page if customer has a gift certificate

Ajeh:

Look at your file on your computer for:
\includes\modules\order_total\ot_gv.php

What is its date and time?

Look at the file on the server for:
/includes/modules/order_total/ot_gv.php

What is its date and time? :lookaroun

A few 2nds apart.
Perhaps here lies the problem i'm working on /includes/classes/modules/order_total/ot_gv.php

21 Jul 2014, 6:24 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Only show gift certificate option on payment page if customer has a gift certificate

That would be a problem as there isn't a directory:
/includes/classes/modules/order_total

nor a directory:
/includes/classes/modules

Order Total modules are in the directory:
/includes/modules/order_total

You may wish to compare your files on both your computer and server with a clean zip of Zen Cart v1.5, as it looks like you have your files/directories a bit out of wack ... :blink:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!