// MERGE with trunk revision 7754

This commit is contained in:
rMalie
2011-07-27 12:48:42 +00:00
parent 21017fb5d8
commit 233c0076b7
182 changed files with 6179 additions and 1333 deletions
+29 -1
View File
@@ -263,7 +263,7 @@ class ProductCore extends ObjectModel
'out_of_stock' => array('required' => true),
'new' => array(),
'cache_default_attribute' => array(),
'id_default_image' => array('getter' => 'getCoverWs', 'setter' => false, 'xlink_resource' => array('resourceName' => 'images', 'subResourceName' => 'products')),
'id_default_image' => array('getter' => 'getCoverWs', 'setter' => 'setCoverWs', 'xlink_resource' => array('resourceName' => 'images', 'subResourceName' => 'products')),
'id_default_combination' => array('getter' => 'getWsDefaultCombination', 'setter' => 'setWsDefaultCombination', 'xlink_resource' => array('resourceName' => 'combinations')),
'position_in_category' => array('getter' => 'getWsPositionInCategory', 'setter' => false),
'manufacturer_name' => array('getter' => 'getWsManufacturerName', 'setter' => false),
@@ -285,6 +285,10 @@ class ProductCore extends ObjectModel
'id' => array('required' => true),
'id_feature_value' => array('required' => true, 'xlink_resource' => 'product_feature_values'),
)),
'tags' => array('resource' => 'tag',
'fields' => array(
'id' => array('required' => true),
)),
),
);
@@ -3336,6 +3340,21 @@ class ProductCore extends ObjectModel
return $result['id_image'];
}
/**
* Webservice setter : set virtual field id_default_image in category
*
* @return bool
*/
public function setCoverWs($id_image)
{
Db::getInstance()->ExecuteS('UPDATE `'._DB_PREFIX_.'image`
SET `cover` = 0 WHERE `id_product` = '.(int)($this->id).'
');
Db::getInstance()->ExecuteS('UPDATE `'._DB_PREFIX_.'image`
SET `cover` = 1 WHERE `id_product` = '.(int)($this->id).' AND `id_image` = '.(int)$id_image);
return true;
}
/**
* Webservice getter : get image ids of current product for association
*
@@ -3350,6 +3369,15 @@ class ProductCore extends ObjectModel
ORDER BY `position`');
}
public function getWsTags()
{
return Db::getInstance()->ExecuteS('
SELECT `id_tag` as id
FROM `'._DB_PREFIX_.'product_tag`
WHERE `id_product` = '.(int)($this->id));
}
public function getWsManufacturerName()
{
return Manufacturer::getNameById((int)$this->id_manufacturer);