コード例 #1
0
ファイル: customquote.php プロジェクト: Eximagen/3m
 public function hookdisplayProductcustomquote($params)
 {
     global $cookie;
     if (isset($_COOKIE['ftpr'])) {
         $cookieid = $_COOKIE['ftpr'];
     } else {
         $cookieid = 'x';
     }
     $this->context->controller->addCSS($this->_path . 'customquote.css', 'all');
     $this->context->controller->addJS($this->_path . 'customquote.js');
     $orderfiles = new orderfiles();
     // var_dump($orderfiles->getproductfiles(Tools::getValue('id_product'),$cookieid));
     $this->context->smarty->assign(array('my_module_name' => Configuration::get('CUSTOMQUOTE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('customquote', 'display'), 'customizationFields' => $params['customizationFields'], 'files' => $orderfiles->getproductfiles(Tools::getValue('id_product'), $cookieid), 'shop_path' => PS_SHOP_PATH));
     return $this->display(__FILE__, 'customquote.tpl');
 }
コード例 #2
0
ファイル: OrderController.php プロジェクト: Eximagen/3m
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (Tools::isSubmit('ajax') && Tools::getValue('method') == 'updateExtraCarrier') {
         // Change virtualy the currents delivery options
         $delivery_option = $this->context->cart->getDeliveryOption();
         $delivery_option[(int) Tools::getValue('id_address')] = Tools::getValue('id_delivery_option');
         $this->context->cart->setDeliveryOption($delivery_option);
         $this->context->cart->save();
         $return = array('content' => Hook::exec('displayCarrierList', array('address' => new Address((int) Tools::getValue('id_address')))));
         die(Tools::jsonEncode($return));
     }
     if ($this->nbProducts) {
         $this->context->smarty->assign('virtual_cart', $this->context->cart->isVirtualCart());
     }
     if (!Tools::getValue('multi-shipping')) {
         $this->context->cart->setNoMultishipping();
     }
     global $cookie;
     if (isset($_COOKIE['ftpr'])) {
         $cookieid = $_COOKIE['ftpr'];
     } else {
         $cookieid = 'x';
     }
     $orderfiles = new orderfiles();
     $files = array();
     $products = $this->context->cart->getProducts();
     foreach ($products as $product) {
         $files[$product['id_product']] = $orderfiles->getproductfiles($product['id_product'], $cookieid);
     }
     $this->context->smarty->assign('files', $files);
     $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
     // 4 steps to the order
     switch ((int) $this->step) {
         case -1:
             $this->context->smarty->assign('empty', 1);
             $this->context->smarty->assign('files', $files);
             $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
             $this->setTemplate(_PS_THEME_DIR_ . 'shopping-cart.tpl');
             break;
         case 1:
             $this->_assignAddress();
             $this->processAddressFormat();
             if (Tools::getValue('multi-shipping') == 1) {
                 $this->_assignSummaryInformations();
                 $this->context->smarty->assign('product_list', $this->context->cart->getProducts());
                 $this->setTemplate(_PS_THEME_DIR_ . 'order-address-multishipping.tpl');
             } else {
                 $this->setTemplate(_PS_THEME_DIR_ . 'order-address.tpl');
             }
             break;
         case 2:
             if (Tools::isSubmit('processAddress')) {
                 $this->processAddress();
             }
             $this->autoStep();
             $this->_assignCarrier();
             $this->context->controller->addJQueryUI('ui.datepicker');
             $this->setTemplate(_PS_THEME_DIR_ . 'order-carrier.tpl');
             break;
         case 3:
             // Check that the conditions (so active) were accepted by the customer
             $cgv = Tools::getValue('cgv') || $this->context->cookie->check_cgv;
             if (Configuration::get('PS_CONDITIONS') && (!Validate::isBool($cgv) || $cgv == false)) {
                 Tools::redirect('index.php?controller=order&step=2');
             }
             Context::getContext()->cookie->check_cgv = true;
             // Check the delivery option is set
             if (!$this->context->cart->isVirtualCart()) {
                 if (!Tools::getValue('delivery_option') && !Tools::getValue('id_carrier') && !$this->context->cart->delivery_option && !$this->context->cart->id_carrier) {
                     Tools::redirect('index.php?controller=order&step=2');
                 } elseif (!Tools::getValue('id_carrier') && !$this->context->cart->id_carrier) {
                     $deliveries_options = Tools::getValue('delivery_option');
                     if (!$deliveries_options) {
                         $deliveries_options = $this->context->cart->delivery_option;
                     }
                     foreach ($deliveries_options as $delivery_option) {
                         if (empty($delivery_option)) {
                             Tools::redirect('index.php?controller=order&step=2');
                         }
                     }
                 }
             }
             $this->autoStep();
             // Bypass payment step if total is 0
             if (($id_order = $this->_checkFreeOrder()) && $id_order) {
                 if ($this->context->customer->is_guest) {
                     $order = new Order((int) $id_order);
                     $email = $this->context->customer->email;
                     $this->context->customer->mylogout();
                     // If guest we clear the cookie for security reason
                     Tools::redirect('index.php?controller=guest-tracking&id_order=' . urlencode($order->reference) . '&email=' . urlencode($email));
                 } else {
                     Tools::redirect('index.php?controller=history');
                 }
             }
             $this->_assignPayment();
             // assign some informations to display cart
             $this->_assignSummaryInformations();
             $this->context->smarty->assign('files', $files);
             $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
             $this->setTemplate(_PS_THEME_DIR_ . 'order-payment.tpl');
             break;
         default:
             $this->_assignSummaryInformations();
             $this->context->smarty->assign('files', $files);
             $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
             $this->setTemplate(_PS_THEME_DIR_ . 'shopping-cart.tpl');
             break;
     }
     $this->context->smarty->assign(array('currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank));
 }