Three edits to /includes/modules/payment/accountholder.php:
1. Line 115 changes from this:
Code:
return array('MODULE_PAYMENT_ACCOUNTHOLDER_STATUS', 'MODULE_PAYMENT_ACCOUNTHOLDER_ZONE', 'MODULE_PAYMENT_ACCOUNTHOLDER_ORDER_STATUS_ID', 'MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER', 'MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO');
to:
Code:
return array('MODULE_PAYMENT_ACCOUNTHOLDER_STATUS', 'MODULE_PAYMENT_ACCOUNTHOLDER_ZONE', 'MODULE_PAYMENT_ACCOUNTHOLDER_ORDER_STATUS_ID', 'MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER', 'MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO', 'MODULE_PAYMENT_ACCOUNTHOLDER_CATEGORIES');
2. At Line 107, insert new row:
Code:
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Restriction Categories', 'MODULE_PAYMENT_ACCOUNTHOLDER_CATEGORIES', '', 'Which categories is this module restricted to? (separated by commas)', '6', '0', now())");
3. At line 56, insert new lines as shown highlighted here:
Code:
if ($check_flag == false) {
$this->enabled = false;
}
}
//Check to be sure that this module is allowed to apply -- restricted to certain categories, based on master_categories_id
if ($this->enabled == true) {
$check_flag = false;
$allowed_cats = explode(',',preg_replace('/[^0-9],/', '',MODULE_PAYMENT_ACCOUNTHOLDER_CATEGORIES));
reset($_SESSION['cart']->contents);
while (list($key,) = each($_SESSION['cart']->contents)) {
foreach($allowed_cats as $cat) {
if (zen_product_in_category($key, $cat)) $check_flag = true;
}
}
if ($check_flag == false) $this->enabled = false;
}
}
function javascript_validation() {
After uploading the changes, remove and re-install the module. Then edit its settings to list the categories to which this module applies.
This module will thus show up if products from the specified categories are in the cart ... whether or not there are other products from other categories.
Bookmarks