Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Disable payment method for categories (with subcategories)

Disable payment method for categories (with subcategories)

Views: 565

Results 1 to 2 of 2
11 Apr 2014, 8:52 AM
#1
tempesta48 avatar

tempesta48

New Zenner

Join Date:
Mar 2011
Posts:
1
Plugin Contributions:
0

Disable payment method for categories (with subcategories)

Hi,

I've succeded disabling COD payment for some categories using "master_categories_id" ($_SESSION['cart']->in_cart_check('master_categories_id','100') > 0).

But I cannot find the way to do the same using a Category with subcategories. If for example master_categories_id=6 has 100 subcategories, is there a way of disabling COD for all other than using "master_categories_id" 100 times?

Thanks in advance for your attention!

11 Apr 2014, 5:02 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Disable payment method for categories (with subcategories)

You could get all the products_id values in an array with this:

// bof: check my category
$chk_parent = 3;
$check_parent_products = zen_get_categories_products_list($chk_parent);
echo '<pre>'; echo print_r($check_parent_products); echo '</pre>';
echo 'chk_parent: ' . $chk_parent . ' sizeof($check_parent_products): ' . sizeof($check_parent_products) . '<br>';
// eof: check my category

where you can set the category's parent_id to $chk_parent ...

Once you have that array of products_id values, you can check the products in the cart to see if they match any of those ...