ePages 7.21.0 - DE_EPAGES/Product/API/Table/TopSeller.pm

Package DE_EPAGES::Product::API::Table::TopSeller

interface for table TopSeller

@EXPORT_OK
InsertTopSeller
UpdateTopSeller
DeleteTopSeller
GetAllPKeyTopSellers
GetAllInfoTopSellers
GetInfoTopSeller
ExistsTopSeller
GetPKeyTopSellersByShopID
GetInfoTopSellersByShopID
GenerateTopSeller
GetTopSellerLimit

Functions

DeleteTopSeller
ExistsTopSeller
GenerateTopSeller
GetAllInfoTopSellers
GetAllPKeyTopSellers
GetInfoTopSeller
GetInfoTopSellersByShopID
GetPKeyTopSellersByShopID
GetTopSellerLimit
InsertTopSeller
OnDeleteProduct
OnDeleteShop
UpdateTopSeller

DeleteTopSeller

Deletes a(n) TopSeller.

Syntax
DeleteTopSeller($ProductID);
DeleteTopSeller($hTopSeller); # if $hTopSeller includes ProductID
Input
$ProductID (int)
ID of Product (primary key)

ExistsTopSeller

Returns true if the TopSeller exists.

Syntax
$exists = ExistsTopSeller($ProductID);
Input
$ProductID (int)
ID of Product (primary key)
Return
$exists (boolean)
1/0 the TopSeller exists (yes/no)

GenerateTopSeller

Refresh TopSeller statistic for period between $DateTime and NOW()

Syntax
GenerateTopSeller($DateTime);
Input
$DateTime (DateTime)
starting date for calculation

GetAllInfoTopSellers

Returns all objects of TopSeller.

Syntax
$ahTopSellers = GetAllInfoTopSellers();
Return
$ahTopSellers (reference to array of hashes)
with following keys:
  • ProductID - ID of Product (primary key)- int
  • ShopID - ID of shop, which contain product - int
  • LineitemCount - number of times a product is part of an order. canceled orders are not counted - int

GetAllPKeyTopSellers

Returns all TopSeller identifiers.

Syntax
$aTopSellerIDs = GetAllPKeyTopSellers();
Return
$aTopSellerIDs (reference to array of int)
ID of Product

GetInfoTopSeller

Returns the TopSeller by identifier.

Syntax
$hTopSeller = GetInfoTopSeller($ProductID);
Input
$ProductID (int)
ID of Product (primary key)
Return
$hTopSeller (reference to hash)
with following keys:
  • ProductID - ID of Product (primary key)- int
  • ShopID - ID of shop, which contain product - int
  • LineitemCount - number of times a product is part of an order. canceled orders are not counted - int

GetInfoTopSellersByShopID

Returns objects of TopSeller by alternate keys ShopID and LineitemCount.

Syntax
$ahTopSellers = GetInfoTopSellersByShopID($ShopID, $LineitemCount);
Input
$ShopID (int)
ID of shop, which contain product
$LineitemCount (int)
number of times a product is part of an order. canceled orders are not counted (optional)
Return
$ahTopSellers (reference to array of hashes)
with following keys:
  • ProductID - ID of Product (primary key)- int
  • ShopID - ID of shop, which contain product - int
  • LineitemCount - number of times a product is part of an order. canceled orders are not counted - int

GetPKeyTopSellersByShopID

Returns primary keys of TopSeller by alternate keys ShopID and LineitemCount.

Syntax
$aKeys = GetPKeyTopSellersByShopID($ShopID, $LineitemCount);
Input
$ShopID (int)
ID of shop, which contain product
$LineitemCount (int)
number of times a product is part of an order. canceled orders are not counted (optional)
Return
$aKeys (reference to array of int)
ID of Product (primary key)

GetTopSellerLimit

Returns the TopSeller sorted by descending LineitemCount

Syntax
$hTopSeller = GetTopSellerLimit($ShopID, $Limit);
Input
$ShopID (int)
Id from Shop (part of primary key)
$ProductID (int)
Copy of lineitem.sku field, which is product alias (part of primary key)
Return
$hTopSeller (reference to hash)
with following keys:
  • ShopID - Id from Shop (part of primary key)- int
  • ProductID - Copy of lineitem.sku field, which is product alias (part of primary key)- int
  • LineitemCount - Number of lineitems with same SKU in CustomerOrders - int

InsertTopSeller

Creates an entry of TopSeller.

Syntax
InsertTopSeller($hTopSeller);
Input
$hTopSeller (reference to hash)
with following keys:
  • ProductID - ID of Product (primary key)- int
  • ShopID - ID of shop, which contain product - int
  • LineitemCount - number of times a product is part of an order. canceled orders are not counted - int

OnDeleteProduct

Deletes TopSeller of this model when a(n) Product is deleted.

Syntax
OnDeleteProduct($hParams);
Input
$hParams (ref.hash.*)
primary key of object Product, key is
  • ProductID

OnDeleteShop

Deletes TopSeller of this model when a(n) Shop is deleted.

Syntax
OnDeleteShop($hParams);
Input
$hParams (ref.hash.*)
primary key of object Shop, key is
  • ShopID

UpdateTopSeller

Updates a(n) TopSeller if any element was changed.

Syntax
UpdateTopSeller($ProductID, $hTopSeller);
UpdateTopSeller($hTopSeller); # if $hTopSeller includes ProductID
Input
$ProductID (int)
ID of Product (primary key)
$hTopSeller (reference to hash)
with following keys:
  • ShopID - ID of shop, which contain product - int
  • LineitemCount - number of times a product is part of an order. canceled orders are not counted - int