Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_CartItem class

• Introduction

E-shop cart item.

• Class synopsis

AMI_CartItem {
/* Properties */
// Array of cart item discount info
protected array $aDiscount = array();
// Array of cart item price info
protected array $aPriceInfo = array();
// Array of cart item prop info
protected array $aPropInfo = array();
// Array of cart item shipping info
protected array $aShipping = array();
// Array of cart item tax info
protected array $aTax = array();
// Product id
protected int $itemId;
// AmiCatalog table item
// Price number
protected int $priceNum = 0;
// Property id
protected int $propId = 0;
// Quantity of a product
protected float $qty = 1;
/* Methods */
// Constructor.
public __construct ( int $itemId, [ float $qty = 1 ], [ int $priceNum = 0 ], [ int $propId = 0 ] ) returns AMI_CartItem;
// Returns cart item discount info.
public getDiscount ( ) returns array;
// Returns AmiCatalog table item.
public getItem ( ) returns AMI_ModTableItem;
// Returns product id.
public getItemId ( ) returns int;
// Returns cart item price info.
public getPriceInfo ( ) returns array;
// Returns price number.
public getPriceNum ( ) returns int;
// Returns property id.
public getPropId ( ) returns int;
// Returns cart item prop info.
public getPropInfo ( ) returns array;
// Returns quantity of a product.
public getQty ( ) returns float;
// Returns cart item shipping info.
public getShipping ( ) returns array;
// Returns cart item tax info.
public getTax ( ) returns array;
}

• Class Details

Allows to get e-shop cart item info.
  Example:
  •  $AMI_ENV_SETTINGS array('mode' => 'full');
  •  require 'ami_env.php';
  •  
  •  $oEshopCart AMI::getResource('eshop/cart');
  •  
  •  // Get cart total amount
  •  $aTotal $oEshopCart->getTotal();
  •  
  •  // Get array of cart items objects
  •  $aCartItems $oEshopCart->getItems();
  •  
  •  foreach($aCartItems as $oCartItem){
  •      // Get cart item price info
  •      $oCartItem->getPriceInfo();
  •      // Get cart item tax values
  •      $oCartItem->getTax();
  •      // Get cart item discount values
  •      $oCartItem->getDiscount();
  •      // Get cart item shipping values
  •      $oCartItem->getShipping();
  •  }
Tags:
version $Id$
since 6.0.2
resource eshop AMI::getSingleton('eshop/cart_item')

• Class Properies

protected array $aDiscount

Array of cart item discount info

protected array $aPriceInfo

Array of cart item price info

protected array $aPropInfo

Array of cart item prop info

protected array $aShipping

Array of cart item shipping info

protected array $aTax

Array of cart item tax info

protected int $itemId

Product id

protected AMI_ModTableItem $oItem

AmiCatalog table item

protected int $priceNum

Price number

protected int $propId

Property id

protected float $qty

Quantity of a product

• Class Methods

// Constructor.
public __construct ( int $itemId, [ float $qty = 1 ], [ int $priceNum = 0 ], [ int $propId = 0 ] ) returns AMI_CartItem;
  • int $itemId
    Product id
  • float $qty
    Product quantity
  • int $priceNum
    Price number
  • int $propId
    Prop id
// Returns cart item discount info.
public getDiscount ( ) returns array;
// Returns AmiCatalog table item.
public getItem ( ) returns AMI_ModTableItem;
// Returns product id.
public getItemId ( ) returns int;
// Returns cart item price info.
public getPriceInfo ( ) returns array;
// Returns price number.
public getPriceNum ( ) returns int;
// Returns property id.
public getPropId ( ) returns int;
// Returns cart item prop info.
public getPropInfo ( ) returns array;
// Returns quantity of a product.
public getQty ( ) returns float;
// Returns cart item shipping info.
public getShipping ( ) returns array;
// Returns cart item tax info.
public getTax ( ) returns array;