NuZ Posted October 23, 2014 Share Posted October 23, 2014 I installed Cash on Delivery module. After i push "Cash on Delivery" button in order, Im going to "module/cashondelivery/validation" link. I want to display order's products in that view. I found file of that view, but I dont know how can i get order's products.Thank you Link to comment Share on other sites More sharing options...
NemoPS Posted October 24, 2014 Share Posted October 24, 2014 You have to edit both the validation controller and display file. For the file, just copy and paste the order summary table from shopping_cart.tpl For the validation, add this to initcontent before showing the template $this->_assignSummaryInformations(); And then this method to the controller itself protected function _assignSummaryInformations() { $summary = $this->context->cart->getSummaryDetails(); $customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id); // override customization tax rate with real tax (tax rules) if ($customizedDatas) { foreach ($summary['products'] as &$productUpdate) { $productId = (int)(isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']); $productAttributeId = (int)(isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']); if (isset($customizedDatas[$productId][$productAttributeId])) $productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); } Product::addCustomizationPrice($summary['products'], $customizedDatas); } $cart_product_context = Context::getContext()->cloneContext(); foreach ($summary['products'] as $key => &$product) { $product['quantity'] = $product['cart_quantity'];// for compatibility with 1.2 themes if ($cart_product_context->shop->id != $product['id_shop']) $cart_product_context->shop = new Shop((int)$product['id_shop']); $product['price_without_specific_price'] = Product::getPriceStatic( $product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute'], 2, null, false, false, 1, false, null, null, null, $null, true, true, $cart_product_context); if (Product::getTaxCalculationMethod()) $product['is_discounted'] = $product['price_without_specific_price'] != $product['price']; else $product['is_discounted'] = $product['price_without_specific_price'] != $product['price_wt']; } // Get available cart rules and unset the cart rules already in the cart $available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, (isset($this->context->customer->id) ? $this->context->customer->id : 0), true, true, true, $this->context->cart); $cart_cart_rules = $this->context->cart->getCartRules(); foreach ($available_cart_rules as $key => $available_cart_rule) { if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], 'BO_ORDER_') === 0) { unset($available_cart_rules[$key]); continue; } foreach ($cart_cart_rules as $cart_cart_rule) if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule']) { unset($available_cart_rules[$key]); continue 2; } } $show_option_allow_separate_package = (!$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE')); $this->context->smarty->assign($summary); $this->context->smarty->assign(array( 'token_cart' => Tools::getToken(false), 'isVirtualCart' => $this->context->cart->isVirtualCart(), 'productNumber' => $this->context->cart->nbProducts(), 'voucherAllowed' => CartRule::isFeatureActive(), 'shippingCost' => $this->context->cart->getOrderTotal(true, Cart::ONLY_SHIPPING), 'shippingCostTaxExc' => $this->context->cart->getOrderTotal(false, Cart::ONLY_SHIPPING), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'lastProductAdded' => $this->context->cart->getLastProduct(), 'displayVouchers' => $available_cart_rules, 'currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank, 'show_option_allow_separate_package' => $show_option_allow_separate_package, 'smallSize' => Image::getSize(ImageType::getFormatedName('small')), )); $this->context->smarty->assign(array( 'HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary) )); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now