Zen Cart Logo
Forums / Discounts/Coupons, Gift Certificates, Newsletters, Ads / Discount Category TOP Deny problem

Discount Category TOP Deny problem

Views: 1,993

Results 1 to 11 of 11
27 May 2012, 02:16
#1
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Discount Category TOP Deny problem

Discount Coupon
10% discount
Category Top Deny
Product Restrictions: One specific product ALLOW

Discount Coupon Code functions as desired. If customer does not have the specific item in the cart, they get the RED error message. When the specific item is in the cart, they get the GREEN success message.

The issue is IF they click on the coupon code in the checkout screen, they see:

Category **This coupon is valid for all categories.

This portion of the message is the same regardless of Category Top Deny or Category Top Allow
Customer calls very grumpy because the text for the discount coupon indicates that it is valid for all categories
and the discount was not applied to the entire order. Discount was applied as intended by the discount setup.**
Have I missed something in the setup? Is it a terminology issue?

V1.3.9h

TNX
Rick

Discount code: SSW0612JPL

=========================================
Complete text of the coupon code popup window:

Congratulations, you have redeemed a Discount Coupon.

Coupon Name : SSW JunJul 2012

The coupon is worth 10.00% discount against your order

The coupon is valid between 05/13/2012 and 05/13/2013**

Product/Category Restrictions**

Category

  • This coupon is valid for all categories.
    Product
  • JPL3 Square Bracelet ►►► (Allowed)
    Discount Coupons may not be applied towards the purchase of Gift Certificates.
27 May 2012, 02:50
#2
ajeh avatar

ajeh

Oba-san

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

Re: Discount Category TOP Deny problem

Hate that issue ... :lamo:

Give a bit, as in 10 minutes to 48 hours, to fool with this one and come up with a better solution to how to manage this code for the messages and not goober up the code for other combinations ... :frusty:

27 May 2012, 12:50
#3
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Discount Category TOP Deny problem

TNX Linda. This was the first customer in 3 years who has ever clicked the discount code to see the text and I never noticed that the discount code was a link so it took me a while to figure out how they were reading the text.

If it requires "too much goobering", we understand and can live with it.:smile:

27 May 2012, 16:59
#4
ajeh avatar

ajeh

Oba-san

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

Re: Discount Category TOP Deny problem

You can try this change to the file:
/includes/modules/discount_coupon/header_php.php

with the code in RED:

      $cats = array();
      $skip_cat_restriction = true;

// bof: of fix for Product Only 
/*
      while (!$get_result->EOF) {
        if ($get_result->fields['coupon_restrict'] == 'N') {
          $restrict = TEXT_CAT_ALLOWED;
        } else {
          $restrict = TEXT_CAT_DENIED;
        }
        if ($get_result->RecordCount() != 1 and $get_result->fields['category_id'] != '-1') {
          $result = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id
          and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_id='" . $get_result->fields['category_id'] . "'");
          $cats[] = array("validity"=> ($get_result->fields['coupon_restrict'] =='N' ? 'A' : 'D'), 'name'=> $result->fields["categories_name"], 'link'=>'<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$result->fields['categories_id']) . '">' . $result->fields["categories_name"] . '</a>' . $restrict);
        }
        $get_result->MoveNext();
      }

      if ($skip_cat_restriction == false || sizeof($cats) == 0) $cats[] = array("link" => TEXT_NO_CAT_RESTRICTIONS);
*/


      while (!$get_result->EOF) {
        if ($get_result->fields['coupon_restrict'] == 'N') {
          $restrict = TEXT_CAT_ALLOWED;
        } else {
          $restrict = TEXT_CAT_DENIED;
        }
        if ($get_result->RecordCount() != 1 and $get_result->fields['category_id'] != '-1') {
          $result = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id
          and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_id='" . $get_result->fields['category_id'] . "'");
          $cats[] = array("validity"=> ($get_result->fields['coupon_restrict'] =='N' ? 'A' : 'D'), 'name'=> $result->fields["categories_name"], 'link'=>'<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$result->fields['categories_id']) . '">' . $result->fields["categories_name"] . '</a>' . $restrict);
$no_categories = '';
        } else {
$no_categories = '<p>Specific Products Only</p>';
        }
        $get_result->MoveNext();
      }

      if ($skip_cat_restriction == false || (sizeof($cats) == 0 && !$no_categories)) {
        $cats[] = array("link" => TEXT_NO_CAT_RESTRICTIONS);
      } else {
        if ($no_categories != '') {
          $cats[] = array("link" => $no_categories);
        }
      }
// eof: of fix for Product Only 

      sort($cats);
      $mycats = array();

Not a perfect solution but takes away the confusion on that ...

NOTE: check other Discount Coupons to ensure they still look good ...

27 May 2012, 17:56
#5
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Discount Category TOP Deny problem

You can try this change to the file:
/includes/modules/discount_coupon/header_php.php

I assume that you meant:
/includes/modules**/pages/**discount_coupon/header_php.php

but there is no change in the text displayed to the customer in**:

**/index.php?main_page=popup_coupon_help&cID=51

after inserting the code in red.

OR

**/includes/templates/template_default/popup_coupon_help/tpl_main_page.php

**Text is displayed as expected in the coupon popup window now.

**Do I leave the code in both files or just one? **OR have I really messed things up thinking that I am helping?

$cats = array();
$skip_cat_restriction = true;

[B]Added RED code here[/B] in front of existing code in blue

      while (!$get_result->EOF) {
        if ($get_result->fields['coupon_restrict'] == 'N') {
          $restrict = TEXT_CAT_ALLOWED;
        } else {
          $restrict = TEXT_CAT_DENIED;
        }
        if ($get_result->RecordCount() != 1 and $get_result->fields['category_id'] != '-1') {
          $result = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id
          and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_id='" . $get_result->fields['category_id'] . "'");
          $cats[] = array("validity"=> ($get_result->fields['coupon_restrict'] =='N' ? 'A' : 'D'), 'name'=> $result->fields["categories_name"], 'link'=>'<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$result->fields['categories_id']) . '">' . $result->fields["categories_name"] . '</a>' . $restrict);
        }
        $get_result->MoveNext();
      }

      if ($skip_cat_restriction == false || sizeof($cats) == 0) $cats[] = array("link" => TEXT_NO_CAT_RESTRICTIONS);

  sort($cats);
  $mycats = array();
27 May 2012, 17:59
#6
ajeh avatar

ajeh

Oba-san

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

Re: Discount Category TOP Deny problem

Replace the code between the two sections in BLACK with the code in RED ...

27 May 2012, 20:03
#7
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Discount Category TOP Deny problem

Sorry. I read change and inserted rather than replace.

Still not certain which one of the two files you meant, so I replaced the code in both files.

Change to /includes/modules/pages/discount_coupon/header_php.php did not seem to have any effect (that I could see).

Change to /includes/templates/template_default/popup_coupon_help/tpl_main_page.php **did change text in the coupon popup as expected.

Thank you for the help. **This also taught us the lesson to be very specific in our choice of words for print ads that appear in Internationally circulated magazines.

27 May 2012, 22:39
#8
ajeh avatar

ajeh

Oba-san

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

Re: Discount Category TOP Deny problem

This one:

Change to /includes/modules/pages/discount_coupon/header_php.php did not seem to have any effect (that I could see).

should of fixed it when you go to check the Discount Coupon from the Information link ...

This one would work in the checkout:

**/includes/templates/template_default/popup_coupon_help/tpl_main_page.php
**

I am not sure why it would not work for you on the discount_coupon page ...

What are your exact Restrictions settings on this coupon? :unsure:

28 May 2012, 13:06
#9
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

Re: Discount Category TOP Deny problem

Sorry. Brainfart on this end, only looking in one place. :bangin:

It's fine in both places. I wasn't even thinking about the information link.

The exact settings are
category restrictions top deny
product restrictions: Product ID 258 allow

All appears well in the discount coupon world. Thank you helping me.

28 May 2012, 13:33
#10
ajeh avatar

ajeh

Oba-san

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

Re: Discount Category TOP Deny problem

Thanks for the update that this is now working for you ... :smile:

30 May 2012, 02:52
#11
nicolelee0507 avatar

nicolelee0507

New Zenner

Join Date:
May 2012
Posts:
1
Plugin Contributions:
0

Re: Discount Category TOP Deny problem

Hello:smile: