/** * 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'); } }
/** * 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); } }