dolibarr  9.0.0
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

 __construct (DoliDB $db)
 Constructor. More...
 
 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.

Constructor & Destructor Documentation

◆ __construct()

ProductAttribute::__construct ( DoliDB  $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

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

Member Function Documentation

◆ bulkUpdateOrder()

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 329 of file ProductAttribute.class.php.

◆ countChildProducts()

ProductAttribute::countChildProducts ( )

Returns the number of products that are using this attribute.

Returns
int

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

◆ countChildValues()

ProductAttribute::countChildValues ( )

Returns the number of values for this attribute.

Returns
int

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

◆ create()

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 135 of file ProductAttribute.class.php.

◆ delete()

ProductAttribute::delete ( )

Deletes a product attribute.

Returns
int <0 KO, >0 OK

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

◆ fetch()

ProductAttribute::fetch (   $id)

Fetches the properties of a product attribute.

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

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

◆ fetchAll()

ProductAttribute::fetchAll ( )

Returns an array of all product variants.

Returns
ProductAttribute[]

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

◆ moveDown()

ProductAttribute::moveDown ( )

Shows this attribute after others.

Returns
int <0 KO >0 OK

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

References moveLine().

◆ 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 268 of file ProductAttribute.class.php.

Referenced by moveDown(), and moveUp().

◆ moveUp()

ProductAttribute::moveUp ( )

Shows this attribute before others.

Returns
int <0 KO >0 OK

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

References moveLine().

◆ reorderLines()

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 230 of file ProductAttribute.class.php.

◆ update()

ProductAttribute::update ( User  $user)

Updates a product attribute.

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

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


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