/** * User compare function for element grouping * @param JBCartElement $element1 * @param JBCartElement $element2 * @return int */ protected function _sortGroup($element1, $element2) { $core1 = $element1->isCore(); $core2 = $element2->isCore(); $name1 = $element1->getMetaData('name'); $name2 = $element2->getMetaData('name'); if ($core1 == $core2) { return strcasecmp($name1, $name2); } return $core1 && !$core2 ? -1 : 1; }
/** * @param array $data * @return $this */ public function bindData($data = array()) { if (!$this->getOrder()->id) { JBCart::getInstance()->setModifier($this->identifier, $data); } return parent::bindData($data); }
/** * Validates the submitted element * @param $value * @param $params * @return array */ public function validateSubmission($value, $params) { $isShippingField = true; // if shipping doesn't exist = true! if ($shipping = $this->getOrder()->getShipping()) { $isShippingField = $shipping->hasShippingField($this->identifier); } if ($isShippingField) { return parent::validateSubmission($value, $params); } return array(); }
/** * @param App $app * @param string $type * @param string $group */ public function __construct($app, $type, $group) { parent::__construct($app, $type, $group); $this->_jbmoney = $this->app->jbmoney; }
/** * Important libs * @return $this */ public function loadAssets() { $this->app->jbassets->js('jbassets:js/cart/shipping.js'); $this->app->jbassets->js('jbassets:js/cart/shipping-type.js'); return parent::loadAssets(); }
/** * Class constructor * @param App $app * @param string $type * @param string $group */ public function __construct($app, $type, $group) { parent::__construct($app, $type, $group); $this->_macros = $this->app->jbordermacros; }
/** * @param string $html * @param array $args * @return string * @throws ElementJBPriceException */ private function _systemWrapper($html, array $args = array()) { $system = parent::getLayout('_system.php'); if (!$system) { throw new ElementJBPriceException('System wrapper file doesn\'t exists'); } return parent::renderLayout($system, array('html' => $html, 'args' => $args)); }
/** * @return JSONData|void */ public function getOrderData() { $data = parent::getOrderData(); $data->set('status', $this->getStatus()); return $data; }
/** * Load elements css/js config assets * @return $this */ public function loadConfigAssets() { parent::loadConfigAssets(); // load zoo frontend language file $this->app->system->language->load('com_zoo'); $this->app->html->_('behavior.modal', 'a.modal'); $this->app->jbassets->css('fields:zooapplication.css'); $this->app->jbassets->js('fields:zooapplication.js'); }