VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sandomatyas on February 09, 2018, 10:07:16 AM

Title: Remove product with CLI script
Post by: sandomatyas on February 09, 2018, 10:07:16 AM
There is a CLI script which handles VM product stock based on supplier data feed.
A new request is that I need to remove the products from Virtuemart which are deleted from the original list.
I loaded VirtueMartModelProduct and there is a function 'remove' for that but there is a code part in it:
if(!vmAccess::manager('product.delete')){
vmWarn('Insufficient permissions to delete product');
return false;
}

in my case there isn't any user, it's a cli script. When I remove this code part it works well.

How should I handle it?
Title: Re: Remove product with CLI script
Post by: Studio 42 on February 12, 2018, 01:26:57 AM
Do your own class
class myModelProduct extends VirtueMartModelProduct  {
public function remove ($ids) {
   /*your own code here */
}
}
is the only solution without hacks.
or use your own code