$this->log('endItem() - ID "'.$item_id);
if($this->config->get('openbaypro_enditems') == 1) {
$this->call('item/endItem/', array('id' => $item_id));
$this->removeItemByItemId($item_id);
if($this->lasterror != true) {
$this->log('endItem() - OK');
return array('error' => false, 'msg' => 'ok');
}else{
return array('error' => true, 'msg' => $this->lasterror);
}
}else{
$this->removeItemByItemId($item_id);
$this->log('endItem() - config has disabled ending items');
$message = "An item has gone out of stock but your settings are not set to end eBay items automatically.\r\n\r\n";
$message.= "You need to ensure you have stock left of this item or end your eBay listing manually.\r\n\r\n";
$message.= "eBay item ID: $item_id";
$this->notifyAdmin('eBay item not ended: '.$item_id, $message);
return array('error' => true, 'msg' => 'Settings do not allow you to end items, but the link has been removed.');
}