Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Mar 2009
    Location
    Trowbridge, Wiltshire
    Posts
    121
    Plugin Contributions
    0

    Default How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Dear all,

    I use two types of payment method - Invoice Only and PayPal Express.

    I would like customers who belong to the "Invoice" group just to get the option of "invoice". Currently Invoice customers are getting the additional option of using paypal and I dont want this.

    Is there a way of being able to not show paypal as a payment method for Invoice only customers? I am not a coder so if there is a possible solution to this I would really appreciate the help.


    Many thanks

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Quote Originally Posted by scottmcclean View Post
    I would like customers who belong to the "Invoice" group just to get the option of "invoice".
    How are you telling Zen Cart that these customers are "invoice only"?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Mar 2009
    Location
    Trowbridge, Wiltshire
    Posts
    121
    Plugin Contributions
    0

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Hi DrByte,
    I use the Invoice Payment Module for ZenCart 1.3 in conjunction with the Group Pricing Per Item Module. All the elements working brilliantly I just dont want the customers who are assigned to the Invoice group to see the paypal option.

    I have attached some images to better illustrate.
    Click image for larger version. 

Name:	Invoice_Paypal.jpg 
Views:	87 
Size:	24.1 KB 
ID:	11975
    Attached Images Attached Images  
    Last edited by scottmcclean; 20 Feb 2013 at 01:40 PM. Reason: poor image

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,683
    Plugin Contributions
    123

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    The invoice payment module has logic in it to only enable it for customers in a group whose name starts with "invoice". Copy this logic to paypal and invert it so that paypal only appears to customers who are NOT in a group whose name starts with invoice.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Mar 2009
    Location
    Trowbridge, Wiltshire
    Posts
    121
    Plugin Contributions
    0

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Hi - what you say makes sense, but I have no idea what I would need to do to make it happen.

    could i get some help with the code?

  6. #6
    Join Date
    Mar 2009
    Location
    Trowbridge, Wiltshire
    Posts
    121
    Plugin Contributions
    0

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Hi is anyone able to assist with this?

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Simple to do:
    a) I downloaded the invoice plugin
    b) I looked at the update_status() code
    c) I copied the code there that handles the group detection
    d) I changed the final check for false to true, since you're looking for the opposite effect
    e) the end result when added to the PayPal EC module is:

    Code:
      function update_status() {
        global $order, $db;
        if ($this->enabled && (int)$this->zone > 0) {
          $check_flag = false;
          $sql = "SELECT zone_id
                  FROM " . TABLE_ZONES_TO_GEO_ZONES . "
                  WHERE geo_zone_id = :zoneId
                  AND zone_country_id = :countryId
                  ORDER BY zone_id";
          $sql = $db->bindVars($sql, ':zoneId', $this->zone, 'integer');
          $sql = $db->bindVars($sql, ':countryId', $order->billing['country']['id'], 'integer');
          $check = $db->Execute($sql);
          while (!$check->EOF) {
            if ($check->fields['zone_id'] < 1) {
              $check_flag = true;
              break;
            } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
              $check_flag = true;
              break;
            }
            $check->MoveNext();
          }
    
          if (!$check_flag) {
            $this->enabled = false;
          }
    
          // module cannot be used for purchase > $10,000 USD
          $order_amount = $this->calc_order_amount($order->info['total'], 'USD');
          if ($order_amount > 10000) $this->enabled = false;
          if ($order->info['total'] == 0) $this->enabled = false;
          
          // disable for invoice-only customers
          $group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
          if ($this->enabled == true) {
            $check_flag_group = false;
            $check = $db->Execute("select group_name from " . TABLE_GROUP_PRICING . " where group_id = '" . $group_query->fields['customers_group_pricing'] . "'");
            if ($check->RecordCount() ==  1) {
              $invoice_prefix = "invoice";
              $check_prefix = substr($check->fields['group_name'], 0, strlen($invoice_prefix));
              if (strcasecmp($check_prefix, $invoice_prefix) == 0) {
                $check_flag_group = true;
              }
            }
            if ($check_flag_group == true) {
              $this->enabled = false;
            }
          }
          
        }
      }
    Shameless reminder: Donations always welcome: www.zen-cart.com/donate
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Mar 2009
    Location
    Trowbridge, Wiltshire
    Posts
    121
    Plugin Contributions
    0

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Dr Byte, thank you very much for taking the time to help, much appreciated.

    I have copied this code to the paypalwpp.php and paypaldp.php pages which were the only ones I could find with the code: ( // module cannot be used for purchase > $10,000 USD). I have uploaded the pages but I am still getting the paypal payment option.

    Clearly I am doing somthing wrong. Are the 2 pages I updated the correct ones?

  9. #9
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    The code I quoted was tested successfully in, and copied-and-posted-from the paypalwpp.php file (which is the express checkout module).

    And the paypaldp.php file (payments pro) should work by making the same change.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Mar 2009
    Location
    Trowbridge, Wiltshire
    Posts
    121
    Plugin Contributions
    0

    Default Re: How do I make Invoice-Only Customers not see PayPal as a payment choice?

    Hi Dr Byte,
    thanks for your reply. I have zero doubts that you are right it, I just cant figure out what I may have done wrong.

    I have attached the code I have added in to the paypalwpp.php file Click image for larger version. 

Name:	paypalwpp.jpg 
Views:	53 
Size:	20.8 KB 
ID:	12443 - I just copied/paste. I would appreciate your thoughts - could it be a difference in a database field name or something like that?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 10 Aug 2011, 02:07 AM
  2. Replies: 2
    Last Post: 5 May 2010, 11:23 AM
  3. Replies: 1
    Last Post: 14 May 2008, 06:26 PM
  4. How to make specific items visible only to special customers?
    By darthjones in forum General Questions
    Replies: 10
    Last Post: 4 Aug 2006, 10:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR