/** * Get the data */ private function getData() { // get cookie $this->orderId = Cookie::get('order_id'); // check if cookies are available $this->cookiesEnabled = Cookie::hasAllowedCookies(); // check if cookies exists if ($this->orderId || $this->cookiesEnabled == true) { // get the products $this->products = FrontendCatalogModel::getProductsByOrder($this->orderId); // count amount of products in shopping cart $this->amountOfProducts = count($this->products); // total price $this->totalPrice = '0'; // calculate total amount foreach ($this->products as &$product) { // calculate total $subtotal = (int) $product['subtotal_price']; $this->totalPrice = (int) $this->totalPrice; $this->totalPrice = $this->totalPrice + $subtotal; } $this->totalPriceArr['total'] = $this->totalPrice; // insert total price in db FrontendCatalogModel::updateOrder($this->totalPriceArr, $this->orderId); } }
/** * Get the data */ private function getData() { // check if cookie exists if (!Cookie::exists('order_id')) { return; } }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // requested page $requestedPage = $this->URL->getParameter('page', 'int', 1); $this->firstName = Cookie::get('fname'); $this->catalogUrl = FrontendNavigation::getURLForBlock('Catalog'); }
/** * Execute the order save */ public function execute() { parent::execute(); // get order values $this->orderValues['product_id'] = \SpoonFilter::getPostValue('productId', null, ''); $this->orderValues['amount'] = \SpoonFilter::getPostValue('productAmount', null, ''); $action = \SpoonFilter::getPostValue('action', null, ''); // get cookie $cookieOrderId = Cookie::get('order_id'); // check if cookies are enabled $cookiesEnabled = Cookie::set('enabled', 'true'); $cookieExists = Cookie::exists('enabled'); // check if cookies are set, when true update the order if (isset($cookieOrderId) && FrontendCatalogModel::existsOrder($cookieOrderId) == true) { $this->orderValues['order_id'] = $cookieOrderId; // action add or update if ($action == 'add-update') { if (FrontendCatalogModel::existsOrderValue($this->orderValues['product_id'], $this->orderValues['order_id']) == true) { // update the order values FrontendCatalogModel::updateOrderValue($this->orderValues, $this->orderValues['order_id'], $this->orderValues['product_id']); $this->output(self::OK, null, 'Order values updated.'); } else { // insert order values FrontendCatalogModel::insertOrderValue($this->orderValues); $this->output(self::OK, null, 'Order values inserted.'); } } elseif ($action == 'delete') { if (FrontendCatalogModel::existsOrderValue($this->orderValues['product_id'], $this->orderValues['order_id']) == true) { // delete the order values FrontendCatalogModel::deleteOrderValue($this->orderValues['order_id'], $this->orderValues['product_id']); $this->output(self::OK, null, 'Order values deleted.'); } } } else { // when no cookies are set, create new cookie and insert order $orderId = FrontendCatalogModel::insertOrder(); if ($orderId != '') { // set order id $this->orderValues['order_id'] = $orderId; // set cookie Cookie::set('order_id', $orderId); // insert order values FrontendCatalogModel::insertOrderValue($this->orderValues); $this->output(self::OK, null, 'Order imported.'); } } }
/** * Load the data, don't forget to validate the incoming data */ private function getData() { // get cookie $this->orderId = Cookie::get('order_id'); if ($this->orderId) { // get the products $this->products = FrontendCatalogModel::getProductsByOrder($this->orderId); // total price $this->totalPrice = '0'; // calculate total amount foreach ($this->products as &$product) { // calculate total $subtotal = (int) $product['subtotal_price']; $this->totalPrice = (int) $this->totalPrice; $this->totalPrice = $this->totalPrice + $subtotal; } } }
/** * Get the data */ private function getData() { // get cookie $this->orderId = Cookie::get('order_id'); if ($this->orderId) { // get the products $this->products = FrontendCatalogModel::getProductsByOrder($this->orderId); // count amount of products in shopping cart $this->amountOfProducts = count($this->products); // total price $this->totalPrice = '0'; // calculate total amount foreach ($this->products as &$product) { // calculate total $subtotal = (int) $product['subtotal_price']; $this->totalPrice = (int) $this->totalPrice; $this->totalPrice = $this->totalPrice + $subtotal; } // url for next step $this->personalDataUrl = FrontendNavigation::getURLForBlock('Catalog', 'PersonalData'); // url for next step $this->catalogUrl = FrontendNavigation::getURLForBlock('Catalog'); } }
/** * Process the query string */ private function processQueryString() { // store the query string local, so we don't alter it. $queryString = trim($this->request->getPathInfo(), '/'); // split into chunks $chunks = (array) explode('/', $queryString); $hasMultiLanguages = $this->getContainer()->getParameter('site.multilanguage'); // single language if (!$hasMultiLanguages) { // set language id $language = $this->get('fork.settings')->get('Core', 'default_language', SITE_DEFAULT_LANGUAGE); } else { // multiple languages // default value $mustRedirect = false; // get possible languages $possibleLanguages = (array) Language::getActiveLanguages(); $redirectLanguages = (array) Language::getRedirectLanguages(); // the language is present in the URL if (isset($chunks[0]) && in_array($chunks[0], $possibleLanguages)) { // define language $language = (string) $chunks[0]; // try to set a cookie with the language try { // set cookie CommonCookie::set('frontend_language', $language); } catch (\SpoonCookieException $e) { // settings cookies isn't allowed, because this isn't a real problem we ignore the exception } // set sessions \SpoonSession::set('frontend_language', $language); // remove the language part array_shift($chunks); } elseif (CommonCookie::exists('frontend_language') && in_array(CommonCookie::get('frontend_language'), $redirectLanguages)) { // set languageId $language = (string) CommonCookie::get('frontend_language'); // redirect is needed $mustRedirect = true; } else { // default browser language // set languageId & abbreviation $language = Language::getBrowserLanguage(); // try to set a cookie with the language try { // set cookie CommonCookie::set('frontend_language', $language); } catch (\SpoonCookieException $e) { // settings cookies isn't allowed, because this isn't a real problem we ignore the exception } // redirect is needed $mustRedirect = true; } // redirect is required if ($mustRedirect) { // build URL // trim the first / from the query string to prevent double slashes $url = rtrim('/' . $language . '/' . trim($this->getQueryString(), '/'), '/'); // when we are just adding the language to the domain, it's a temporary redirect because // Safari keeps the 301 in cache, so the cookie to switch language doesn't work any more $redirectCode = $url == '/' . $language ? 302 : 301; // set header & redirect throw new RedirectException('Redirect', new RedirectResponse($url, $redirectCode)); } } // define the language defined('FRONTEND_LANGUAGE') || define('FRONTEND_LANGUAGE', $language); defined('LANGUAGE') || define('LANGUAGE', $language); // sets the locale file Language::setLocale($language); // list of pageIds & their full URL $keys = Navigation::getKeys(); // rebuild our URL, but without the language parameter. (it's tripped earlier) $url = implode('/', $chunks); $startURL = $url; // loop until we find the URL in the list of pages while (!in_array($url, $keys)) { // remove the last chunk array_pop($chunks); // redefine the URL $url = implode('/', $chunks); } // remove language from query string if ($hasMultiLanguages) { $queryString = trim(mb_substr($queryString, mb_strlen($language)), '/'); } // if it's the homepage AND parameters were given (not allowed!) if ($url == '' && $queryString != '') { // get 404 URL $url = Navigation::getURL(404); // remove language if ($hasMultiLanguages) { $url = str_replace('/' . $language, '', $url); } } // set pages $url = trim($url, '/'); // currently not in the homepage if ($url != '') { // explode in pages $pages = explode('/', $url); // reset pages $this->setPages($pages); // reset parameters $this->setParameters(array()); } // set parameters $parameters = trim(mb_substr($startURL, mb_strlen($url)), '/'); // has at least one parameter if ($parameters != '') { // parameters will be separated by / $parameters = explode('/', $parameters); // set parameters $this->setParameters($parameters); } // pageId, parentId & depth $pageId = Navigation::getPageId(implode('/', $this->getPages())); $pageInfo = Navigation::getPageInfo($pageId); // invalid page, or parameters but no extra if ($pageInfo === false || !empty($parameters) && !$pageInfo['has_extra']) { // get 404 URL $url = Navigation::getURL(404); // remove language if ($hasMultiLanguages) { $url = str_replace('/' . $language, '', $url); } // remove the first slash $url = trim($url, '/'); // currently not in the homepage if ($url != '') { // explode in pages $pages = explode('/', $url); // reset pages $this->setPages($pages); // reset parameters $this->setParameters(array()); } } // is this an internal redirect? if (isset($pageInfo['redirect_page_id']) && $pageInfo['redirect_page_id'] != '') { // get url for item $newPageURL = Navigation::getURL((int) $pageInfo['redirect_page_id']); $errorURL = Navigation::getURL(404); // not an error? if ($newPageURL != $errorURL) { // redirect throw new RedirectException('Redirect', new RedirectResponse($newPageURL, $pageInfo['redirect_code'])); } } // is this an external redirect? if (isset($pageInfo['redirect_url']) && $pageInfo['redirect_url'] != '') { // redirect throw new RedirectException('Redirect', new RedirectResponse($pageInfo['redirect_url'], $pageInfo['redirect_code'])); } }
/** * Set the locale */ private function setLocale() { $default = $this->get('fork.settings')->get('Core', 'default_interface_language'); $locale = $default; $possibleLocale = array_keys(BackendLanguage::getInterfaceLanguages()); // is the user authenticated if (Authentication::getUser()->isAuthenticated()) { $locale = Authentication::getUser()->getSetting('interface_language', $default); } elseif (CommonCookie::exists('interface_language')) { // no authenticated user, but available from a cookie $locale = CommonCookie::get('interface_language'); } // validate if the requested locale is possible if (!in_array($locale, $possibleLocale)) { $locale = $default; } BackendLanguage::setLocale($locale); }
/** * Validate the form */ private function validateForm() { // get settings $subscriptionsAllowed = isset($this->settings['allow_subscriptions']) && $this->settings['allow_subscriptions']; // subscriptions aren't allowed so we don't have to validate if (!$subscriptionsAllowed) { return false; } // is the form submitted if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // does the key exists? if (\SpoonSession::exists('agenda_subscription_' . $this->record['id'])) { // calculate difference $diff = time() - (int) \SpoonSession::get('agenda_subscription_' . $this->record['id']); // calculate difference, it it isn't 10 seconds the we tell the user to slow down if ($diff < 10 && $diff != 0) { $this->frm->getField('message')->addError(FL::err('CommentTimeout')); } } // validate required fields $this->frm->getField('name')->isFilled(FL::err('NameIsRequired')); $this->frm->getField('email')->isEmail(FL::err('EmailIsRequired')); // no errors? if ($this->frm->isCorrect()) { // get module setting $moderationEnabled = isset($this->settings['moderation']) && $this->settings['moderation']; // reformat data $name = $this->frm->getField('name')->getValue(); $email = $this->frm->getField('email')->getValue(); // build array $subscription['agenda_id'] = $this->record['id']; $subscription['language'] = FRONTEND_LANGUAGE; $subscription['created_on'] = FrontendModel::getUTCDate(); $subscription['name'] = $name; $subscription['email'] = $email; $subscription['status'] = 'subscribed'; // get URL for article $permaLink = $this->record['full_url']; $redirectLink = $permaLink; // is moderation enabled if ($moderationEnabled) { // if the commenter isn't moderated before alter the subscription status so it will appear in the moderation queue if (!FrontendAgendaModel::isModerated($name, $email)) { $subscription['status'] = 'moderation'; } } // insert comment $subscription['id'] = FrontendAgendaModel::insertSubscription($subscription); // trigger event FrontendModel::triggerEvent('agenda', 'after_add_subscription', array('subscription' => $subscription)); // append a parameter to the URL so we can show moderation if (strpos($redirectLink, '?') === false) { if ($subscription['status'] == 'moderation') { $redirectLink .= '?subscription=moderation#' . FL::act('Subscribe'); } if ($subscription['status'] == 'subscribed') { $redirectLink .= '?subscription=true#subscription-' . $subscription['id']; } } else { if ($subscription['status'] == 'moderation') { $redirectLink .= '&subscription=moderation#' . FL::act('Subscribe'); } if ($subscription['status'] == 'subscribed') { $redirectLink .= '&subscription=true#comment-' . $subscription['id']; } } // set title $subscription['agenda_title'] = $this->record['title']; $subscription['agenda_url'] = $this->record['url']; // notify the admin FrontendAgendaModel::notifyAdmin($subscription); // store timestamp in session so we can block excessive usage \SpoonSession::set('agenda_subscription_' . $this->record['id'], time()); // store author-data in cookies try { Cookie::set('subscription_author', $name); Cookie::set('subscription_email', $email); } catch (Exception $e) { // settings cookies isn't allowed, but because this isn't a real problem we ignore the exception } // redirect $this->redirect($redirectLink); } } }
/** * Display the page */ public function display() { // parse header $this->header->parse(); // parse breadcrumb $this->breadcrumb->parse(); // parse languages $this->parseLanguages(); // parse footer $this->footer->parse(); // assign the id so we can use it as an option $this->tpl->assign('isPage' . $this->pageId, true); $this->tpl->assign('isChildOfPage' . $this->record['parent_id'], true); // hide the cookiebar from within the code to prevent flickering $this->tpl->assign('cookieBarHide', !$this->get('fork.settings')->get('Core', 'show_cookie_bar', false) || CommonCookie::hasHiddenCookieBar()); // the the positions to the template $this->parsePositions(); // assign empty positions $unusedPositions = array_diff($this->record['template_data']['names'], array_keys($this->record['positions'])); foreach ($unusedPositions as $position) { $this->tpl->assign('position' . \SpoonFilter::ucfirst($position), array()); } // output return new Response($this->tpl->getContent($this->templatePath, false, true), $this->statusCode); }
/** * Parse Google Analytics */ private function parseCustomHeaderHTMLAndGoogleAnalytics() { // get the data $siteHTMLHeader = (string) $this->get('fork.settings')->get('Core', 'site_html_header', null); $siteHTMLFooter = (string) $this->get('fork.settings')->get('Core', 'site_html_footer', null); $webPropertyId = $this->get('fork.settings')->get('Analytics', 'web_property_id', null); // search for the webpropertyId in the header and footer, if not found we should build the GA-code if ($webPropertyId != '' && strpos($siteHTMLHeader, $webPropertyId) === false && strpos($siteHTMLFooter, $webPropertyId) === false) { $anonymize = $this->get('fork.settings')->get('Core', 'show_cookie_bar', false) && !CommonCookie::hasAllowedCookies(); $request = $this->getContainer()->get('request'); $trackingCode = '<script> (function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,\'script\',\'//www.google-analytics.com/analytics.js\',\'ga\'); ga(\'create\', \'' . $webPropertyId . '\', \'' . $request->getHttpHost() . '\'); '; if ($anonymize) { $trackingCode .= 'ga(\'send\', \'pageview\', {\'anonymizeIp\': true});'; } else { $trackingCode .= 'ga(\'send\', \'pageview\');'; } $trackingCode .= '</script>'; $siteHTMLHeader .= "\n" . $trackingCode; } // store language $this->jsData['FRONTEND_LANGUAGE'] = FRONTEND_LANGUAGE; // encode and add $jsData = json_encode($this->jsData); $siteHTMLHeader .= "\n" . '<script>var jsData = ' . $jsData . '</script>'; // assign site wide html $this->tpl->assign('siteHTMLHeader', trim($siteHTMLHeader)); }
/** * Get the visitor's id (using a tracking cookie) * * @return string */ public static function getVisitorId() { // check if tracking id is fetched already if (self::$visitorId !== null) { return self::$visitorId; } // get/init tracking identifier self::$visitorId = CommonCookie::exists('track') && !empty($_COOKIE['track']) ? (string) CommonCookie::get('track') : md5(uniqid() . \SpoonSession::getSessionId()); if (!self::get('fork.settings')->get('Core', 'show_cookie_bar', false) || CommonCookie::hasAllowedCookies()) { CommonCookie::set('track', self::$visitorId, 86400 * 365); } return self::getVisitorId(); }
/** * Validate the form */ private function validateForm() { // get settings $commentsAllowed = isset($this->settings['allow_comments']) && $this->settings['allow_comments']; // comments aren't allowed so we don't have to validate if (!$commentsAllowed) { return false; } // is the form submitted if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // does the key exists? if (\SpoonSession::exists('blog_comment_' . $this->record['id'])) { // calculate difference $diff = time() - (int) \SpoonSession::get('blog_comment_' . $this->record['id']); // calculate difference, it it isn't 10 seconds the we tell the user to slow down if ($diff < 10 && $diff != 0) { $this->frm->getField('message')->addError(FL::err('CommentTimeout')); } } // validate required fields $this->frm->getField('author')->isFilled(FL::err('AuthorIsRequired')); $this->frm->getField('email')->isEmail(FL::err('EmailIsRequired')); $this->frm->getField('message')->isFilled(FL::err('MessageIsRequired')); // validate optional fields if ($this->frm->getField('website')->isFilled() && $this->frm->getField('website')->getValue() != 'http://') { $this->frm->getField('website')->isURL(FL::err('InvalidURL')); } // no errors? if ($this->frm->isCorrect()) { // get module setting $spamFilterEnabled = isset($this->settings['spamfilter']) && $this->settings['spamfilter']; $moderationEnabled = isset($this->settings['moderation']) && $this->settings['moderation']; // reformat data $author = $this->frm->getField('author')->getValue(); $email = $this->frm->getField('email')->getValue(); $website = $this->frm->getField('website')->getValue(); if (trim($website) == '' || $website == 'http://') { $website = null; } $text = $this->frm->getField('message')->getValue(); // build array $comment['post_id'] = $this->record['id']; $comment['language'] = FRONTEND_LANGUAGE; $comment['created_on'] = FrontendModel::getUTCDate(); $comment['author'] = $author; $comment['email'] = $email; $comment['website'] = $website; $comment['text'] = $text; $comment['status'] = 'published'; $comment['data'] = serialize(array('server' => $_SERVER)); // get URL for article $permaLink = $this->record['full_url']; $redirectLink = $permaLink; // is moderation enabled if ($moderationEnabled) { // if the commenter isn't moderated before alter the // comment status so it will appear in the moderation queue if (!FrontendBlogModel::isModerated($author, $email)) { $comment['status'] = 'moderation'; } } // should we check if the item is spam if ($spamFilterEnabled) { // check for spam $result = FrontendModel::isSpam($text, SITE_URL . $permaLink, $author, $email, $website); // if the comment is spam alter the comment status so it will appear in the spam queue if ($result) { $comment['status'] = 'spam'; } elseif ($result == 'unknown') { // if the status is unknown then we should moderate it manually $comment['status'] = 'moderation'; } } // insert comment $comment['id'] = FrontendBlogModel::insertComment($comment); // trigger event FrontendModel::triggerEvent('Blog', 'after_add_comment', array('comment' => $comment)); // append a parameter to the URL so we can show moderation if (strpos($redirectLink, '?') === false) { if ($comment['status'] == 'moderation') { $redirectLink .= '?comment=moderation#' . FL::act('Comment'); } if ($comment['status'] == 'spam') { $redirectLink .= '?comment=spam#' . FL::act('Comment'); } if ($comment['status'] == 'published') { $redirectLink .= '?comment=true#comment-' . $comment['id']; } } else { if ($comment['status'] == 'moderation') { $redirectLink .= '&comment=moderation#' . FL::act('Comment'); } if ($comment['status'] == 'spam') { $redirectLink .= '&comment=spam#' . FL::act('Comment'); } if ($comment['status'] == 'published') { $redirectLink .= '&comment=true#comment-' . $comment['id']; } } // set title $comment['post_title'] = $this->record['title']; $comment['post_url'] = $this->record['url']; // notify the admin FrontendBlogModel::notifyAdmin($comment); // store timestamp in session so we can block excessive usage \SpoonSession::set('blog_comment_' . $this->record['id'], time()); // store author-data in cookies try { CommonCookie::set('comment_author', $author); CommonCookie::set('comment_email', $email); CommonCookie::set('comment_website', $website); } catch (\Exception $e) { // settings cookies isn't allowed, but because this isn't a real problem we ignore the exception } // redirect $this->redirect($redirectLink); } } }
/** * Set locale * It will require the correct file and init the needed vars * * @param string $language The language to load. */ public static function setLocale($language) { $language = (string) $language; // validate file, generate it if needed if (!is_file(BACKEND_CACHE_PATH . '/Locale/en.json')) { BackendLocaleModel::buildCache('en', APPLICATION); } if (!is_file(BACKEND_CACHE_PATH . '/Locale/' . $language . '.json')) { // if you use the language in the console act like it is in the backend BackendLocaleModel::buildCache($language, defined('APPLICATION') && APPLICATION === 'Console' ? 'Backend' : APPLICATION); } // store self::$currentInterfaceLanguage = $language; // attempt to set a cookie try { // Needed to make it possible to use the backend language in the console. if (defined('APPLICATION') && APPLICATION !== 'Console') { CommonCookie::set('interface_language', $language); } } catch (\SpoonCookieException $e) { // settings cookies isn't allowed, because this isn't a real problem we ignore the exception } // set English translations, they'll be the fallback $translations = json_decode(file_get_contents(BACKEND_CACHE_PATH . '/Locale/en.json'), true); self::$err = (array) $translations['err']; self::$lbl = (array) $translations['lbl']; self::$msg = (array) $translations['msg']; // overwrite with the requested language's translations $translations = json_decode(file_get_contents(BACKEND_CACHE_PATH . '/Locale/' . $language . '.json'), true); $err = (array) $translations['err']; $lbl = (array) $translations['lbl']; $msg = (array) $translations['msg']; foreach ($err as $module => $translations) { if (!isset(self::$err[$module])) { self::$err[$module] = array(); } self::$err[$module] = array_merge(self::$err[$module], $translations); } foreach ($lbl as $module => $translations) { if (!isset(self::$lbl[$module])) { self::$lbl[$module] = array(); } self::$lbl[$module] = array_merge(self::$lbl[$module], $translations); } foreach ($msg as $module => $translations) { if (!isset(self::$msg[$module])) { self::$msg[$module] = array(); } self::$msg[$module] = array_merge(self::$msg[$module], $translations); } }
/** * Logout a profile. */ public static function logout() { // delete session records FrontendModel::getContainer()->get('database')->delete('profiles_sessions', 'session_id = ?', array(\SpoonSession::getSessionId())); // set is_logged_in to false \SpoonSession::set('frontend_profile_logged_in', false); // delete cookie CommonCookie::delete('frontend_profile_secret_key'); }
/** * Validate the form */ private function validateForm() { // is the form submitted if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // validate required fields $this->frm->getField('email')->isEmail(FL::err('EmailIsRequired')); $this->frm->getField('fname')->isFilled(FL::err('MessageIsRequired')); $this->frm->getField('lname')->isFilled(FL::err('MessageIsRequired')); $this->frm->getField('address')->isFilled(FL::err('MessageIsRequired')); $this->frm->getField('hnumber')->isFilled(FL::err('MessageIsRequired')); $this->frm->getField('postal')->isFilled(FL::err('MessageIsRequired')); $this->frm->getField('hometown')->isFilled(FL::err('MessageIsRequired')); // correct? if ($this->frm->isCorrect()) { // build array $order['email'] = $this->frm->getField('email')->getValue(); $order['fname'] = $this->frm->getField('fname')->getValue(); $order['lname'] = $this->frm->getField('lname')->getValue(); $order['address'] = $this->frm->getField('address')->getValue(); $order['hnumber'] = $this->frm->getField('hnumber')->getValue(); $order['postal'] = $this->frm->getField('postal')->getValue(); $order['hometown'] = $this->frm->getField('hometown')->getValue(); $order['status'] = 'moderation'; // insert values in database FrontendCatalogModel::updateOrder($order, $this->cookieOrderId); // delete cookie $argument = 'order_id'; unset($_COOKIE[(string) $argument]); setcookie((string) $argument, null, 1, '/'); // set cookies person --> optional Cookie::set('email', $order['email']); Cookie::set('fname', $order['fname']); Cookie::set('lname', $order['lname']); Cookie::set('address', $order['address']); Cookie::set('hnumber', $order['hnumber']); Cookie::set('postal', $order['postal']); Cookie::set('hometown', $order['hometown']); Cookie::set('status', $order['status']); // trigger event FrontendModel::triggerEvent('Catalog', 'after_add_order', array('order' => $order)); $url = FrontendNavigation::getURLForBlock('Catalog', 'OrderReceived'); $this->redirect($url); } } }