News:

Looking for documentation? Take a look on our wiki

Main Menu

Remove product with CLI script

Started by sandomatyas, February 09, 2018, 10:07:16 AM

Previous topic - Next topic

sandomatyas

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?

Studio 42

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