/** * Joomla Event onAfterInitialise */ public function onAfterInitialise() { // JBZoo SEF fix $sefEnabled = $this->_config->get('enabled', 0, 'config.sef'); if ($sefEnabled && $this->app->jbenv->isSite()) { // get helper links $dispatcher = $this->app->event->dispatcher; $jbsef = $this->app->jbsef; // init JBZoo SEF $dispatcher->connect('application:sefparseroute', array($jbsef, 'sefParseRoute')); $dispatcher->connect('application:sefbuildroute', array($jbsef, 'sefBuildRoute')); } $this->app->event->register('JBEventSubmission'); $this->app->event->dispatcher->connect('submission:redirect', array('JBEventSubmission', 'redirect')); // code for Zoo submision controller // $this->app->event->dispatcher->notify($this->app->event->create($this->submission, 'submission:redirect', array('item' => $this->item, 'new' => !$edit, 'msg' => &$msg))); }
/** * @param $params * @return mixed */ protected function _buildFeedUrl($params) { if (isset($params['segments'][0]) && $params['segments'][0] == 'feed') { if ($this->_config->get('fix_feed', 0)) { unset($params['segments'][0]); } if (isset($params['query']['format']) && $params['query']['format'] == 'feed') { // TODO remove bug with "Class 'JFeedItem' not found" // unset($params['query']['format']); } } return $params; }
/** * @param string $layout * @return JSONData */ public function getLayoutParams($layout = 'default') { return $this->_jbconfig->get(JBCart::DEFAULT_POSITION, array(), 'cart.' . JBCart::CONFIG_SHIPPINGFIELDS); }
/** * Filter action */ function index() { $this->formRenderer = $this->app->jbrenderer->create('Order'); $this->shippingRenderer = $this->app->jbrenderer->create('Shipping'); $this->paymentRenderer = $this->app->jbrenderer->create('Payment'); $this->validatorRenderer = $this->app->jbrenderer->create('Validator'); $this->shippingFieldRenderer = $this->app->jbrenderer->create('ShippingFields'); $this->modifierOrderPriceRenderer = $this->app->jbrenderer->create('ModifierOrderPrice'); $this->shipping = $this->app->jbshipping->getEnabled(); $this->shippingFields = $this->app->jbshipping->getFields(); $this->payment = $this->app->jbpayment->getEnabled(); $this->modifierPrice = $this->app->jbmodifierprice->getEnabled(); $this->config = $this->_config; $this->Itemid = $this->_jbrequest->get('Itemid'); $this->order = $this->cart->newOrder(); $this->items = $this->order->getItems(true); $this->itemsHtml = $this->order->renderItems(array('image_width' => $this->_config->get('tmpl_image_width', 75), 'image_height' => $this->_config->get('tmpl_image_height', 75), 'image_link' => $this->_config->get('tmpl_image_link', 1), 'item_link' => $this->_config->get('tmpl_item_link', 1), 'edit' => true)); $jbnotify = $this->app->jbnotify; $errors = 0; $orderSaved = false; $isPaymentBtn = $this->app->jbrequest->get('create-pay'); if ($this->_jbrequest->isPost()) { $formData = $this->_getRequest(); try { $errors += $this->order->bind($formData); $errorMessages = $this->order->isValid(); $errors += count($errorMessages); if ($errors) { $this->app->system->application->setUserState('JBZOO_ORDDER_SUBMISSION_FORM', serialize($formData)); // show custom error messages $jbnotify->warning('JBZOO_CART_ORDER_SOME_ERROR'); $jbnotify->warning($errorMessages); } else { // saving order JBModelOrder::model()->save($this->order); $orderSaved = true; // empty cart items $this->cart->removeItems(); // go to payment page $payment = $this->order->getPayment(); $totalSum = $this->order->getTotalSum(); if ($totalSum->isPositive() && $isPaymentBtn && $payment && ($paymentUrl = $payment->getRedirectUrl())) { $message = $payment->getSuccessMessage(); if (empty($message)) { $message = 'JBZOO_CART_PAYMENT_REDIRECT'; } $this->setRedirect($paymentUrl, JText::_($message)); } else { $jbnotify->notice('JBZOO_CART_ORDER_SUCCESS_CREATED'); } } } catch (JBCartOrderException $e) { $jbnotify->warning(JText::_($e->getMessage())); } catch (AppException $e) { $jbnotify->warning(JText::_($e->getMessage())); } } $this->isError = $errors; $templatedName = 'basket'; if ($orderSaved) { $templatedName = 'basket-success'; } $this->getView($templatedName)->addTemplatePath($this->template->getPath())->setLayout($templatedName)->display(); }
/** * @return JSONData */ public function getLayoutParams() { return $this->_jbconfig->get(JBCart::DEFAULT_POSITION, array(), 'cart.' . JBCart::ELEMENT_TYPE_MODIFIER_ORDER_PRICE); }