VirtueMart  3.2.14.9808
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
VirtueMartModelProduct Class Reference
Inheritance diagram for VirtueMartModelProduct:
Inheritance graph
[legend]
Collaboration diagram for VirtueMartModelProduct:
Collaboration graph
[legend]

Public Member Functions

 __construct ()
 
 initialiseRequests ()
 
 updateRequests ()
 
 getLastProductOrdering ($default=0)
 
 setLastProductOrdering ($ordering)
 
 setKeyWord ($keyword)
 
 sortSearchListQuery ($onlyPublished=TRUE, $virtuemart_category_id=FALSE, $group=FALSE, $nbrReturnProducts=FALSE, $langFields=array())
 
 getProductStockhandle ()
 
 setPaginationLimits ()
 
 getProduct ($virtuemart_product_id=NULL, $front=TRUE, $withCalc=TRUE, $onlyPublished=TRUE, $quantity=1, $virtuemart_shoppergroup_ids=0)
 
 loadProductPrices ($productId, $virtuemart_shoppergroup_ids, $front)
 
 getRawProductPrices (&$product, $quantity, $virtuemart_shoppergroup_ids, $front, $withParent=0)
 
 getProductSingle ($virtuemart_product_id=NULL, $front=TRUE, $quantity=1, $withParent=false, $virtuemart_shoppergroup_ids=0, $prices=true)
 
 fillVoidPrice ()
 
 getProductCategories ($virtuemart_product_id)
 
 getProductsInCategory ($categoryId)
 
 getProductListing ($group=FALSE, $nbrReturnProducts=FALSE, $withCalc=TRUE, $onlyPublished=TRUE, $single=FALSE, $filterCategory=TRUE, $category_id=0, $filterManufacturer=TRUE, $manufacturer_id=0)
 
 getProductsListing ($group=FALSE, $nbrReturnProducts=FALSE, $withCalc=TRUE, $onlyPublished=TRUE, $single=FALSE, $filterCategory=TRUE, $category_id=0, $filterManufacturer=TRUE, $manufacturer_id=0, $omit=0)
 
 setFilter ()
 
 getProducts ($productIds, $front=TRUE, $withCalc=TRUE, $onlyPublished=TRUE, $single=FALSE)
 
 getNeighborProducts ($product, $onlyPublished=TRUE, $max=1)
 
 saveorder ($cid=array(), $order, $filter=NULL)
 
 move ($direction, $filter=NULL)
 
 store (&$product)
 
 updateXrefAndChildTables ($data, $tableName, $preload=FALSE)
 
 createChild ($id)
 
 createClone ($id)
 
 remove ($ids)
 
 getPrice ($product, $quantity, $ctype=-1)
 
 getOrderByList ($virtuemart_category_id=FALSE)
 
 getStockIndicator ($product)
 
 updateStockInDB ($product, $amount, $signInStock, $signOrderedStock)
 
 lowStockWarningEmail ($virtuemart_product_id)
 
 getUncategorizedChildren ($withParent)
 
 checkChildProducts ($product_ids)
 
 getProductChilds ($product_id)
 
 getProductChildIds ($product_id)
 
 getAllProductChildIds ($product_ids, &$childIds)
 
 sentProductEmailToShoppers ()
 
 getProductShoppersByStatus ($product_id, $states, $filter_order= 'ou.email', $filter_order_Dir= 'ASC')
 
- Public Member Functions inherited from VmModel
 __construct ($cidName='cid', $config=array())
 
 setDebugSql ($b)
 
 getName ()
 
 setState ($property, $value=null)
 
 getState ($property=null, $default=null)
 
 getTable ($name= '', $prefix= 'Table', $options=array())
 
 setIdName ($idName)
 
 getIdName ()
 
 getId ()
 
 setId ($id)
 
 setMainTable ($maintablename, $maintable=0)
 
 getDefaultOrdering ()
 
 addvalidOrderingFieldName ($add)
 
 removevalidOrderingFieldName ($name)
 
 setDefaultValidOrderingFields ($defaultTable=null)
 
 _getOrdering ($preTable='')
 
 checkFilterOrder ($toCheck, $view=0, $task= '')
 
 checkValidOrderingFieldName ($toCheck)
 
 checkFilterDir ($toCheck, $view=0, $task= '')
 
 getPagination ($perRow=5)
 
 setPaginationLimits ()
 
 getTotal ()
 
 setGetCount ($withCount)
 
 exeSortSearchListQuery ($object, $select, $joinedTables, $whereString= '', $groupBy= '', $orderBy= '', $filter_order_Dir= '', $nbrReturnProducts=false)
 
 emptyCache ()
 
 getData ($id=0)
 
 store (&$data)
 
 remove ($ids)
 
 setToggleName ($togglesName)
 
 toggle ($field, $val=NULL, $cidname=0, $tablename=0, $view=false)
 
 move ($direction, $filter=null)
 
 saveorder ($cid=array(), $order, $filter=null)
 
 addImages ($obj, $limit=0)
 
 resetErrors ()
 
- Public Member Functions inherited from vObject
 __toString ()
 
 get ($prop, $def=null)
 
 set ($prop, $value=null)
 
 setProperties ($props)
 

Static Public Member Functions

static getValidProductFilterArray ()
 
static checkIfCached ($virtuemart_product_id, $front=NULL, $withCalc=TRUE, $onlyPublished=TRUE, $quantity=1, $virtuemart_shoppergroup_ids=0, $withRating=0)
 
static checkIfCachedSingle ($virtuemart_product_id, $front=NULL, $quantity=1, $withParent=false, $virtuemart_shoppergroup_ids=0, $prices=true)
 
static getProductCategoryIds ($id)
 
static getProductParentId ($product_id)
 
static addProductToRecent ($productId)
 
static getRecentProductIds ($nbr=3)
 
- Static Public Member Functions inherited from VmModel
static addTablePath ($path)
 
static addIncludePath ($path= '', $prefix= '')
 
static getInstance ($type, $prefix= '', $config=array())
 
static getModel ($name=false)
 
static joinLangTables ($tablename, $prefix, $on, $method=0)
 
static joinLangSelectFields ($langFields, $as=true)
 
static joinLangLikeFields ($langFields, $keyword)
 
static joinLangLikeField ($searchField, $keyword)
 

Public Attributes

 $products = NULL
 
 $_onlyQuery = false
 
 $keyword = "0"
 
 $product_parent_id = FALSE
 
 $virtuemart_manufacturer_id = FALSE
 
 $virtuemart_category_id = 0
 
 $search_type = ''
 
 $searchcustoms = FALSE
 
 $searchplugin = 0
 
 $filter_order = 'p.virtuemart_product_id'
 
 $filter_order_Dir = 'DESC'
 
 $valid_BE_search_fields = array('product_name', 'product_sku','`l`.`slug`', 'product_s_desc', '`l`.`metadesc`')
 
 $withRating = false
 
- Public Attributes inherited from VmModel
 $_id = 0
 
 $_data = null
 
 $_query = null
 
 $_total = null
 
 $_pagination = 0
 
 $_limit = 0
 
 $_limitStart = 0
 
 $_maintable = ''
 
 $_maintablename = ''
 
 $_idName = ''
 
 $_cidName = 'cid'
 
 $_togglesName = null
 
 $_selectedOrderingDir = 'DESC'
 
 $_noLimit = false
 
 $_tablePreFix = ''
 
 $_validOrderingFieldName = array()
 
 $_validFilterDir = array('ASC','DESC')
 

Static Public Attributes

static $decimals = array('product_length','product_width','product_height','product_weight','product_packaging')
 
static $_products = array()
 
static $_cacheOpt = array()
 
static $_cacheOptSingle = array()
 
static $_alreadyLoadedIds = array()
 
static $omitLoaded = false
 
static $_productsSingle = array()
 

Protected Member Functions

 populateState ()
 
- Protected Member Functions inherited from VmModel
 populateState ()
 
 _createTable ($name, $prefix= 'Table', $config=array())
 
 _getList ($query, $limitstart=0, $limit=0)
 
 _getListCount ($query)
 

Private Member Functions

 fillVoidProduct ($front=TRUE)
 
 productPricesClone ($virtuemart_product_id)
 
 productCustomsfieldsClone ($virtuemart_product_id)
 

Private Attributes

 $_autoOrder = 0
 
 $orderByString = 0
 
 $listing = FALSE
 

Additional Inherited Members

- Static Protected Member Functions inherited from VmModel
static _createFileName ($type, $parts=array())
 
- Protected Attributes inherited from VmModel
 $__state_set = null
 
 $name
 
 $option = null
 
 $state
 
 $event_clean_cache = null
 
 $_maxItems = 1000
 

Constructor & Destructor Documentation

VirtueMartModelProduct::__construct ( )

constructs a VmModel setMainTable defines the maintable of the model

Author
Max Milbers

Member Function Documentation

static VirtueMartModelProduct::addProductToRecent (   $productId)
static
Author
Max Milbers
VirtueMartModelProduct::checkChildProducts (   $product_ids)

Check if the product has any children

Author
RolandD
Max Milbers
Parameters
int$virtuemart_product_idProduct ID
Returns
bool True if there are child products, false if there are no child products
static VirtueMartModelProduct::checkIfCached (   $virtuemart_product_id,
  $front = NULL,
  $withCalc = TRUE,
  $onlyPublished = TRUE,
  $quantity = 1,
  $virtuemart_shoppergroup_ids = 0,
  $withRating = 0 
)
static
static VirtueMartModelProduct::checkIfCachedSingle (   $virtuemart_product_id,
  $front = NULL,
  $quantity = 1,
  $withParent = false,
  $virtuemart_shoppergroup_ids = 0,
  $prices = true 
)
static
VirtueMartModelProduct::createChild (   $id)

This function creates a child for a given product id

Author
Max Milbers
Patrick Kohl
Parameters
intid of parent id
VirtueMartModelProduct::createClone (   $id)

Creates a clone of a given product id

Author
Max Milbers
Parameters
int$virtuemart_product_id
VirtueMartModelProduct::fillVoidPrice ( )
VirtueMartModelProduct::fillVoidProduct (   $front = TRUE)
private

This fills the empty properties of a product todo add if(!empty statements

Author
Max Milbers
Parameters
unknown_type$product
unknown_type$front
VirtueMartModelProduct::getAllProductChildIds (   $product_ids,
$childIds 
)
VirtueMartModelProduct::getLastProductOrdering (   $default = 0)
Author
Max Milbers
VirtueMartModelProduct::getNeighborProducts (   $product,
  $onlyPublished = TRUE,
  $max = 1 
)

This function retrieves the "neighbor" products of a product specified by $virtuemart_product_id Neighbors are the previous and next product in the current list

Author
Max Milbers
Parameters
object$productThe product to find the neighours of
Returns
array
VirtueMartModelProduct::getOrderByList (   $virtuemart_category_id = FALSE)

Get the Order By Select List

notice by Max Milbers html tags should never be in a model. This function should be moved to a helper or simular,...

Author
Kohl Patrick, Max Milbers public
Parameters
$fiedsfrom config Back-end
Returns
$orderByList Order,order By, manufacturer and category link List to echo Out
VirtueMartModelProduct::getPrice (   $product,
  $quantity,
  $ctype = -1 
)

Gets the price for a variant

Author
Max Milbers
VirtueMartModelProduct::getProduct (   $virtuemart_product_id = NULL,
  $front = TRUE,
  $withCalc = TRUE,
  $onlyPublished = TRUE,
  $quantity = 1,
  $virtuemart_shoppergroup_ids = 0 
)

This function creates a product with the attributes of the parent.

Parameters
int$virtuemart_product_id
boolean$frontfor frontend use
boolean$withCalccalculate prices?
booleanpublished
intquantity
booleanload customfields
VirtueMartModelProduct::getProductCategories (   $virtuemart_product_id)

Load the product category

Author
Max Milbers
Returns
array list of categories product is in
static VirtueMartModelProduct::getProductCategoryIds (   $id)
static
VirtueMartModelProduct::getProductChildIds (   $product_id)
VirtueMartModelProduct::getProductChilds (   $product_id)
VirtueMartModelProduct::getProductListing (   $group = FALSE,
  $nbrReturnProducts = FALSE,
  $withCalc = TRUE,
  $onlyPublished = TRUE,
  $single = FALSE,
  $filterCategory = TRUE,
  $category_id = 0,
  $filterManufacturer = TRUE,
  $manufacturer_id = 0 
)

Loads different kind of product lists. you can load them with calculation or only published onces, very intersting is the loading of groups valid values are latest, topten, featured, recent.

The function checks itself by the config if the user is allowed to see the price or published products

Author
Max Milbers
static VirtueMartModelProduct::getProductParentId (   $product_id)
static
VirtueMartModelProduct::getProducts (   $productIds,
  $front = TRUE,
  $withCalc = TRUE,
  $onlyPublished = TRUE,
  $single = FALSE 
)

Returns products for given array of ids

Author
Max Milbers
Parameters
int$productIds
boolean$front
boolean$withCalc
boolean$onlyPublished
VirtueMartModelProduct::getProductShoppersByStatus (   $product_id,
  $states,
  $filter_order = 'ou.email',
  $filter_order_Dir = 'ASC' 
)
VirtueMartModelProduct::getProductsInCategory (   $categoryId)

Get the products in a given category

public

Parameters
int$virtuemart_category_idthe category ID where to get the products for
Returns
array containing product objects
Deprecated:
VirtueMartModelProduct::getProductSingle (   $virtuemart_product_id = NULL,
  $front = TRUE,
  $quantity = 1,
  $withParent = false,
  $virtuemart_shoppergroup_ids = 0,
  $prices = true 
)
VirtueMartModelProduct::getProductsListing (   $group = FALSE,
  $nbrReturnProducts = FALSE,
  $withCalc = TRUE,
  $onlyPublished = TRUE,
  $single = FALSE,
  $filterCategory = TRUE,
  $category_id = 0,
  $filterManufacturer = TRUE,
  $manufacturer_id = 0,
  $omit = 0 
)
VirtueMartModelProduct::getProductStockhandle ( )
VirtueMartModelProduct::getRawProductPrices ( $product,
  $quantity,
  $virtuemart_shoppergroup_ids,
  $front,
  $withParent = 0 
)
static VirtueMartModelProduct::getRecentProductIds (   $nbr = 3)
static

Gives ids the recently by the shopper visited products

Author
Max Milbers
VirtueMartModelProduct::getStockIndicator (   $product)

Get the stock level for a given product

Author
RolandD public
Parameters
object$productthe product to get stocklevel for
Returns
array containing product objects
VirtueMartModelProduct::getUncategorizedChildren (   $withParent)
static VirtueMartModelProduct::getValidProductFilterArray ( )
static
VirtueMartModelProduct::initialiseRequests ( )

This function resets the variables holding request depended data to the initial values

Author
Max Milbers
VirtueMartModelProduct::loadProductPrices (   $productId,
  $virtuemart_shoppergroup_ids,
  $front 
)
VirtueMartModelProduct::lowStockWarningEmail (   $virtuemart_product_id)
VirtueMartModelProduct::move (   $direction,
  $filter = NULL 
)

Moves the order of a record

Parameters
integerThe increment to reorder by
VirtueMartModelProduct::populateState ( )
protected

This functions updates the variables of the model which are used in the sortSearchListQuery with the variables from the Request

Author
Max Milbers
VirtueMartModelProduct::productCustomsfieldsClone (   $virtuemart_product_id)
private
VirtueMartModelProduct::productPricesClone (   $virtuemart_product_id)
private
VirtueMartModelProduct::remove (   $ids)

removes a product and related table entries

Author
Max Milberes
VirtueMartModelProduct::saveorder (   $cid = array(),
  $order,
  $filter = NULL 
)
VirtueMartModelProduct::sentProductEmailToShoppers ( )
VirtueMartModelProduct::setFilter ( )

overriden getFilter to persist filters

Author
OSP
VirtueMartModelProduct::setKeyWord (   $keyword)

Sets the keyword variable for the search

Parameters
string$keyword
VirtueMartModelProduct::setLastProductOrdering (   $ordering)
Author
Max Milbers
VirtueMartModelProduct::setPaginationLimits ( )
VirtueMartModelProduct::sortSearchListQuery (   $onlyPublished = TRUE,
  $virtuemart_category_id = FALSE,
  $group = FALSE,
  $nbrReturnProducts = FALSE,
  $langFields = array() 
)

New function for sorting, searching, filtering and pagination for product ids.

Author
Max Milbers
VirtueMartModelProduct::store ( $product)

Store a product

Author
Max Milbers
Parameters
$productreference
bool$isChildMeans not that the product is child or not. It means if the product should be threated as child
Returns
bool
VirtueMartModelProduct::updateRequests ( )
VirtueMartModelProduct::updateStockInDB (   $product,
  $amount,
  $signInStock,
  $signOrderedStock 
)
VirtueMartModelProduct::updateXrefAndChildTables (   $data,
  $tableName,
  $preload = FALSE 
)

Member Data Documentation

VirtueMartModelProduct::$_alreadyLoadedIds = array()
static
VirtueMartModelProduct::$_autoOrder = 0
private
VirtueMartModelProduct::$_cacheOpt = array()
static
VirtueMartModelProduct::$_cacheOptSingle = array()
static
VirtueMartModelProduct::$_onlyQuery = false
VirtueMartModelProduct::$_products = array()
static
VirtueMartModelProduct::$_productsSingle = array()
static
VirtueMartModelProduct::$decimals = array('product_length','product_width','product_height','product_weight','product_packaging')
static
VirtueMartModelProduct::$filter_order = 'p.virtuemart_product_id'
VirtueMartModelProduct::$filter_order_Dir = 'DESC'
VirtueMartModelProduct::$keyword = "0"
VirtueMartModelProduct::$listing = FALSE
private
VirtueMartModelProduct::$omitLoaded = false
static
VirtueMartModelProduct::$orderByString = 0
private
VirtueMartModelProduct::$product_parent_id = FALSE
VirtueMartModelProduct::$products = NULL
VirtueMartModelProduct::$search_type = ''
VirtueMartModelProduct::$searchcustoms = FALSE
VirtueMartModelProduct::$searchplugin = 0
VirtueMartModelProduct::$valid_BE_search_fields = array('product_name', 'product_sku','`l`.`slug`', 'product_s_desc', '`l`.`metadesc`')
VirtueMartModelProduct::$virtuemart_category_id = 0
VirtueMartModelProduct::$virtuemart_manufacturer_id = FALSE
VirtueMartModelProduct::$withRating = false

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