Esempio n. 1
0
 /**
  * Get the Price element object
  * 
  * @param object $item The Item containing the Element
  * 
  * @return object The Price Element
  */
 public function getPriceElement($item)
 {
     // init vars
     $currency = $this->app->zoocart->currency->getDefaultCurrency();
     // check currency setting
     if (!$currency) {
         $this->app->zoocart->informer->enqueue(JText::_('PLG_ZOOCART_INFORMER_SET_DEFAULT_CURRENCY'));
         return null;
     }
     // find the price element associated to current currency
     foreach ($item->getElementsByType('pricepro') as $element) {
         if ($element->getCurrency() && $element->getCurrency()->code == $currency->code) {
             return $element;
         }
     }
     return null;
 }
Esempio n. 2
0
 /**
  * Get the Quantity element object
  * 
  * @param object $item The Item containing the Element
  * 
  * @return object The Quantity Element
  */
 public function getQuantityElement($item)
 {
     // get the first quantity element of the type
     $elements = $item->getElementsByType('quantity');
     return array_shift($elements);
 }
Esempio n. 3
0
 /**
  * Get the ZOOcart Item Type
  *
  * @param   object $item
  *
  * @return string Item, Product, Digital or Subscription
  */
 public function getItemType($item)
 {
     // retrieve zoocart element
     $elements = $item->getElementsByType('addtocart');
     $element = array_shift($elements);
     if ($element) {
         return $element->config->find('specific.item_type', 'product');
     }
     // if no zoocart element set, is zoo standart item
     return 'item';
 }