See post #15 for how to do this ...
See post #15 for how to do this ...
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: v1.5.5]
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!
If you're still watching this Ajeh, I have a quick question for you.
This works a treat when I just want PayPal to show when only product ID 1395 is in the cart and nothing else:
How would I tweak this code so that PayPal becomes an option when product ID 1395 is in the cart and any other product is also in the cart alongside it?PHP Code:
if (!IS_ADMIN_FLAG) {
// disable, (even when admin has it switched on):
$this->enabled = false;
global $cart;
if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0 && $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')) {
$this->enabled = true;
}
}
This part, when added in conjunction with the first half of the conditions, forces that the ONLY thing in the cart is that product number; so remove it if you don't care what else is in the cart with it:Code:&& $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')
.
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 think I may have figured it out. I just changed this:
To this:PHP Code:
if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0 && $_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('products_id','1395')) {
PHP Code:
if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0 ) {
I'd like to take this in a slightly different direction by changing the logic to a customer ID instead of a product ID. What would I need to change this to?
if ($_SESSION['cart']->in_cart_check('products_id','6251') > 0 ) {
The logged-in customer number is in $_SESSION['customer_id']. Check against that.
.
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.
Thank you Dr. Byte. I'm afraid the syntax and the general terms just let me down every time. I've no idea how to write it. This would probably just white screen the site:
if ($_SESSION['cart']->in_cart_check('customer_id','') = 4959 ) {
What do you change 'cart' to and what do you change ->in_cart_check to and I'm guessing the ('customer_id','') = 4959 is probably wrong too? I don't know how you gurus just know all that stuff :)
Forget any of the previous code posted. Instead, please write in english the logic you want turned into code. What do you want to do and why?
.
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.
If user ID (or is it customer ID) is logged into her account then enable the PayPal payment module for her. Her customer ID is 4959
We don't like to take PayPal but on special request we will take it. So, if a customer asks us to take PayPal then it's good to be able to switch it on for them only.
Then change this (from your previous post awhile back):Code:if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0 ) {
to this:
PHP Code:
if ($_SESSION['cart']->in_cart_check('products_id','1395') > 0 || $_SESSION['customer_id'] == 4959) {
.
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.
Bookmarks