dolibarr  7.0.0-beta
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
ProductAttribute Class Reference

Class ProductAttribute Used to represent a product attribute. More...

Public Member Functions

 fetch ($id)
 Fetches the properties of a product attribute. More...
 
 fetchAll ()
 Returns an array of all product variants. More...
 
 create (User $user)
 Creates a product attribute. More...
 
 update (User $user)
 Updates a product attribute. More...
 
 delete ()
 Deletes a product attribute. More...
 
 countChildValues ()
 Returns the number of values for this attribute. More...
 
 countChildProducts ()
 Returns the number of products that are using this attribute. More...
 
 moveUp ()
 Shows this attribute before others. More...
 
 moveDown ()
 Shows this attribute after others. More...
 

Static Public Member Functions

static bulkUpdateOrder (DoliDB $db, array $order)
 Updates the order of all variants. More...
 

Protected Member Functions

 reorderLines ()
 Reorders the order of the variants. More...
 

Private Member Functions

 moveLine ($type)
 Internal function to handle moveUp and moveDown functions. More...
 

Detailed Description

Class ProductAttribute Used to represent a product attribute.

Definition at line 23 of file ProductAttribute.class.php.

Member Function Documentation

static ProductAttribute::bulkUpdateOrder ( DoliDB  $db,
array  $order 
)
static

Updates the order of all variants.

Used by AJAX page for drag&drop

Parameters
DoliDB$dbDatabase handler
array$orderArray with row id ordered in ascendent mode
Returns
int <0 KO >0 OK

Definition at line 324 of file ProductAttribute.class.php.

ProductAttribute::countChildProducts ( )

Returns the number of products that are using this attribute.

Returns
int

Definition at line 206 of file ProductAttribute.class.php.

References getEntity().

ProductAttribute::countChildValues ( )

Returns the number of values for this attribute.

Returns
int

Definition at line 191 of file ProductAttribute.class.php.

ProductAttribute::create ( User  $user)

Creates a product attribute.

Parameters
User$userObject user that create
Returns
int <0 KO, Id of new variant if OK

Definition at line 130 of file ProductAttribute.class.php.

ProductAttribute::delete ( )

Deletes a product attribute.

Returns
int <0 KO, >0 OK

Definition at line 175 of file ProductAttribute.class.php.

ProductAttribute::fetch (   $id)

Fetches the properties of a product attribute.

Parameters
int$idAttribute id
Returns
int <1 KO, >1 OK

Definition at line 70 of file ProductAttribute.class.php.

References getEntity().

ProductAttribute::fetchAll ( )

Returns an array of all product variants.

Returns
ProductAttribute[]

Definition at line 99 of file ProductAttribute.class.php.

References dol_print_error(), and getEntity().

ProductAttribute::moveDown ( )

Shows this attribute after others.

Returns
int <0 KO >0 OK

Definition at line 312 of file ProductAttribute.class.php.

References moveLine().

ProductAttribute::moveLine (   $type)
private

Internal function to handle moveUp and moveDown functions.

Parameters
string$typeup/down
Returns
int <0 KO >0 OK

Definition at line 263 of file ProductAttribute.class.php.

References reorderLines(), and update().

Referenced by moveDown(), and moveUp().

ProductAttribute::moveUp ( )

Shows this attribute before others.

Returns
int <0 KO >0 OK

Definition at line 302 of file ProductAttribute.class.php.

References moveLine().

ProductAttribute::reorderLines ( )
protected

Reorders the order of the variants.

This is an internal function used by moveLine function

Returns
int <0 KO >0 OK

Definition at line 225 of file ProductAttribute.class.php.

Referenced by moveLine().

ProductAttribute::update ( User  $user)

Updates a product attribute.

Parameters
User$userObject user
Returns
int <0 KO, >0 OK

Definition at line 155 of file ProductAttribute.class.php.

Referenced by moveLine().


The documentation for this class was generated from the following file: