into products table I'm add a new field named products_fornitore, so I can add the name of my supplier into the admin products. How can I disable shipping methods only for certain products (ie products_fornitore=abc?)?
Thanks a lot.
into products table I'm add a new field named products_fornitore, so I can add the name of my supplier into the admin products. How can I disable shipping methods only for certain products (ie products_fornitore=abc?)?
Thanks a lot.
There is a function in the shopping_cart class that you can use to count how many are in the cart based on a field in the products table, example to get the number of Products with products_fornitore=abc you could use:
Code:$chk_abc = $_SESSION['cart']->in_cart_check('products_fornitore', 'abc');
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!]
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!
You're simply great!
all works fine with this script:
PHP Code:// escludi il porto assegnato per abc
$chk_abc = $_SESSION['cart']->in_cart_check('products_fornitore', 'abc');
if ( ($this->enabled == true) && ( $chk_abc != 'abc' ) ) $this->enabled = false;
}
![]()
While it may work for you ... it doesn't make a lot of sense as $chk_abc should be a value ...
The only reason it might work is that 'abc' would evaluate to 0 ...
$chk_abc != 'abc'
see if changing that to:
$chk_abc != 0
works as well ...
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!]
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!
but for other products with different 'products_fornitore' it works well.
My other question is: if I have more than 1 'products_fornitore' to check?
it: it would to ceck if products_fornitore is = abc, or bba or ggt
You can test each one:
I use the variable $chk_xyz to match the thing I am looking for just for clarity and so I have a count for that particular number of Products in the shopping_cart for the tested value ...Code:$chk_xyz = $_SESSION['cart']->in_cart_check('products_fornitore', 'xyz');
I could use $fred as the variable but that isn't very clear in the code ...![]()
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!]
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 would disable cash on delivery only for certain customer (based on email).
I've just try with
$chk_abc = $_SESSION['cart']->in_cart_check(''customers_email_address', '[email protected]');
if ( ($this->enabled == true) && ( $chk_abc != '[email protected]' ) ) $this->enabled = false;
}
but it don't work. Help me with a suggestion