Author Topic: Remove product with CLI script  (Read 213 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 196
Remove product with CLI script
« 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:
Code: [Select]
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3243
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Remove product with CLI script
« Reply #1 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