$wv->shop - Shop management class (ecommerce).

CART actions

  • addItem($cnf) - Add item or increase quantity
    • $cnf = (int/array) Product ID to add, or configuration array with this values:
      • pid = (int) Product ID to add (generates a new CID if not exist)
      • qty = (int) Number of items to add
      • attr = (array) Product attributes
        NOTE: If attr is suppied items will be loaded as different products.
  • delItem($cnf) - Del item or decrease quantity
    • $cnf = (int/array) Product ID to delete, or configuration array with this values:
      • cid = Cart ID to delete
      • qty = Decrease by this quantity of items
      • tqty = Fix the total number of items to this quantity
  • updItemQty($cnf) - Increase or decrease item quantity
    • $cnf = (array) Configuration array with this values:
      • cid = Cart ID to increase quantity
      • qty = Quantity of units to increase
  • delUserCart() - Delete all the items in the cart of actual user
  • readItem($cid) - Return object with cart item info
    • $cid = Cart ID to read
  • readCart() - Return object with all the items in the cart for currect user
  • readCartIDs() - Return array with all the PIDs and IDs in the cart of current user
  • getPID($iid) - Get PID (Product ID) from IID (item_id)
    • $iid = Item ID
  • countCartItems() - Count number of items in cart for current user
  • mergeCart() - Merge user stored items with actual cart

CART Blocks

Manage cart blocks to avoid orders over available stock

  • blkAdd($cid) - Add an item block to current user
    • $cid = (int) Cart ID
  • blkDel($cid) - Delete an item block to current user
    • $cid = (int) Cart ID
  • blkChk($cid) - Check the unix time of a block from a given item for current user
    • $cid = (int) Cart ID
  • blkAddAll() - Add block to all items of curren user
  • blkDelAll($cid,$timeout) - Delete all expired item blocks to all users
    • $cid = (int) Cart ID
    • $timeout = (int) Timeout in seconds (600s by default if empty)
  • blkChkAll($cid,$timeout) - Get the total quantity of stock blocked items
    • $cid = (int) Cart ID
    • $timeout = (int) Timeout in seconds (600s by default if empty)

PRODUCTS

  • imgExt() - Get proper image extension depending on browser support
  • prodImgs($pid) - Get product images
    • $pid = (int) Product ID
  • prodImg($img_id) - Get image info
    • $img_id = (int) Image ID to get info
  • getImgLnk($id_link,$table_name) - Get image link associations
    • $link_id = (int) ID of link in linked table
    • $table_name = (str) name of linked table (i.e. db_shop_products)
  • addImg($cnf) - Add new product image (image must exist)
    • $cnf = (array) Configuration array with this values:
      • pid = (int) Product ID
      • img = (int/str) Name or ID of image
      • table = (str) Name of table to link (i.e. db_shop_products)
  • prodOfCat($cat_id) - Get products of a category
    • $cat_id = (int) Category ID
  • delProd($pid) - Delete product
    • $pid = (int) Product ID to delete
  • getProd($pid,$mlang) - Get product data object by ID
    • $pid = (int) Product ID
    • $mlang = (bool) Multi Language (true to get all languages text, false to get only current language text)
  • getProdTxt($pid,$mlang) - Return object with the description text of a given product
    • $pid = (int) Product ID
    • $mlang = (bool) Multi Language (true to get all languages text, false to get only current language text)
  • getAllProdIDs($sd) - Get a list of all product IDs
    • $sd = (bool) true to also Show Disabled products (false by default)
  • getAllProd($sd) - Get a lis of all products
    • $sd = (bool) true to also Show Disabled products (false by default)
  • getProdLst($lst) - Get a list of products from array list of IDs
    • $lst = (array) list of product IDs to get info from
  • getRNDProdByCatLst($cnf) - Get products by a list of comma separated category IDs, random ordered
    • $cnf = Configuration array with this values:
      • catlst = (array) List of category IDs
      • limit = (int) Number of items to return
  • getCat($cid) - Get category data by ID
    • $cid = (int) Category ID
  • getSubCat($cid) - Get subcategory list from category ID
    • $cid = (int) Category ID
  • getAllCat($filter) - Get a list of categories optionaly filtered by name
    • $filter = (str) Filter txt
  • getProdCats($pid) - Get all product categories
    • $pid = (int) Product ID
  • getUsrCoupons($uid) - Get all user discount coupons
    • $uid = (int) User ID
  • saveProduct($form) - Save products from shop backend edit page
    • $form = (array) Form data to save with this values:
      • pid = (int) Product IDProduct ID
      • stock = (int) Product stock
      • weight = (int) Product weight
      • price = (int) Product price
      • tax_group = (int) Type of tax (tax group)
      • stock_check = (bool) Product stock check
      • free_shipping = (bool) Free shipping
      • packing = (bool) Product included packaging
      • name = (array/int) Product name
      • description = (array/str) Product description
      • category = (array/int) Product categories list
      • attrs = (array/int) Product attributes list
      • filter = (str) Alternative filter type for name and description (For more info view info of core::filterStr method)
  • searchProduct($opt) - Search into product texts and return IDs of products found
    • $opt = (array) Search options:
      • search = (str) Mandatory. Search phrase
      • cat = (int) Filter by category ID
      • or = (bool) true to match ALL words on search phrase