Does the product_id have to be there though? What if I've no way of knowing what they're intending to buy?
Does the product_id have to be there though? What if I've no way of knowing what they're intending to buy?
Would this work on it's own?
if ($_SESSION['customer_id'] == 4959) {
Confirmed, this does work well. Can I pick your brains one last time on this topic and ask, what is the correct syntax for this?
if ($_SESSION['customer_id'] == 4959 AND 1234 AND 2345 AND 3456) .... . .. . etc?
So, if I want to enable PayPal for three or four customers at a time?
There are several way of doing this, but this is probably the easiest to follow/understand:
If there are a LOT of customers you wish to check for, then placing them in an array and using a loop structure would be a better solution:Code:if ( ($_SESSION['customer_id'] == 4959) || ($_SESSION['customer_id'] == 1234) || ($_SESSION['customer_id'] == 3456) ) { Do stuff ; }
Code:$customerIDs = array(4959, 1234, 4567, 9999) ; $i = 0 ; $flag = 0 ; while ($i < sizeof($customerIDs)) { if ($_SESSION['customer_id'] == $customerIDs[$i]) $flag = 1 ; $i++ ; } if ($flag == 1) { echo "We have a match" ; }
Cheers
Rod
or you could try...
PHP Code:
if (in_array($_SESSION['customer_id'], array(4959, 1234, 4567, 9999))) {
do something;
}
limelites, why do you keep changing the rules? First it was a certain product, then it was a certain product with another certain product, now it's for a certain customer.
If the rules keep changing, why not just have NO rules, and turn the module off when you're not needing it, and turn it back ON again for a few hours when you've got a certain customer who needs/wants to use it?
It seems like you're making your business far more complicated than it needs to be.
.
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.
Thanks RodG and Gilby. Both solutions work well and have been implemented on the website. Perfect!
It's complicated Dr.Byte, I know. The rules change usually as the situation changes. At first we had customers wishing to pay for specific items with PayPal so my initial thought was obviously enabling PayPal for a certain product only. Yesterday, I had one individual customer wanting to pay with PayPal on an unkonwn product. Now, at this moment in time I have three new customers wanting to pay with PayPal. My thoughts have obviously now moved towards allowing specific customers to use it (which in hindsight would have been best anyway).
I'd hate to enable PayPal on the off chance that a customer is going to be online at any give time. When a customer asks to pay with PayPal then there's no telling when they'll actually be there, ready to proceed to the checkout. If I were to enable it on the off-chance that they're likely to checkout in the next hour then who's to say other customers won't use it too? What if it takes the customer a few days to get back? By that time dozens of customers have used it. It's much better this way as I really hate PayPal and we only take PayPal payments if we're specifically asked. Their fees are outrageous and I've had bad experiences with them in the past when we traded on eBay. I don't like giving them any of our business as I'd be quite happy if everyone else did the same.
Anyway, look on the bright side. Now anyone searching this forum will find how to enable PayPal for either/or specific products or specific customers :)
Last edited by limelites; 30 Apr 2013 at 07:33 AM.
Those statements sound like you're focused on what *you* want instead of what your *customers* want. That's a delicate line to walk. Most professionals would advise you to openly offer the options that your customers want to use, not to penalize your customers because you have a certain bent against a particular thing your customers happen to prefer. After all, isn't one of your goals to get your customers to pay as easily and conveniently as is possible for them?
NOTE: I am NOT inviting a philosophical debate here on whether one should accept PayPal or not. And I don't think the rest of the world needs you to post any of the gory details of your bad experiences. Please don't do that.
I'm merely pointing out what feels like a flaw in your focus. Take it or leave it. I don't care which way you choose ... just wanted to draw your attention to it from the customers' angle. Don't take this discussion in the direction of hating/loving certain providers. That doesn't do anybody any good. Again, I was ONLY pointing out an observation.
.
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.
I like this one better than both mine. :)
This reminds me a little of my very early days in computing, where we used to have little competitions to see who could write the most efficient or interesting code for a very specific task.
My best effort was a one line code of BASIC on a CommodoreC128 that produced a TV style test pattern on screen (consisting of a square grid background, with a circle overlay, and the 7 standard color bars).
My things have changed since then. :)
Cheers
Rod
Thanks Dr.Byte and don't worry, I won't be opening that can of worms. I appreciate what you're saying but it's not a decision I took lightly. We take all major credit/debit cards which seems to work well as we're super busy and sales are really pouring in so there are no complaints in that department. If someone has a PayPal account then the chances are they'll have a debit or credit card too :)
I have my own personal reasons for not taking PayPal but I also have good, business reasons. (1) I don't like their outrageous fees. (2) I don't like leaving my company open to fraudsters who use PayPal rules to their benefit and run PayPal reversals on us whenever they think they'll get away with it. (3) I don't like the stigma associated with PayPal as soon as customers see it they assume you're some shoddy eBay seller with a website.
PayPal has a bad reputation amongst buyers as well as sellers. I don't think I'm the only consumer who assumes that a website taking PayPal is usually a website that's been put together by a less than professional company. Most large companies don't take PayPal. You ever asked yourself why?
Like you, I don't really want to get into a big debate about the pros and cons of taking PayPal but I thought I'd let you know my professional reasons. Personal reasons aside :)
Bookmarks