Hello,
Here is a patch that will enable you to support the restrictions of order custom fields on products and categories. You'll just have to edit the "administrator/components/com_hikashop/classes/field.php" file and add these lines :
//if required field of the table order and products or categories restriction
if($field->field_table == 'order' && ($field->field_products != 'all' || $field->field_categories != 'all')){
$cartClass = hikashop_get('class.cart');
$fieldClass = hikashop_get('class.field');
$cart = $cartClass->loadFullCart(true);
$inCart = false;
$restricted_products = array ();
$restricted_categories = array();
//Product check
if($field->field_products != 'all'){
$restricted_products = explode(',', $field->field_products);
$restricted_products = array_filter($restricted_products);
foreach($cart->cart_products as $cart_product){
if(in_array($cart_product->product_id, $restricted_products))
$inCart = true;
}
}
//Category check
if($field->field_categories != 'all' && !$inCart){
$restricted_categories = explode(',', $field->field_categories);
$restricted_categories = array_filter($restricted_categories);
$cart_categories = $fieldClass->getCategories('order', $cart);
foreach($restricted_categories as $restricted_category){
if($field->field_with_sub_categories && in_array($restricted_category, $cart_categories['parents']))
$inCart = true;
else if(!$field->field_with_sub_categories && in_array($restricted_category, $cart_categories['originals']))
$inCart = true;
}
}
if(!$inCart)
return true;
}
Just after these lines :
function check(&$field,&$value,$oldvalue) {
if(is_string($value))
$value = trim($value);
if(!$field->field_required || is_array($value) || strlen($value) || strlen($oldvalue))
return true;