/** * Migrate cart config */ public function basic() { $config = $this->_migrate->getBasic(); $cartConfig = $this->_confModel->getGroup('cart.config'); if ($config->get('auth', 0)) { $cartConfig->set('access', 2); } else { $cartConfig->set('access', 1); } $cartConfig->set('default_currency', $config->get('currency', 'eur')); $cartConfig->set('enable', $config->get('enable', 1)); $cartConfig->set('freeorder', $config->get('nopaid-order', 0)); $this->_confModel->setGroup('cart.config', $cartConfig->getArrayCopy()); }
/** * Constructor * @param Element|String $element * @param Item $item * @param array $options */ function __construct($element, Item $item = null, $options = array()) { // get Zoo app $this->app = App::getInstance('zoo'); // set inner vars if (isset($options['elementId'])) { $this->_identifier = $options['elementId']; $this->_item = $item; $this->_element = $this->_item->getElement($this->_identifier); } else { if (is_object($element)) { $this->_element = $element; $this->_item = $element->getItem(); $this->_identifier = $element->identifier; } else { $this->_identifier = $element; } } // set repeatable flag if (is_object($this->_element) && is_subclass_of($this->_element, 'ElementRepeatable')) { $this->_isRepeatable = true; } // set Item object if (!$this->_item && $item) { $this->_item = $item; } // get current value for export) if ($this->_item && $this->_identifier && isset($this->_item->elements[$this->_identifier])) { $this->_value = $this->_item->elements[$this->_identifier]; } $this->_config = JBModelConfig::model(); $this->_exportParams = $this->_config->getGroup('export.items', array()); $this->_importParams = $this->_config->getGroup('import.items', array()); $this->_lastImportParams = $this->_config->getGroup('import.last.items', array()); }
/** * Joomla Event onAfterInitialise */ public function onBeforeCompileHead() { // fix Zoo SEF problems $sefConfig = $this->_config->getGroup('config.sef'); $isSite = $this->app->jbenv->isSite(); if ($sefConfig->get('enabled') && $sefConfig->get('fix_canonical') && $isSite) { $this->app->jbsef->canonicalFix(); } // load all assets $this->app->jbassets->loadAll(); }
/** * @param string $layout * @return JSONData */ public function getLayoutParams($layout = 'default') { $positions = $this->_jbconfig->getGroup('cart.' . JBCart::CONFIG_FIELDS_TMPL . '.' . $layout); $elementsConfig = array(); foreach ($positions as $position) { foreach ($position as $element) { $elementsConfig[$element['identifier']] = $element; } } return $elementsConfig; }
/** * Create CSV file from $data * @param $data * @param $filename * @return string * @throws AppException */ protected function _createFile($data, $filename) { $file = $this->app->jbpath->sysPath('tmp', "/jbzoo-export/{$filename}.csv"); $config = $this->_config->getGroup('export'); $dirName = dirname($file); if (!JFolder::exists($dirName)) { JFolder::create($dirName); } if (!JFile::exists($file)) { $data = $this->_addHeader($data); } if (($handle = fopen($file, "a")) !== false) { foreach ($data as $row) { fputcsv($handle, $this->app->data->create($row)->flattenRecursive(), $config->get('separator', ','), $config->get('enclosure', '"')); } fclose($handle); } else { throw new AppException(sprintf('Unable to write to file %s.', $file)); } return $file; }
/** * @param $position * @return mixed */ public function _getConfigPosition($position) { $config = $this->_jbconfig->getGroup('cart.' . JBCart::CONFIG_PRICE_TMPL_FILTER); $position = $config->get($this->_jbprice->identifier . '.' . $this->_layout . '.' . $position); return isset($position) ? $position : array(); }