Hi,
Ok, so it is a custom field of the table "item", which is displayed on the product details page on the frontend.
For that kind of custom field, the simplest is to do the check only in javascript. In that case, you can just create a view override of show_default via the menu Display>Views and add a bit of javascript to the page like so:
<script>
document.getElementById('xxx').addEventListener('change', (event) => {
// do your check on event.target.value , you can modify event.target.value and use alert() to display a message
});
</script>
where xxx is the column name of the custom field (in this case it would be "width").
In PHP, it gets a bit more complex. You need to create a Joomla plugin of the group "hikashop" and implement the event:
onBeforeProductQuantityCheck(&$products, &$cart, &$options)
where $products contains the data of the products being added to the cart, $cart contains the data already in the cart, a $options some options you don't care about.
The code will be something like that:
function onBeforeProductQuantityCheck(&$products, &$cart, &$options) {
if($this->checkFunction($products) === false) {
$products = array(); // remove the products data being added to the cart so that the add to cart fails
$cartClass = hikashop_get('class.cart');
$cartClass->addMessage($cart, array('msg' => 'the product with the id $id could not be added to the cart because the check failed', 'product_id' => $id, 'type' => 'error'));
}
}
function checkFunction($products) {
// do the check
return true;
}
If you don't know how to create Joomla plugins, we have some information on this at the beginning of our developer documentation page:
www.hikashop.com/support/documentation/6...r-documentation.html