Prevent deletion of some products

Hello i want to disable delete or prevent them from deleting certain products in some module when user clicks delete button. Is there any experts who knows this ? Thanks in advance any help would be appreciated.

found a sample code trying to put it together but i think there something more missing. sorry im pretty new with this:

<?php

if (isset($_REQUEST['action'])
    && $_REQUEST['action'] == 'DetailView'){

    $sql = 'update AOS_Products set deleted = 0 where id ="'.$bean->id.'"p';
    $result = $GLOBALS['db']->query($sql);
    $GLOBALS['db']->fetchByAssoc($result);

} else{
    SugarApplication::appendErrorMessage("Warning: this product shouldn't be deleted.");
}
Parents Reply Children