|
dolibarr 21.0.0-beta
|


Public Member Functions | |
| __construct () | |
| Constructor. | |
| get ($id, $includestockdata=0, $includesubproducts=false, $includeparentid=false, $includetrans=false) | |
| Get properties of a product object by id. | |
| getByRef ($ref, $includestockdata=0, $includesubproducts=false, $includeparentid=false, $includetrans=false) | |
| Get properties of a product object by ref. | |
| getByRefExt ($ref_ext, $includestockdata=0, $includesubproducts=false, $includeparentid=false, $includetrans=false) | |
| Get properties of a product object by ref_ext. | |
| getByBarcode ($barcode, $includestockdata=0, $includesubproducts=false, $includeparentid=false, $includetrans=false) | |
| Get properties of a product object by barcode. | |
| index ($sortfield="t.ref", $sortorder='ASC', $limit=100, $page=0, $mode=0, $category=0, $sqlfilters='', $ids_only=false, $variant_filter=0, $pagination_data=false, $includestockdata=0, $properties='') | |
| List products. | |
| post ($request_data=null) | |
| Create product object. | |
| put ($id, $request_data=null) | |
| Update product. | |
| delete ($id) | |
| Delete product. | |
| getSubproducts ($id) | |
| Get the list of subproducts of the product. | |
| addSubproducts ($id, $subproduct_id, $qty, $incdec=1) | |
| Add subproduct. | |
| delSubproducts ($id, $subproduct_id) | |
| Remove subproduct. | |
| getCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0) | |
| Get categories for a product. | |
| getCustomerPricesPerSegment ($id) | |
| Get prices per segment for a product. | |
| getCustomerPricesPerCustomer ($id, $thirdparty_id='') | |
| Get prices per customer for a product. | |
| getCustomerPricesPerQuantity ($id) | |
| Get prices per quantity for a product. | |
| addPurchasePrice ($id, $qty, $buyprice, $price_base_type, $fourn_id, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='', $localtaxes_array=array(), $newdefaultvatcode='', $multicurrency_buyprice=0, $multicurrency_price_base_type='HT', $multicurrency_tx=1, $multicurrency_code='', $desc_fourn='', $barcode='', $fk_barcode_type=null) | |
| Add/Update purchase prices for a product. | |
| deletePurchasePrice ($id, $priceid) | |
| Delete purchase price for a product. | |
| getSupplierProducts ($sortfield="t.ref", $sortorder='ASC', $limit=100, $page=0, $mode=0, $category=0, $supplier=0, $sqlfilters='') | |
| Get a list of all purchase prices of products. | |
| getPurchasePrices ($id, $ref='', $ref_ext='', $barcode='') | |
| Get purchase prices for a product. | |
| getAttributes ($sortfield="t.ref", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='') | |
| Get attributes. | |
| getAttributeById ($id) | |
| Get attribute by ID. | |
| getAttributesByRef ($ref) | |
| Get attributes by ref. | |
| getAttributesByRefExt ($ref_ext) | |
| Get attributes by ref_ext. | |
| addAttributes ($ref, $label, $ref_ext='') | |
| Add attributes. | |
| putAttributes ($id, $request_data=null) | |
| Update attributes by id. | |
| deleteAttributes ($id) | |
| Delete attributes by id. | |
| getAttributeValueById ($id) | |
| Get attribute value by id. | |
| getAttributeValueByRef ($id, $ref) | |
| Get attribute value by ref. | |
| deleteAttributeValueByRef ($id, $ref) | |
| Delete attribute value by ref. | |
| getAttributeValues ($id) | |
| Get all values for an attribute id. | |
| getAttributeValuesByRef ($ref) | |
| Get all values for an attribute ref. | |
| addAttributeValue ($id, $ref, $value) | |
| Add attribute value. | |
| putAttributeValue ($id, $request_data) | |
| Update attribute value. | |
| deleteAttributeValueById ($id) | |
| Delete attribute value by id. | |
| getVariants ($id, $includestock=0) | |
| Get product variants. | |
| getVariantsByProdRef ($ref) | |
| Get product variants by Product ref. | |
| addVariant ($id, $weight_impact, $price_impact, $price_impact_is_percent, $features, $reference='', $ref_ext='') | |
| Add variant. | |
| addVariantByProductRef ($ref, $weight_impact, $price_impact, $price_impact_is_percent, $features) | |
| Add variant by product ref. | |
| putVariant ($id, $request_data=null) | |
| Put product variants. | |
| deleteVariant ($id) | |
| Delete product variants. | |
| getStock ($id, $selected_warehouse_id=null) | |
| Get stock data for the product id given. | |
Public Member Functions inherited from DolibarrApi | |
| __construct ($db, $cachedir='', $refreshCache=false) | |
| Constructor. | |
Protected Member Functions | |
| _cleanObjectDatas ($object) | |
| Clean sensible object datas. | |
Protected Member Functions inherited from DolibarrApi | |
| _checkValForAPI ($field, $value, $object) | |
| Check and convert a string depending on its type/name. | |
| _filterObjectProperties ($object, $properties) | |
| Filter properties that will be returned on object. | |
| _checkFilters ($sqlfilters, &$error='') | |
| Return if a $sqlfilters parameter is valid Function no more used. | |
Private Member Functions | |
| _validate ($data) | |
| Validate fields before create or update object. | |
| _fetch ($id, $ref='', $ref_ext='', $barcode='', $includestockdata=0, $includesubproducts=false, $includeparentid=false, $includeifobjectisused=false, $includetrans=false) | |
| Get properties of 1 product object. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from DolibarrApi | |
| static | _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
| Check access by user to a given resource. | |
| static | _forge_criteria_callback ($matches) |
| Function to forge a SQL criteria from a Generic filter string. | |
Definition at line 37 of file api_products.class.php.
|
protected |
Clean sensible object datas.
| Object | $object | Object to clean |
Reimplemented from DolibarrApi.
Definition at line 2031 of file api_products.class.php.
References $object.
Referenced by getAttributes(), getPurchasePrices(), getSupplierProducts(), and index().
|
private |
Get properties of 1 product object.
Return an array with product information.
| int | $id | ID of product |
| string | $ref | Ref of element |
| string | $ref_ext | Ref ext of element |
| string | $barcode | Barcode of element |
| int | $includestockdata | Load also information about stock (slower) |
| bool | $includesubproducts | Load information about subproducts (if product is a virtual product) |
| bool | $includeparentid | Load also ID of parent product (if product is a variant of a parent product) |
| bool | $includeifobjectisused | Check if product object is used and set property 'is_object_used' with result. |
| bool | $includetrans | Load also the translations of product label and description |
| RestException | 401 |
| RestException | 403 |
| RestException | 404 |
Definition at line 2129 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
Referenced by get(), getByBarcode(), getByRef(), and getByRefExt().
|
private |
Validate fields before create or update object.
| array | $data | Datas to validate |
| RestException |
Definition at line 2098 of file api_products.class.php.
Referenced by post().
| Products::addAttributes | ( | $ref, | |
| $label, | |||
| $ref_ext = '' ) |
Add attributes.
| string | $ref | Reference of Attribute |
| string | $label | Label of Attribute |
| string | $ref_ext | Reference of Attribute |
| RestException | 500 System error |
| RestException | 401 |
@url POST attributes
Definition at line 1308 of file api_products.class.php.
| Products::addAttributeValue | ( | $id, | |
| $ref, | |||
| $value ) |
Add attribute value.
| int | $id | ID of Attribute |
| string | $ref | Reference of Attribute value |
| string | $value | Value of Attribute value |
| RestException | 500 System error |
| RestException | 401 |
@url POST attributes/{id}/values
Definition at line 1620 of file api_products.class.php.
References $id.
| Products::addPurchasePrice | ( | $id, | |
| $qty, | |||
| $buyprice, | |||
| $price_base_type, | |||
| $fourn_id, | |||
| $availability, | |||
| $ref_fourn, | |||
| $tva_tx, | |||
| $charges = 0, | |||
| $remise_percent = 0, | |||
| $remise = 0, | |||
| $newnpr = 0, | |||
| $delivery_time_days = 0, | |||
| $supplier_reputation = '', | |||
| $localtaxes_array = array(), | |||
| $newdefaultvatcode = '', | |||
| $multicurrency_buyprice = 0, | |||
| $multicurrency_price_base_type = 'HT', | |||
| $multicurrency_tx = 1, | |||
| $multicurrency_code = '', | |||
| $desc_fourn = '', | |||
| $barcode = '', | |||
| $fk_barcode_type = null ) |
Add/Update purchase prices for a product.
| int | $id | ID of Product |
| float | $qty | Min quantity for which price is valid |
| float | $buyprice | Purchase price for the quantity min |
| string | $price_base_type | HT or TTC |
| int | $fourn_id | Supplier ID |
| int | $availability | Product availability |
| string | $ref_fourn | Supplier ref |
| float | $tva_tx | New VAT Rate (For example 8.5. Should not be a string) |
| float | $charges | costs affering to product |
| float | $remise_percent | Discount regarding qty (percent) |
| float | $remise | Discount regarding qty (amount) |
| int | $newnpr | Set NPR or not |
| int | $delivery_time_days | Delay in days for delivery (max). May be '' if not defined. |
| string | $supplier_reputation | Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER) |
| array | $localtaxes_array | Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). |
| string | $newdefaultvatcode | Default vat code |
| float | $multicurrency_buyprice | Purchase price for the quantity min in currency |
| string | $multicurrency_price_base_type | HT or TTC in currency |
| float | $multicurrency_tx | Rate currency |
| string | $multicurrency_code | Currency code |
| string | $desc_fourn | Custom description for product_fourn_price |
| string | $barcode | Barcode |
| int | $fk_barcode_type | Barcode type |
| RestException | 500 System error |
| RestException | 401 |
@url POST {id}/purchase_prices
Definition at line 843 of file api_products.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and sanitizeVal().
| Products::addSubproducts | ( | $id, | |
| $subproduct_id, | |||
| $qty, | |||
| $incdec = 1 ) |
Add subproduct.
Link a product/service to a parent product/service
| int | $id | Id of parent product/service |
| int | $subproduct_id | Id of child product/service |
| float | $qty | Quantity |
| int | $incdec | 1=Increase/decrease stock of child when parent stock increase/decrease |
| RestException | |
| RestException | 401 |
| RestException | 404 |
@url POST {id}/subproducts/add
Definition at line 605 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Products::addVariant | ( | $id, | |
| $weight_impact, | |||
| $price_impact, | |||
| $price_impact_is_percent, | |||
| $features, | |||
| $reference = '', | |||
| $ref_ext = '' ) |
Add variant.
"features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
| int | $id | ID of Product |
| float | $weight_impact | Weight impact of variant |
| float | $price_impact | Price impact of variant |
| bool | $price_impact_is_percent | Price impact in percent (true or false) |
| array | $features | List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) |
| string | $reference | Customized reference of variant |
| string | $ref_ext | External reference of variant |
| RestException | 500 System error |
| RestException | 401 |
| RestException | 404 |
@url POST {id}/variants
Definition at line 1811 of file api_products.class.php.
References $id, and price2num().
| Products::addVariantByProductRef | ( | $ref, | |
| $weight_impact, | |||
| $price_impact, | |||
| $price_impact_is_percent, | |||
| $features ) |
Add variant by product ref.
"features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
| string | $ref | Ref of Product |
| float | $weight_impact | Weight impact of variant |
| float | $price_impact | Price impact of variant |
| bool | $price_impact_is_percent | Price impact in percent (true or false) |
| array | $features | List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...) |
| RestException | 500 System error |
| RestException | 401 |
| RestException | 404 |
@url POST ref/{ref}/variants
Definition at line 1872 of file api_products.class.php.
References price2num().
| Products::delete | ( | $id | ) |
Delete product.
| int | $id | Product ID |
Definition at line 522 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Products::deleteAttributes | ( | $id | ) |
Delete attributes by id.
| int | $id | ID of Attribute |
| RestException | 500 System error |
| RestException | 401 |
@url DELETE attributes/{id}
Definition at line 1392 of file api_products.class.php.
References $id.
| Products::deleteAttributeValueById | ( | $id | ) |
Delete attribute value by id.
| int | $id | ID of Attribute value |
| RestException | 500 System error |
| RestException | 401 |
@url DELETE attributes/values/{id}
Definition at line 1705 of file api_products.class.php.
References $id.
| Products::deleteAttributeValueByRef | ( | $id, | |
| $ref ) |
Delete attribute value by ref.
| int | $id | ID of Attribute |
| string | $ref | Ref of Attribute value |
| RestException | 401 |
@url DELETE attributes/{id}/values/ref/{ref}
Definition at line 1504 of file api_products.class.php.
References $id, and getEntity().
| Products::deletePurchasePrice | ( | $id, | |
| $priceid ) |
Delete purchase price for a product.
| int | $id | Product ID |
| int | $priceid | purchase price ID |
@url DELETE {id}/purchase_prices/{priceid}
| RestException | 401 |
| RestException | 404 |
Definition at line 901 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Products::deleteVariant | ( | $id | ) |
Delete product variants.
| int | $id | ID of Variant |
| RestException | 500 System error |
| RestException | 401 |
@url DELETE variants/{id}
Definition at line 1966 of file api_products.class.php.
References $id.
| Products::delSubproducts | ( | $id, | |
| $subproduct_id ) |
Remove subproduct.
Unlink a product/service from a parent product/service
| int | $id | Id of parent product/service |
| int | $subproduct_id | Id of child product/service |
| RestException | 401 |
| RestException | 404 |
@url DELETE {id}/subproducts/remove/{subproduct_id}
Definition at line 635 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Products::get | ( | $id, | |
| $includestockdata = 0, | |||
| $includesubproducts = false, | |||
| $includeparentid = false, | |||
| $includetrans = false ) |
Get properties of a product object by id.
Return an array with product information.
| int | $id | ID of product |
| int | $includestockdata | Load also information about stock (slower) |
| bool | $includesubproducts | Load information about subproducts |
| bool | $includeparentid | Load also ID of parent product (if product is a variant of a parent product) |
| bool | $includetrans | Load also the translations of product label and description |
| RestException | 401 |
| RestException | 403 |
| RestException | 404 |
Definition at line 85 of file api_products.class.php.
| Products::getAttributeById | ( | $id | ) |
Get attribute by ID.
| int | $id | ID of Attribute |
| RestException | 401 |
| RestException | 404 |
@url GET attributes/{id}
Definition at line 1163 of file api_products.class.php.
References $id.
| Products::getAttributes | ( | $sortfield = "t.ref", | |
| $sortorder = 'ASC', | |||
| $limit = 100, | |||
| $page = 0, | |||
| $sqlfilters = '', | |||
| $properties = '' ) |
Get attributes.
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:color)" |
| string | $properties | Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names |
| RestException | 401 |
| RestException | 404 |
| RestException | 503 |
@url GET attributes
Definition at line 1101 of file api_products.class.php.
References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().
| Products::getAttributesByRef | ( | $ref | ) |
Get attributes by ref.
| string | $ref | Reference of Attribute |
| RestException | 401 |
| RestException | 404 |
@url GET attributes/ref/{ref}
Definition at line 1206 of file api_products.class.php.
References getEntity().
| Products::getAttributesByRefExt | ( | $ref_ext | ) |
Get attributes by ref_ext.
| string | $ref_ext | External reference of Attribute |
| RestException | 500 System error |
| RestException | 401 |
@url GET attributes/ref_ext/{ref_ext}
Definition at line 1256 of file api_products.class.php.
References getEntity().
| Products::getAttributeValueById | ( | $id | ) |
Get attribute value by id.
| int | $id | ID of Attribute value |
| RestException | 500 System error |
| RestException | 401 |
@url GET attributes/values/{id}
Definition at line 1420 of file api_products.class.php.
References $id, and getEntity().
| Products::getAttributeValueByRef | ( | $id, | |
| $ref ) |
Get attribute value by ref.
| int | $id | ID of Attribute value |
| string | $ref | Ref of Attribute value |
| RestException | 500 System error |
| RestException | 401 |
@url GET attributes/{id}/values/ref/{ref}
Definition at line 1461 of file api_products.class.php.
References $id, and getEntity().
| Products::getAttributeValues | ( | $id | ) |
Get all values for an attribute id.
| int | $id | ID of an Attribute |
| RestException | 401 |
| RestException | 500 System error |
@url GET attributes/{id}/values
Definition at line 1547 of file api_products.class.php.
References $id.
| Products::getAttributeValuesByRef | ( | $ref | ) |
Get all values for an attribute ref.
| string | $ref | Ref of an Attribute |
| RestException | 401 |
@url GET attributes/ref/{ref}/values
Definition at line 1578 of file api_products.class.php.
| Products::getByBarcode | ( | $barcode, | |
| $includestockdata = 0, | |||
| $includesubproducts = false, | |||
| $includeparentid = false, | |||
| $includetrans = false ) |
Get properties of a product object by barcode.
Return an array with product information.
| string | $barcode | Barcode of element |
| int | $includestockdata | Load also information about stock (slower) |
| bool | $includesubproducts | Load information about subproducts |
| bool | $includeparentid | Load also ID of parent product (if product is a variant of a parent product) |
| bool | $includetrans | Load also the translations of product label and description |
@url GET barcode/{barcode}
| RestException | 401 |
| RestException | 403 |
| RestException | 404 |
Definition at line 157 of file api_products.class.php.
References _fetch().
| Products::getByRef | ( | $ref, | |
| $includestockdata = 0, | |||
| $includesubproducts = false, | |||
| $includeparentid = false, | |||
| $includetrans = false ) |
Get properties of a product object by ref.
Return an array with product information.
| string | $ref | Ref of element |
| int | $includestockdata | Load also information about stock (slower) |
| bool | $includesubproducts | Load information about subproducts |
| bool | $includeparentid | Load also ID of parent product (if product is a variant of a parent product) |
| bool | $includetrans | Load also the translations of product label and description |
@url GET ref/{ref}
| RestException | 401 |
| RestException | 403 |
| RestException | 404 |
Definition at line 109 of file api_products.class.php.
References _fetch().
| Products::getByRefExt | ( | $ref_ext, | |
| $includestockdata = 0, | |||
| $includesubproducts = false, | |||
| $includeparentid = false, | |||
| $includetrans = false ) |
Get properties of a product object by ref_ext.
Return an array with product information.
| string | $ref_ext | Ref_ext of element |
| int | $includestockdata | Load also information about stock (slower) |
| bool | $includesubproducts | Load information about subproducts |
| bool | $includeparentid | Load also ID of parent product (if product is a variant of a parent product) |
| bool | $includetrans | Load also the translations of product label and description |
@url GET ref_ext/{ref_ext}
| RestException | 401 |
| RestException | 403 |
| RestException | 404 |
Definition at line 133 of file api_products.class.php.
References _fetch().
| Products::getCategories | ( | $id, | |
| $sortfield = "s.rowid", | |||
| $sortorder = 'ASC', | |||
| $limit = 0, | |||
| $page = 0 ) |
Get categories for a product.
| int | $id | ID of product |
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
@url GET {id}/categories
Definition at line 666 of file api_products.class.php.
References $id.
| Products::getCustomerPricesPerCustomer | ( | $id, | |
| $thirdparty_id = '' ) |
Get prices per customer for a product.
| int | $id | ID of product |
| string | $thirdparty_id | Thirdparty id to filter orders of (example '1') {@pattern /^[0-9,]*$/i} |
@url GET {id}/selling_multiprices/per_customer
Definition at line 734 of file api_products.class.php.
References $conf, $id, and getDolGlobalString().
| Products::getCustomerPricesPerQuantity | ( | $id | ) |
Get prices per quantity for a product.
| int | $id | ID of product |
@url GET {id}/selling_multiprices/per_quantity
Definition at line 783 of file api_products.class.php.
References $conf, $id, and getDolGlobalString().
| Products::getCustomerPricesPerSegment | ( | $id | ) |
Get prices per segment for a product.
| int | $id | ID of product |
@url GET {id}/selling_multiprices/per_segment
Definition at line 692 of file api_products.class.php.
References $conf, $id, and getDolGlobalString().
| Products::getPurchasePrices | ( | $id, | |
| $ref = '', | |||
| $ref_ext = '', | |||
| $barcode = '' ) |
Get purchase prices for a product.
Return an array with product information. TODO implement getting a product by ref or by $ref_ext
| int | $id | ID of product |
| string | $ref | Ref of element |
| string | $ref_ext | Ref ext of element |
| string | $barcode | Barcode of element |
@url GET {id}/purchase_prices
| RestException | 401 |
| RestException | 403 |
| RestException | 404 |
Definition at line 1047 of file api_products.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
| Products::getStock | ( | $id, | |
| $selected_warehouse_id = null ) |
Get stock data for the product id given.
Optionally with $selected_warehouse_id parameter user can get stock of specific warehouse
| int | $id | ID of Product |
| int | $selected_warehouse_id | ID of warehouse |
| RestException | 500 System error |
| RestException | 403 |
| RestException | 404 |
@url GET {id}/stock
Definition at line 1995 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Products::getSubproducts | ( | $id | ) |
Get the list of subproducts of the product.
| int | $id | Id of parent product/service |
| RestException | |
| RestException | 401 |
| RestException | 404 |
@url GET {id}/subproducts
Definition at line 567 of file api_products.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
| Products::getSupplierProducts | ( | $sortfield = "t.ref", | |
| $sortorder = 'ASC', | |||
| $limit = 100, | |||
| $page = 0, | |||
| $mode = 0, | |||
| $category = 0, | |||
| $supplier = 0, | |||
| $sqlfilters = '' ) |
Get a list of all purchase prices of products.
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| int | $mode | Use this param to filter list (0 for all, 1 for only product, 2 for only service) |
| int | $category | Use this param to filter list by category of product |
| int | $supplier | Use this param to filter list by supplier |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" |
@url GET purchase_prices
Definition at line 938 of file api_products.class.php.
References $conf, _cleanObjectDatas(), and forgeSQLFromUniversalSearchCriteria().
| Products::getVariants | ( | $id, | |
| $includestock = 0 ) |
Get product variants.
| int | $id | ID of Product |
| int | $includestock | Default value 0. If parameter is set to 1 the response will contain stock data of each variant |
| RestException | 500 System error |
| RestException | 401 |
@url GET {id}/variants
Definition at line 1732 of file api_products.class.php.
References $id.
| Products::getVariantsByProdRef | ( | $ref | ) |
Get product variants by Product ref.
| string | $ref | Ref of Product |
| RestException | 500 System error |
| RestException | 401 |
@url GET ref/{ref}/variants
Definition at line 1768 of file api_products.class.php.
| Products::index | ( | $sortfield = "t.ref", | |
| $sortorder = 'ASC', | |||
| $limit = 100, | |||
| $page = 0, | |||
| $mode = 0, | |||
| $category = 0, | |||
| $sqlfilters = '', | |||
| $ids_only = false, | |||
| $variant_filter = 0, | |||
| $pagination_data = false, | |||
| $includestockdata = 0, | |||
| $properties = '' ) |
List products.
Get a list of products
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| int | $mode | Use this param to filter list (0 for all, 1 for only product, 2 for only service) |
| int | $category | Use this param to filter list by category |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" |
| bool | $ids_only | Return only IDs of product instead of all properties (faster, above all if list is long) |
| int | $variant_filter | Use this param to filter list (0 = all, 1=products without variants, 2=parent of variants, 3=variants only) |
| bool | $pagination_data | If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0 |
| int | $includestockdata | Load also information about stock (slower) |
| string | $properties | Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names |
Definition at line 181 of file api_products.class.php.
References $conf, _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().
| Products::post | ( | $request_data = null | ) |
Create product object.
| array | $request_data | Request data |
Definition at line 309 of file api_products.class.php.
References DolibarrApi\_checkValForAPI(), _validate(), getDolGlobalString(), and sanitizeVal().
| Products::put | ( | $id, | |
| $request_data = null ) |
Update product.
Price will be updated by this API only if option is set on "One price per product" or if PRODUIT_MULTIPRICES is set (1 price per segment) See other APIs for other price modes.
| int | $id | Id of product to update |
| array | $request_data | Datas |
| RestException | 401 |
| RestException | 404 |
Definition at line 368 of file api_products.class.php.
References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), dol_clone(), getDolGlobalString(), and sanitizeVal().
| Products::putAttributes | ( | $id, | |
| $request_data = null ) |
Update attributes by id.
| int | $id | ID of Attribute |
| array | $request_data | Datas |
| RestException | |
| RestException | 401 |
| RestException | 404 |
@url PUT attributes/{id}
Definition at line 1340 of file api_products.class.php.
References $id, and sanitizeVal().
| Products::putAttributeValue | ( | $id, | |
| $request_data ) |
Update attribute value.
| int | $id | ID of Attribute |
| array | $request_data | Datas |
| RestException | 401 |
| RestException | 500 System error |
@url PUT attributes/values/{id}
Definition at line 1653 of file api_products.class.php.
References $id, and sanitizeVal().
| Products::putVariant | ( | $id, | |
| $request_data = null ) |
Put product variants.
| int | $id | ID of Variant |
| array | $request_data | Datas |
| RestException | 500 System error |
| RestException | 401 |
@url PUT variants/{id}
Definition at line 1926 of file api_products.class.php.
References $id, and sanitizeVal().