/** * 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; }
/** * 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); }
/** * 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'; }