示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * @param array $data
  * @return $this
  */
 public function bindData($data = array())
 {
     if (!$this->getOrder()->id) {
         JBCart::getInstance()->setModifier($this->identifier, $data);
     }
     return parent::bindData($data);
 }
示例#3
0
 /**
  * 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();
 }
示例#4
0
 /**
  * @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;
 }
示例#5
0
 /**
  * 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();
 }
示例#6
0
 /**
  * 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;
 }
示例#7
0
 /**
  * @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));
 }
示例#8
0
 /**
  * @return JSONData|void
  */
 public function getOrderData()
 {
     $data = parent::getOrderData();
     $data->set('status', $this->getStatus());
     return $data;
 }
示例#9
0
 /**
  * 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');
 }