Represents quantities available It is either synchronized with Stock or manualy set by the seller
- Class name: StockAvailableCore
- Parent class: ObjectModel
- Source: classes/stock/StockAvailable.php line 33
- $definition
- $depends_on_stock
- $id_product
- $id_product_attribute
- $id_shop
- $id_shop_group
- $out_of_stock
- $quantity
- $webserviceParameters
- $db
- $def
- $fieldsRequired
- $fieldsRequiredDatabase
- $fieldsRequiredLang
- $fieldsSize
- $fieldsSizeLang
- $fieldsValidate
- $fieldsValidateLang
- $get_shop_from_context
- $id
- $id_lang
- $id_shop_list
- $identifier
- $image_dir
- $image_format
- $table
- $tables
- $update_fields
- __construct
- add
- addFieldsRequiredDatabase
- addSqlShopParams
- addSqlShopRestriction
- associateTo
- cacheFieldsRequiredDatabase
- clearCache
- copyStockAvailableFromShopToShop
- delete
- deleteImage
- deleteSelection
- dependsOnStock
- displayFieldName
- duplicateObject
- duplicateShops
- existsInDatabase
- formatFields
- formatValue
- getAssociatedShops
- getDefinition
- getFieldByLang
- getFields
- getFieldsLang
- getFieldsRequiredDatabase
- getFieldsShop
- getQuantityAvailableByProduct
- getStockAvailableIdByProductId
- getTranslationsFields
- getValidationRules
- getWebserviceObjectList
- getWebserviceParameters
- hasMultishopEntries
- hydrate
- hydrateCollection
- isAssociatedToShop
- isCurrentlyUsed
- isLangMultishop
- isMultiShopField
- isMultishop
- makeTranslationFields
- outOfStock
- postSave
- removeProductFromStockAvailable
- resetProductFromStockAvailableByShopGroup
- save
- setDefinitionRetrocompatibility
- setFieldsToUpdate
- setProductDependsOnStock
- setProductOutOfStock
- setQuantity
- synchronize
- toggleStatus
- update
- updateMultishopTable
- updateQuantity
- updateWs
- validateControler
- validateController
- validateField
- validateFields
- validateFieldsLang
- validateFieldsRequiredDatabase
public mixed $definition = array('table' => 'stock_available', 'primary' => 'id_stock_available', 'fields' => array('id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true), 'depends_on_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'out_of_stock' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true)))
- Visibility: public
- This property is static.
- Source: classes/stock/StockAvailable.php line 59.
public boolean $depends_on_stock = false
- Visibility: public
- Source: classes/stock/StockAvailable.php line 51.
public integer $id_product
- Visibility: public
- Source: classes/stock/StockAvailable.php line 36.
public integer $id_product_attribute
- Visibility: public
- Source: classes/stock/StockAvailable.php line 39.
public integer $id_shop
- Visibility: public
- Source: classes/stock/StockAvailable.php line 42.
public integer $id_shop_group
- Visibility: public
- Source: classes/stock/StockAvailable.php line 45.
public boolean $out_of_stock = false
- Visibility: public
- Source: classes/stock/StockAvailable.php line 54.
public integer $quantity
- Visibility: public
- Source: classes/stock/StockAvailable.php line 48.
protected mixed $webserviceParameters = array('fields' => array('id_product' => array('xlink_resource' => 'products'), 'id_product_attribute' => array('xlink_resource' => 'combinations'), 'id_shop' => array('xlink_resource' => 'shops'), 'id_shop_group' => array('xlink_resource' => 'shop_groups')), 'hidden_fields' => array(), 'objectMethods' => array('add' => 'addWs', 'update' => 'updateWs'))
- Visibility: protected
- Source: classes/stock/StockAvailable.php line 76.
protected \Db $db = false
- Visibility: protected
- This property is static.
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 140.
protected array $def
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 130.
protected mixed $fieldsRequired = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 80.
protected mixed $fieldsRequiredDatabase = null
- Visibility: protected
- This property is static.
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 65.
protected mixed $fieldsRequiredLang = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 95.
protected mixed $fieldsSize = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 85.
protected mixed $fieldsSizeLang = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 100.
protected mixed $fieldsValidate = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 90.
protected mixed $fieldsValidateLang = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 105.
protected mixed $get_shop_from_context = true
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 63.
public integer $id
- Visibility: public
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 54.
protected integer $id_lang = null
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 57.
public mixed $id_shop_list = null
- Visibility: public
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 61.
protected mixed $identifier
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 75.
protected string $image_dir = null
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 116.
protected string $image_format = 'jpg'
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 119.
protected mixed $table
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 70.
protected mixed $tables = array()
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 110.
protected array $update_fields = null
- Visibility: protected
- This property is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 135.
mixed ObjectModelCore::__construct(integer $id, integer $id_lang, integer $id_shop)
Build object
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 168
- $id integer - Existing object id in order to load object (optional)
- $id_lang integer - Required if object is multilingual (optional)
- $id_shop integer - ID shop for objects with multishop on langs
mixed StockAvailableCore::add($autodate, $null_values)
Upgrades total_quantity_available after having saved
- Visibility: public
- Source: classes/stock/StockAvailable.php line 370
- $autodate mixed
- $null_values mixed
mixed ObjectModelCore::addFieldsRequiredDatabase($fields)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1212
- $fields mixed
mixed StockAvailableCore::addSqlShopParams(array $params, integer $id_shop)
Add sql params for shops fields - specific to StockAvailable
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 767
- $params array - Reference to the params array
- $id_shop integer - Optional : The shop ID
mixed StockAvailableCore::addSqlShopRestriction(\DbQuery $sql, $shop, string $alias)
Add an sql restriction for shops fields - specific to StockAvailable
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 704
- $sql DbQuery
- $shop mixed
- $alias string - Optional : The current table alias
boolean ObjectModelCore::associateTo(integer|array $id_shops)
This function associate an item to its context
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1264
- $id_shops integer|array
mixed ObjectModelCore::cacheFieldsRequiredDatabase()
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1199
mixed ObjectModelCore::clearCache($all)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1226
- $all mixed
boolean StockAvailableCore::copyStockAvailableFromShopToShop(integer $src_shop_id, integer $dst_shop_id)
Copies stock available content table
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 813
- $src_shop_id integer
- $dst_shop_id integer
boolean ObjectModelCore::delete()
Delete current object from database
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 691
boolean ObjectModelCore::deleteImage($force_delete)
Delete images associated with the object
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1395
- $force_delete mixed
boolean ObjectModelCore::deleteSelection(array $selection)
Delete several objects from database
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 737
- $selection array
boolean StockAvailableCore::dependsOnStock(integer $id_product, integer $id_shop)
For a given product, tells if it depends on the physical (usable) stock
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 656
- $id_product integer
- $id_shop integer - Optional : gets context if null @see Context::getContext()
mixed ObjectModelCore::displayFieldName($field, $class, $htmlentities, \Context $context)
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 982
- $field mixed
- $class mixed
- $htmlentities mixed
- $context Context
\new ObjectModelCore::duplicateObject()
Duplicate current object to database
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 521
mixed ObjectModelCore::duplicateShops($id)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1308
- $id mixed
boolean ObjectModelCore::existsInDatabase(integer $id_entity, string $table)
Specify if an ObjectModel is already in database
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1432
- $id_entity integer
- $table string
array ObjectModelCore::formatFields(integer $type, integer $id_lang)
- Visibility: protected
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 325
- $type integer - FORMAT_COMMON or FORMAT_LANG or FORMAT_SHOP
- $id_lang integer - If this parameter is given, only take lang fields
mixed ObjectModelCore::formatValue(mixed $value, integer $type, $with_quotes, $purify)
Format a data
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 372
- $value mixed
- $type integer
- $with_quotes mixed
- $purify mixed
array ObjectModelCore::getAssociatedShops()
Get the list of associated id_shop
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1293
array ObjectModelCore::getDefinition(string $class, string $field)
Get object definition
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1538
- $class string - Name of object
- $field string - Name of field if we want the definition of one field only
mixed ObjectModelCore::getFieldByLang($field_name, null $id_lang)
Return the field value for the specified language if the field is multilang, else the field value.
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1645
- $field_name mixed
- $id_lang null
array ObjectModelCore::getFields()
Prepare fields for ObjectModel class (add, update) All fields are verified (pSQL, intval.
..)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 253
array ObjectModelCore::getFieldsLang()
Prepare multilang fields
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 290
mixed ObjectModelCore::getFieldsRequiredDatabase($all)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1191
- $all mixed
array ObjectModelCore::getFieldsShop()
Prepare fields for multishop Fields are not validated here, we considere they are already validated in getFields() method, this not the best solution but this is the only one possible for retro compatibility.
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 276
integer StockAvailableCore::getQuantityAvailableByProduct(integer $id_product, integer $id_product_attribute, integer $id_shop)
For a given id_product and id_product_attribute, gets its stock available
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 341
- $id_product integer
- $id_product_attribute integer - Optional
- $id_shop integer - Optional : gets context by default
mixed StockAvailableCore::getStockAvailableIdByProductId($id_product, $id_product_attribute, $id_shop)
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 107
- $id_product mixed
- $id_product_attribute mixed
- $id_shop mixed
mixed ObjectModelCore::getTranslationsFields($fields_array)
- Visibility: protected
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 772
- $fields_array mixed
array ObjectModelCore::getValidationRules(string $class)
Returns object validation rules (fields validity)
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 148
- $class string - Child class name for static use (optional)
mixed ObjectModelCore::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1132
- $sql_join mixed
- $sql_filter mixed
- $sql_sort mixed
- $sql_limit mixed
mixed ObjectModelCore::getWebserviceParameters($ws_params_attribute_name)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1054
- $ws_params_attribute_name mixed
boolean ObjectModelCore::hasMultishopEntries()
Check if there is more than one entries in associated shop table for current entity
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1333
mixed ObjectModelCore::hydrate(array $data, integer $id_lang)
Fill an object with given data. Data must be an array with this syntax: array(objProperty => value, objProperty2 => value, etc.)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1470
- $data array
- $id_lang integer
array ObjectModelCore::hydrateCollection(string $class, array $datas, integer $id_lang)
Fill (hydrate) a list of objects in order to get a collection of these objects
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1489
- $class string - Class of objects to hydrate
- $datas array - List of data (multi-dimensional array)
- $id_lang integer
boolean ObjectModelCore::isAssociatedToShop(integer $id_shop)
Check if current object is associated to a shop
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1241
- $id_shop integer
boolean ObjectModelCore::isCurrentlyUsed(string $table, boolean $has_active_column)
This method is allow to know if a entity is currently used
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1450
- $table string - name of table linked to entity
- $has_active_column boolean - true if the table has an active column
mixed ObjectModelCore::isLangMultishop()
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1350
mixed ObjectModelCore::isMultiShopField($field)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1345
- $field mixed
mixed ObjectModelCore::isMultishop()
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1340
mixed ObjectModelCore::makeTranslationFields($fields, $fields_array, $id_language)
- Visibility: protected
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 788
- $fields mixed
- $fields_array mixed
- $id_language mixed
boolean StockAvailableCore::outOfStock(integer $id_product, integer $id_shop)
For a given product, get its "out of stock" flag
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 679
- $id_product integer
- $id_shop integer - Optional : gets context if null @see Context::getContext()
mixed StockAvailableCore::postSave()
Upgrades total_quantity_available after having saved
- Visibility: public
- Source: classes/stock/StockAvailable.php line 397
mixed StockAvailableCore::removeProductFromStockAvailable(integer $id_product, integer $id_product_attribute, $shop)
Removes a given product from the stock available
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 564
- $id_product integer
- $id_product_attribute integer - Optional
- $shop mixed
mixed StockAvailableCore::resetProductFromStockAvailableByShopGroup(\ShopGroup $shop_group)
Removes all product quantities from all a group of shops If stocks are shared, remoe all old available quantities for all shops of the group Else remove all available quantities for the current group
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 624
- $shop_group ShopGroup - the ShopGroup object
boolean ObjectModelCore::save(boolean $null_values, boolean $autodate)
Save current object to database (add or update)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 418
- $null_values boolean
- $autodate boolean
mixed ObjectModelCore::setDefinitionRetrocompatibility()
Retrocompatibility for classes without $definition static Remove this in 1.6 !
- Visibility: protected
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1576
mixed ObjectModelCore::setFieldsToUpdate(array $fields)
Set a list of specific fields to update array(field1 => true, field2 => false, langfield1 => array(1 => true, 2 => false))
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1671
- $fields array
mixed StockAvailableCore::setProductDependsOnStock(integer $id_product, integer $depends_on_stock, integer $id_shop, $id_product_attribute)
For a given id_product, sets if stock available depends on stock
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 267
- $id_product integer
- $depends_on_stock integer - Optional : true by default
- $id_shop integer - Optional : gets context by default
- $id_product_attribute mixed
mixed StockAvailableCore::setProductOutOfStock(integer $id_product, integer $out_of_stock, integer $id_shop, $id_product_attribute)
For a given id_product, sets if product is available out of stocks
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 304
- $id_product integer
- $out_of_stock integer - Optional false by default
- $id_shop integer - Optional gets context by default
- $id_product_attribute mixed
mixed StockAvailableCore::setQuantity(integer $id_product, integer $id_product_attribute, $quantity, integer $id_shop)
For a given id_product and id_product_attribute sets the quantity available
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 493
- $id_product integer
- $id_product_attribute integer - Optional
- $quantity mixed
- $id_shop integer - Optional
mixed StockAvailableCore::synchronize(integer $id_product, $order_id_shop)
For a given id_product, synchronizes StockAvailable::quantity with Stock::usable_quantity
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 129
- $id_product integer
- $order_id_shop mixed
boolean ObjectModelCore::toggleStatus()
Toggle object status in database
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 753
mixed StockAvailableCore::update($null_values)
Upgrades total_quantity_available after having update
- Visibility: public
- Source: classes/stock/StockAvailable.php line 383
- $null_values mixed
boolean ObjectModelCore::updateMultishopTable(string $classname, array $data, string $where, string $specific_where)
Update a table and splits the common datas and the shop datas
- Visibility: public
- This method is static.
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1365
- $classname string
- $data array
- $where string
- $specific_where string - Only executed for common table
mixed StockAvailableCore::updateQuantity(integer $id_product, integer $id_product_attribute, integer $delta_quantity, integer $id_shop)
For a given id_product and id_product_attribute updates the quantity available
- Visibility: public
- This method is static.
- Source: classes/stock/StockAvailable.php line 446
- $id_product integer
- $id_product_attribute integer - Optional
- $delta_quantity integer - The delta quantity to update
- $id_shop integer - Optional
integer StockAvailableCore::updateWs()
For a given {id_product, id_product_attribute and id_shop}, gets the stock available id associated
- Visibility: public
- Source: classes/stock/StockAvailable.php line 100
mixed ObjectModelCore::validateControler($htmlentities)
TODO: refactor rename all calls to this to validateController
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1000
- $htmlentities mixed
mixed ObjectModelCore::validateController($htmlentities)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1006
- $htmlentities mixed
boolean|string ObjectModelCore::validateField(string $field, mixed $value, integer $id_lang, $skip, $human_errors)
Validate a single field
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 899
- $field string - Field name
- $value mixed - Field value
- $id_lang integer
- $skip mixed
- $human_errors mixed
boolean|string ObjectModelCore::validateFields(boolean $die, boolean $error_return)
Check for fields validity before database interaction
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 826
- $die boolean
- $error_return boolean
boolean|string ObjectModelCore::validateFieldsLang(boolean $die, boolean $error_return)
Check for multilingual fields validity before database interaction
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 855
- $die boolean
- $error_return boolean
mixed ObjectModelCore::validateFieldsRequiredDatabase($htmlentities)
- Visibility: public
- This method is defined by ObjectModelCore.
- Source: classes/ObjectModel.php line 1168
- $htmlentities mixed