Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    425
    Plugin Contributions
    0

    Default Can I restrict a payment option by admin status?

    Is there a way to enable a payment module only if the order is being entered by an admin? I modified the freecharger.php module to permit entering prepaid orders, and it's working very well. The only problem is that you don't want the general public to see 'Prepaid Order' (offline payment at the market) as an option, of course. So I enable it only when I need to enter a prepaid order and hope to heck that no one else sees it while I'm doing that. Right now, I do not have time to dig into this sufficiently to display it as an option only if the person logged in is an admin. Any assistance in that direction would be greatly appreciated.

  2. #2
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    425
    Plugin Contributions
    0

    Default Re: Can you restrict a payment option by admin status?

    Editing to add--

    I found DrByte's reply to a similar question from 2013, and have enabled it in my prepaid.php code. It will work for us now, since it depends on having a static IP address and we have that now. It won't work after the company move, because the new location only has satellite internet (no static IP). So I'm still looking for a solution that doesn't depend on the IP address.

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,977
    Plugin Contributions
    109

    Default Re: Can you restrict a payment option by admin status?

    In 1.5.7, assuming your are using "Place Order" from admin to do this, you can just add a check to your payment module for

    if (isset($_SESSION['emp_admin_id'])) {
    ... enable
    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.

  4. #4
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    425
    Plugin Contributions
    0

    Default Re: Can you restrict a payment option by admin status?

    Thanks, I will do that for the new website running 1.5.7. What I have now is working at our current location with 1.5.5.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,031
    Plugin Contributions
    17

    Default Re: Can you restrict a payment option by admin status?

    Also because you are wanting the feature to only work while accessing FROM the admin as in while logged into the admin and making changes there, then if you test (IS_ADMIN_FLAG === true) is a condition where the admin (system not a "person") is accessing the payment module from the admin side.

    Otherwise, if you know your admin's customer_id, then you could check if that customer is accessing the payment module:

    Code:
    if (isset($_SESSION['customer_id']) && $_SESSION['customer_id'] == 15) {
      // enable
    }
    Where 15 is the customer id for your "admin user" logged in on the store side.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    425
    Plugin Contributions
    0

    Default Re: Can you restrict a payment option by admin status?

    Quote Originally Posted by mc12345678 View Post
    Also because you are wanting the feature to only work while accessing FROM the admin as in while logged into the admin and making changes there, then if you test (IS_ADMIN_FLAG === true) is a condition where the admin (system not a "person") is accessing the payment module from the admin side.

    Otherwise, if you know your admin's customer_id, then you could check if that customer is accessing the payment module:

    Code:
    if (isset($_SESSION['customer_id']) && $_SESSION['customer_id'] == 15) {
      // enable
    }
    Where 15 is the customer id for your "admin user" logged in on the store side.
    Ooh, that should work with 1.5.5 also. I won’t have the new site ready to go until well after the move, so that would handle the situation even without a static IP.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

    Default Re: Can you restrict a payment option by admin status?

    Quote Originally Posted by mc12345678 View Post
    Also because you are wanting the feature to only work while accessing FROM the admin as in while logged into the admin and making changes there, then if you test (IS_ADMIN_FLAG === true) is a condition where the admin (system not a "person") is accessing the payment module from the admin side.
    Remember, unless you've added some plugin to place orders directly inside the Admin area, the suggestion above is unrelated to the discussion at hand.

    Quote Originally Posted by mc12345678 View Post
    Otherwise, if you know your admin's customer_id, then you could check if that customer is accessing the payment module:

    Code:
    if (isset($_SESSION['customer_id']) && $_SESSION['customer_id'] == 15) {
      // enable
    }
    Where 15 is the customer id for your "admin user" logged in on the store side.
    This idea assumes that you're always placing orders under a SINGLE customer account, where all your offline ("prepaid" as OP calls it) orders are entered.
    If you're actually logging into separate customer accounts to place orders for specific individual customers, this suggestion won't be much help.
    .

    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
    Jun 2016
    Location
    Suffolk VA
    Posts
    425
    Plugin Contributions
    0

    Default Re: Can you restrict a payment option by admin status?

    The ADMIN_FLAG variable must be defined only in the latest version, as it just threw up an error. But testing for the admin's 'customer_id' worked. I'm the only one who currently would be entering customer orders, so that gets around the need for a static IP. Now I need to go do something similar with the shipping method, to have one that only admins will see but that will print 'Subscription plan' or something similar on the customer's notification email. We include shipping with these orders, so I need some way to sidestep the shipping charges. I don't want ordinary customers to see a Free Shipping option, for obvious reasons. So I have used Store Pickup as the shipping method. But I've already had one panicked phone call from a subscriber who wailed "But I live a thousand miles from you!" after she got the email notification of her order showing Store Pickup for shipping.

  9. #9
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    425
    Plugin Contributions
    0

    Default Re: Can you restrict a payment option by admin status?

    Quote Originally Posted by DrByte View Post
    This idea assumes that you're always placing orders under a SINGLE customer account, where all your offline ("prepaid" as OP calls it) orders are entered.
    If you're actually logging into separate customer accounts to place orders for specific individual customers, this suggestion won't be much help.
    I long since installed the plugin to place orders from a customer account, and it's working fine for this application. The test for the admin's 'customer_id' number worked to limit visibility of the prepaid order method only when I'm entering an order. That does mean no other admin can do it, but right now I'm the only one anyway.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,031
    Plugin Contributions
    17

    Default Re: Can you restrict a payment option by admin status?

    Quote Originally Posted by HeleneWallis View Post
    The ADMIN_FLAG variable must be defined only in the latest version, as it just threw up an error. But testing for the admin's 'customer_id' worked. I'm the only one who currently would be entering customer orders, so that gets around the need for a static IP. Now I need to go do something similar with the shipping method, to have one that only admins will see but that will print 'Subscription plan' or something similar on the customer's notification email. We include shipping with these orders, so I need some way to sidestep the shipping charges. I don't want ordinary customers to see a Free Shipping option, for obvious reasons. So I have used Store Pickup as the shipping method. But I've already had one panicked phone call from a subscriber who wailed "But I live a thousand miles from you!" after she got the email notification of her order showing Store Pickup for shipping.
    Moot point at the moment, but looking as far back as 1.5.0, the define 'IS_ADMIN_FLAG' is set... There is/was a little bit of a misunderstanding on my part when suggesting it. I was looking at some sort of capability accessed from the admin side of the store, which is far different than a person that has been granted the permissions and power to do what is needed (admin like rights).

    Again, doesn't really matter in this case because you were really looking for a feature on the catalog side that would allow you to do something unique as compared to all of the other customers. As far as the text change, Perhaps the same type of thing could be done within the language file(s) where the text to be provided for the shipping module could be set for the logged in user as compared to everyone else.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h Help I have hit a wall - can admin have option for different payment
    By dharrison in forum Addon Payment Modules
    Replies: 7
    Last Post: 31 Jan 2013, 10:35 PM
  2. Can I restrict certain payment methods for certain products?
    By one tall man in forum Built-in Shipping and Payment Modules
    Replies: 27
    Last Post: 6 Apr 2011, 08:40 PM
  3. Replies: 0
    Last Post: 20 Jan 2010, 09:50 PM
  4. Can i add more customized payment module to payment option?
    By naranbayar in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 12 Nov 2009, 09:22 PM
  5. Can I restrict so that a Coupon can only be used for one Payment Method?
    By schira in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 7
    Last Post: 11 Jun 2008, 03:53 AM

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