// Stock: WebServices

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11757 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2011-12-26 10:34:25 +00:00
parent fe87fd0f97
commit 7ac8036706
8 changed files with 153 additions and 25 deletions
+37 -20
View File
@@ -76,7 +76,41 @@ class ProductSupplierCore extends ObjectModel
);
/**
* For a given product and supplier, get the product reference
* @see ObjectModel::$webserviceParameters
*/
protected $webserviceParameters = array(
'objectsNodeName' => 'product_suppliers',
'objectNodeName' => 'product_supplier',
'fields' => array(
'id_product' => array('xlink_resource' => 'products'),
'id_product_attribute' => array('xlink_resource' => 'combinations'),
'id_supplier' => array('xlink_resource' => 'suppliers'),
'id_currency' => array('xlink_resource' => 'currencies'),
),
);
/**
* @see ObjectModel::delete()
*/
public function delete()
{
$res = parent::delete();
if ($res && $this->id_product_attribute == 0)
{
$items = self::getSupplierCollection($this->id_product, false);
foreach ($items as $item)
{
if ($item->id_product_attribute > 0)
$item->delete();
}
}
return $res;
}
/**
* For a given product and supplier, gets the product supplier reference
*
* @param int $id_product
* @param int $id_product_attribute
@@ -98,7 +132,7 @@ class ProductSupplierCore extends ObjectModel
}
/**
* For a given product and supplier, get the product unit price
* For a given product and supplier, gets the product supplier unit price
*
* @param int $id_product
* @param int $id_product_attribute
@@ -120,7 +154,7 @@ class ProductSupplierCore extends ObjectModel
}
/**
* For a given product and supplier, get the ProductSupplier corresponding ID
* For a given product and supplier, gets corresponding ProductSupplier ID
*
* @param int $id_product
* @param int $id_product_attribute
@@ -159,23 +193,6 @@ class ProductSupplierCore extends ObjectModel
return $suppliers;
}
public function delete()
{
$res = parent::delete();
if ($res && $this->id_product_attribute == 0)
{
$items = self::getSupplierCollection($this->id_product, false);
foreach ($items as $item)
{
if ($item->id_product_attribute > 0)
$item->delete();
}
}
return $res;
}
/**
* For a given Supplier, Product, returns the purchased price
*