Overview

Packages

  • Eabi
    • Dpd
  • None
  • PHP

Classes

  • dpdcodpaymentPaymentModuleFrontController
  • dpdcodpaymentValidationModuleFrontController
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * 
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * or OpenGPL v3 license (GNU Public License V3.0)
  9:  * that is bundled with this package in the file LICENSE.txt.
 10:  * It is also available through the world-wide-web at this URL:
 11:  * http://opensource.org/licenses/osl-3.0.php
 12:  * or
 13:  * http://www.gnu.org/licenses/gpl-3.0.txt
 14:  * If you did not receive a copy of the license and are unable to
 15:  * obtain it through the world-wide-web, please send an email
 16:  * to info@e-abi.ee so we can send you a copy immediately.
 17:  *
 18:  * DISCLAIMER
 19:  *
 20:  * Do not edit or add to this file if you wish to upgrade this module to newer
 21:  * versions in the future.
 22:  *
 23:  * @category   Eabi
 24:  * @package    Eabi_Dpd
 25:  * @copyright  Copyright (c) 2014 Aktsiamaailm LLC (http://en.e-abi.ee/)
 26:  * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 27:  * @license    http://www.gnu.org/licenses/gpl-3.0.txt  GNU Public License V3.0
 28:  * @author     Matis Halmann
 29:  * 
 30: 
 31:  */
 32: 
 33: /**
 34:  * <p>Handles all actions, when customer has selected DPD COD as payment of choice</p>
 35:  */
 36: class dpdcodpaymentPaymentModuleFrontController extends ModuleFrontController {
 37: 
 38:     public $ssl = true;
 39: 
 40:     /**
 41:      * @see FrontController::initContent()
 42:      */
 43:     public function initContent() {
 44:         /* @var $this->module DpdCodPayment */
 45:         $this->display_column_left = true;
 46: 
 47:         $cart = $this->context->cart;
 48:         $moduleParams = array('cart' => $cart);
 49:         if (!$this->module->checkCurrency($cart) || !$this->module->isAvailable($moduleParams)) {
 50:             Tools::redirect('index.php?controller=order');
 51:             exit;
 52:         }
 53: 
 54:         // construct instructions and title
 55:         $module = array(
 56:             '_title' => $this->module->getCurrentLangValue($this->module->getConfigData('TITLE')),
 57:             '_extra' => '', //$this->module->getTitle($cart),
 58:             '_text' => $this->module->getCurrentLangValue($this->module->getConfigData('INFO_TEXT')),
 59:         );
 60: 
 61:         //codFee property is read by carrier moduleinstance component and added to shipping total
 62:         $cart->codFee = $this->module->getCodFee($cart);
 63:         
 64:         //call summary after COD Fee has been set, then it re-calculates shipping price
 65:         //for displaying short order summary with ordered products
 66:         $summary = $cart->getSummaryDetails();
 67:         
 68:         $products = $summary['products'];
 69:         $total_shipping = $summary['total_shipping'];
 70:         $total_price = $summary['total_price'];
 71:         $total_products = $summary['total_products'];
 72:         
 73:         //constructor must be here, otherwise newly found shipping price is not propagated to other controllers
 74:         parent::initContent();
 75:         $pickupLocationModuleParams = array(
 76:             'eabi_template' => '%TERMINAL%',
 77:         );
 78:         
 79:         //fetch only selected pickup point name without any extras
 80:         $pickup_location = HookCore::exec('displayOrderConfirmation', $pickupLocationModuleParams, ModuleCore::getModuleIdByName('eabi_postoffice'));
 81: 
 82: 
 83:         $this->context->smarty->assign(array(
 84:             'eabi_summary' => array(
 85:                 'products' => $products,
 86:                 'total_shipping' => $total_shipping,
 87:                 'total_products' => $total_products,
 88:                 'total_price' => $total_price,
 89:                 'currency' => CurrencyCore::getCurrency($cart->id_currency),
 90:                 'cod_fee' => $cart->codFee,
 91:                 'cod_fee_formatted' => Tools::displayPrice($cart->codFee),
 92:                 'template' => $this->getTemplatePath('').'order-detail.tpl',
 93:                 'pickup_location' => $pickup_location,
 94:             ),
 95:             'nbProducts' => $cart->nbProducts(),
 96:             'cust_currency' => $cart->id_currency,
 97:             'currencies' => $this->module->getCurrency((int) $cart->id_currency),
 98:             'total' => $cart->getOrderTotal(true, Cart::BOTH),
 99:             'this_path' => $this->module->getPathUri(),
100:             'current_module' => $module,
101:             'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/'
102:         ));
103:         if ($this->module->ver == "1.5") {
104:             $this->setTemplate('payment_exec.tpl');
105:         } else {
106:             $this->setTemplate('payment_execution.tpl');
107:             
108:         }
109:         
110:         
111:     }
112: 
113: }
API documentation generated by ApiGen 2.8.0