// Fixed #PSTEST-804
This commit is contained in:
@@ -94,7 +94,6 @@ class ShopCore extends ObjectModel
|
||||
'store' => array('type' => 'shop'),
|
||||
'webservice_account' => array('type' => 'shop'),
|
||||
'warehouse' => array('type' => 'shop'),
|
||||
/* 'stock_available' => array('type' => 'fk_shop', 'primary' => 'id_stock_available'), */
|
||||
);
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
@@ -127,7 +126,7 @@ class ShopCore extends ObjectModel
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
if ($this->id)
|
||||
{
|
||||
$sql = 'SELECT su.physical_uri, su.virtual_uri,
|
||||
$sql = 'SELECT su.physical_uri, su.virtual_uri,
|
||||
su.domain, su.domain_ssl, t.id_theme, t.name, t.directory
|
||||
FROM '._DB_PREFIX_.'shop s
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su ON (s.id_shop = su.id_shop)
|
||||
|
||||
@@ -390,7 +390,7 @@ class StockAvailableCore extends ObjectModel
|
||||
if (!$depends_on_stock)
|
||||
{
|
||||
$id_stock_available = (int)StockAvailable::getStockAvailableIdByProductId($id_product, $id_product_attribute, $id_shop);
|
||||
|
||||
|
||||
$product = new Product($id_product, true, $id_lang, $id_shop, $context);
|
||||
Hook::exec('actionUpdateQuantity', array('product' => $product, 'attribute_id' => $id_product_attribute));
|
||||
|
||||
@@ -441,7 +441,7 @@ class StockAvailableCore extends ObjectModel
|
||||
else
|
||||
Hook::exec('actionProductUpdate', array('product' => $product));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -629,4 +629,36 @@ class StockAvailableCore extends ObjectModel
|
||||
if (!$group_ok)
|
||||
$params['id_shop'] = (int)$id_shop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies stock available content table
|
||||
*
|
||||
* @param int $src_shop_id
|
||||
* @param int $dst_shop_id
|
||||
* @return bool
|
||||
*/
|
||||
public static function copyStockAvailableFromShopToShop($src_shop_id, $dst_shop_id)
|
||||
{
|
||||
if (!$src_shop_id || !$dst_shop_id)
|
||||
return false;
|
||||
|
||||
$query = '
|
||||
INSERT INTO '._DB_PREFIX_.'stock_available
|
||||
(
|
||||
id_product,
|
||||
id_product_attribute,
|
||||
id_shop,
|
||||
id_group_shop,
|
||||
quantity,
|
||||
depends_on_stock,
|
||||
out_of_stock
|
||||
)
|
||||
(
|
||||
SELECT id_product, id_product_attribute, '.(int)$dst_shop_id.', 0, quantity, depends_on_stock, out_of_stock
|
||||
FROM '._DB_PREFIX_.'stock_available
|
||||
WHERE id_shop = '.(int)$src_shop_id.
|
||||
')';
|
||||
|
||||
return Db::getInstance()->execute($query);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user