How To Disable Deletion Of Product By A Vendor

What we are looking at it that only a Admin can delete any product for a Vendor, Vendor shouldnt be able to delete there products they can just disable it.



Can some one please point to me which all files will required modification for this ?

[quote name='technoob' timestamp='1435577878' post='220829']

What we are looking at it that only a Admin can delete any product for a Vendor, Vendor shouldnt be able to delete there products they can just disable it.



Can some one please point to me which all files will required modification for this ?

[/quote]



Hello,



It is necessary to replace in app/schemas/permissions/vendor_multivendor.php this part of code



'products' => array (
'modes' => array(
),
'permissions' => true,
),




by this one



'products' => array (
'modes' => array(
'delete' => array(
'permissions' => false,
),
),
'permissions' => true,
),




Sincerely yours,

CS-Market.

Thanks CS-Market we tried the same and got a 403 error but the product also got deleted. Is this a bug

hi,



possibly you used bulk deletion so please try this piece of code:


'products' => array (
'modes' => array(
'delete' => array(
'permissions' => false,
),

'm_delete' => array(
'permissions' => false,
),
),
'permissions' => true,
),




p.s. don't forget to clean up the template cache after the change.



on the other side you may add extra protection:

  1. Enable the “My changes” module.
  2. Create “app/addons/my_changes/func.php” file with the code:


if (!defined('BOOTSTRAP')) { die('Access denied'); }

function fn_my_changes_delete_product_pre(&$product_id, &$status)
{
if (defined('ACCOUNT_TYPE') && ACCOUNT_TYPE == 'vendor') {
$status = false;
}
}


3. Create “app/addons/my_changes/init.php” file with the code:


if (!defined('BOOTSTRAP')) { die('Access denied'); }

fn_register_hooks(
'delete_product_pre'
);






best regards, WSA team

[quote name='Damir (WSA-team)' timestamp='1435601564' post='220891']

hi,



possibly you used bulk deletion so please try this piece of code:


'products' => array (
'modes' => array(
'delete' => array(
'permissions' => false,
),

'm_delete' => array(
'permissions' => false,
),
),
'permissions' => true,
),




p.s. don't forget to clean up the template cache after the change.



on the other side you may add extra protection:

  1. Enable the “My changes” module.
  2. Create “app/addons/my_changes/func.php” file with the code:


if (!defined('BOOTSTRAP')) { die('Access denied'); }

function fn_my_changes_delete_product_pre(&$product_id, &$status)
{
if (defined('ACCOUNT_TYPE') && ACCOUNT_TYPE == 'vendor') {
$status = false;
}
}


3. Create “app/addons/my_changes/init.php” file with the code:


if (!defined('BOOTSTRAP')) { die('Access denied'); }

fn_register_hooks(
'delete_product_pre'
);






best regards, WSA team

[/quote]



You are bang on, Mr. Damir. Awesome. It worked like a charm. I didnt require the steps 1 - 3.

you are welcome!