Product Model
The Product model represents a product that your shop offers for sale.
Model Attributes
- id
-
Unique numeric ID of the product.
Methods:
integer getId()
object setId( integer ) - sku
-
The SKU number of this product.
Methods:
string getSku()
object setSku( string ) - name
-
The name of the product.
Methods:
string getName()
object setName( string ) - description
-
The description of the product.
Methods:
string getDescription()
object setDescription( string ) - cost
-
The cost of the product.
Methods:
integer getCost()
object setCost( integer ) - price
-
The price of the product.
Methods:
integer getPrice()
object setPrice( integer ) - supplier_reference
-
The supplier reference the product.
Methods:
string getSupplierReference()
object setSupplierReference( string )
API Calls
- array Product::all()
-
Get all order created by your shop.
Returns:
Array containing the list of Product objects that belong to your shop. - object Product::get( integer $id )
-
Get the product identified by the unique id.
Returns:
The Product object identified by the unique id. - object create()
-
Create a new product and attach it to your shop.
The Product object that you use to call this method
does not need an id, and if you provide an id, it will be
ignored. All other attributes of the Product object will be
saved with the newly created product.
Returns:
The Product object that was created. - object update()
-
Update an existing product.
The Product object that you use to call this method
requires a valid id to identiy the product that
will be updated. Other than the id, you only need to
provide the attributes that you wish to update. If an
attribute is not set, then it will not be updated in
the database, and it will keep it's original value.
Returns:
The Product object that was updated. - object delete()
-
Delete an existing product.
The Product object that you use to call this method
requires a valid id to identiy the product that
will be deleted. NOTE You cannot delete a product that
has inventory. Only products that have zero
"physical inventory" can be deleted with this call.
Returns:
The Product object that was deleted.