For example, if I sell some products prohibited by Paypal, can I specify that Paypal cannot be selected as a method for those, but can for the rest of products?
For example, if I sell some products prohibited by Paypal, can I specify that Paypal cannot be selected as a method for those, but can for the rest of products?
You could test if a Product is in the shopping cart and if so, disable the payment module by controlling the $this->enabled ...
When set to false, the module will not show ...
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!
That went over my head.
Let's say you wanted to make the Check/Money Order payment module moneyorder.php hide or not show when products_id 27 was in the cart ...
Currently, there is a line for the $this->enabled that reads:
Further down in the code, in the function update_status you will also see the $this->enabled referenced ...Code:$this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);
You could check to see if the products_id 12 was in the shopping cart and if so, make this false, so even if the payment module is installed, it will hide or be disabled when the product is there ...
There is a function in the shopping_cart class to test values on what's in the cart ...
So, using the following:Code:* $check_what is the fieldname example: 'products_is_free' * $check_value is the value being tested for - default is 1 * Syntax: $_SESSION['cart']->in_cart_check('product_is_free','1'); * * @param string product field to check * @param mixed value to check for * @return integer number of items matching restraint */ function in_cart_check($check_what, $check_value='1') {
This can be done with the following code that changes the function update_status to read:Code:$_SESSION['cart']->in_cart_check('products_id','12')
Code:// class methods function update_status() { global $order, $db; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_MONEYORDER_ZONE > 0) ) { $check_flag = false; $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_MONEYORDER_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); 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 == false) { $this->enabled = false; } } // disable if products_id 12 is in the cart if ($_SESSION['cart']->in_cart_check('products_id','12') > 0) { $this->enabled = false; } }
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!
Oh, you meant altering the source code! Thanks, but no, thanks.
Customizations requires custom code ...
If you are not keen on coding you could always post for help in the Commercial Help Wanted ...
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!
I hate to bump an old thread but this one closely relates to what i want. I have done the following suggested above and its working great, but i tried switching to 'categories_id' to limit the payment on an entire category in place of 'products_id'.
When going through checkout with this switched i get:
not quite sure what this means so im hoping its a simple fix, otherwise i will be pumping in alot of product id's1054 Unknown column 'categories_id' in 'field list'
in:
[select categories_id as check_it from products where products_id='286' limit 1]
thanks in advance!
The Master Categories ID field in the products table is called:
master_categories_id
This is the Product's categories_id ... if using Linked Product, then this will be the "main categories_id" or the "master categories_id" or the Category that "owns" the Product ...
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!
Brilliant!!! Thank you!!
Works like a charm!
Thanks for the update that you were just using the wrong field name in your select statement ... fussy the way the code works with MySQL ...
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!
Bookmarks