Hi,
There is no restriction on the product or the category for payment methods. What you have in the Restrictions section of the payment method is: zone, postcode, shipping method, currency, min/max price, min/max quantity, min/max weight and min/max volume.
Since you describe it as a large product, the min/max weight or the min/max volume restriction is probably all you need, and it requires no code. Set the weight or the dimensions on the large products, then set a max weight or a max volume on the payment methods you want to hide. HikaShop adds up the cart and hides the method as soon as the total goes over.
If you really need it per product or per category, it takes a small plugin listening on the onPaymentDisplay event of HikaShop. Something like this, as a system plugin, hides the payment methods 2 and 3 as soon as a product of the category 15 is in the cart:
<?php
defined('_JEXEC') or die();
class plgSystemHikapaymentrestriction extends \Joomla\CMS\Plugin\CMSPlugin {
// the payment methods to hide, and the categories which hide them
protected $payment_ids = array(2, 3);
protected $category_ids = array(15);
public function onPaymentDisplay(&$order, &$methods, &$usable_methods) {
if(empty($order->products) || empty($methods))
return true;
$ids = array();
foreach($order->products as $product) {
$ids[] = (int)$product->product_id;
if(!empty($product->product_parent_id))
$ids[] = (int)$product->product_parent_id;
}
$db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$db->setQuery('SELECT COUNT(*) FROM '.hikashop_table('product_category').
' WHERE product_id IN ('.implode(',', $ids).')'.
' AND category_id IN ('.implode(',', $this->category_ids).')');
if(!$db->loadResult())
return true;
foreach($methods as $k => $method) {
if(in_array((int)$method->payment_id, $this->payment_ids))
unset($methods[$k]);
}
foreach($usable_methods as $k => $method) {
if(in_array((int)$method->payment_id, $this->payment_ids))
unset($usable_methods[$k]);
}
return true;
}
}
The payment ids are the ones in the URL when you edit the payment method in the backend. Both loops are there on purpose: depending on the order the plugins run in, the methods are either still in $methods or already in $usable_methods.
For a rule on the products instead of the categories, drop the query and test the product ids directly in $ids.