Схема
private mixed
modifyStock (
$product_id, $qty, $symbol = '-', $sku = '' )
Аргументы
Аргумент |
Возможный тип |
Описание |
$product_id |
— |
— |
$qty |
— |
— |
$symbol = '-' |
— |
— |
$sku = '' |
— |
— |
Описание
Метод пока еще не документирован.
Исходный код
$this->openbay->ebay->log('modifyStock() - Updating stock. Product id: '.$product_id.' qty: '.$qty.', symbol: '.$symbol.' sku: '.$sku);
$item_id = $this->openbay->ebay->getEbayItemId($product_id);
if ($this->openbay->addonLoad('openstock') && !empty($sku)) {
$this->db->query("UPDATE `" . DB_PREFIX . "product_option_relation` SET `stock` = (`stock` ".(string)$symbol." " . (int)$qty . ") WHERE `var` = '" . (string)$sku . "' AND `product_id` = '".(int)$product_id."' AND `subtract` = '1'");
$stock = $this->openbay->ebay->getProductStockLevel($product_id, $sku);
$this->openbay->ebay->log('modifyStock() /variant - Stock is now set to: '.$stock['quantity']);
$this->openbay->ebay->putStockUpdate($item_id, $stock['quantity'], $sku);
}else{
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET `quantity` = (`quantity` ".(string)$symbol." " . (int)$qty . ") WHERE `product_id` = '" . (int)$product_id . "' AND `subtract` = '1'");
$stock = $this->openbay->ebay->getProductStockLevel($product_id);
$this->openbay->ebay->log('modifyStock() - Stock is now set to: '.$stock['quantity']);
//send back stock update to eBay incase of a reserve product level
$this->openbay->ebay->putStockUpdate($item_id, $stock['quantity']);
}