Merge pull request #266 from anat/development
[+] WS : Add product bundle retrieval from Web services
This commit is contained in:
+27
-1
@@ -362,6 +362,10 @@ class ProductCore extends ObjectModel
|
|||||||
'getter' => false,
|
'getter' => false,
|
||||||
'setter' => false
|
'setter' => false
|
||||||
),
|
),
|
||||||
|
'type' => array(
|
||||||
|
'getter' => 'getWsType',
|
||||||
|
'setter' => false,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'associations' => array(
|
'associations' => array(
|
||||||
'categories' => array(
|
'categories' => array(
|
||||||
@@ -414,7 +418,14 @@ class ProductCore extends ObjectModel
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'xlink_resource' => 'product'),
|
'xlink_resource' => 'product'),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'product_bundle' => array(
|
||||||
|
'resource' => 'products',
|
||||||
|
'fields' => array(
|
||||||
|
'id' => array('required' => true),
|
||||||
|
'quantity' => array(),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -5210,5 +5221,20 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWsType()
|
||||||
|
{
|
||||||
|
$type_information = array(
|
||||||
|
Product::PTYPE_SIMPLE => 'simple',
|
||||||
|
Product::PTYPE_PACK => 'pack',
|
||||||
|
Product::PTYPE_VIRTUAL => 'virtual',
|
||||||
|
);
|
||||||
|
return $type_information[$this->getType()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWsProductBundle()
|
||||||
|
{
|
||||||
|
return Db::getInstance()->executeS('SELECT id_product_item as id, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)$this->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user