Skip to content

Commit

Permalink
Split validation template file into two files to handle 1.6 and 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwch committed Jun 8, 2017
1 parent 2604a9f commit a11528e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
18 changes: 14 additions & 4 deletions controllers/front/validation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php

function is_not_17(){
return version_compare(_PS_VERSION_, '1.7', '<');
}

class InstamojoPrestaShopvalidationModuleFrontController extends ModuleFrontController
{
public $ssl = true;
Expand Down Expand Up @@ -29,7 +34,7 @@ public function postProcess()

# prepare logger
$logger = new FileLogger(0); //0 == debug level, logDebug() won’t work without this.
if (version_compare(_PS_VERSION_, '1.7', '<')){
if (is_not_17()){
$logger->setFilename(_PS_ROOT_DIR_ . "/log/imojo.log");
}
else{
Expand Down Expand Up @@ -104,16 +109,21 @@ public function initContent()

$temp_data = array(
'total' => $this->context->cart->getOrderTotal(true, Cart::BOTH),
'this_path' => $this->module->getPathUri(),//keep for retro compat
'this_path' => $this->module->getPathUri(), //keep for retro compat
'checkout_label' => Configuration::get('instamojo_checkout_label'),
'this_path_instamojo' => $this->module->getPathUri(),
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/',
);
$this->template_data = array_merge($this->template_data,$temp_data);
$this->template_data = array_merge($this->template_data, $temp_data);
$this->context->smarty->assign($this->template_data);
$this->display_column_left = false;
$this->display_column_right = false;
$this->setTemplate('validation.tpl');
if(is_not_17()){
$this->setTemplate('validation_old.tpl');
}
else{
$this->setTemplate('module:InstamojoPrestaShop/views/templates/front/validation_new.tpl');
}
parent::initContent();
}
}
40 changes: 40 additions & 0 deletions views/templates/front/validation_new.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@


{capture name=path}
<a href="{$link->getPageLink('order', true, NULL, "step=3")|escape:'htmlall':'UTF-8'}" rel="nofollow" title="{l s='Go back to the Checkout' mod='InstamojoPrestaShop'}">
{l s='Checkout' mod='InstamojoPrestaShop'}
{l s='Pay using Instamojo' mod='InstamojoPrestaShop'}
{/capture}



{assign var='current_step' value='payment'}

{if isset($api_errors)}
<div class="errors">
{foreach $api_errors as $error}
<div class='alert alert-danger error'>{$error}</div>
{/foreach}
</div>
{/if}

<P>Selected Payment Method : <b>{$checkout_label}</b></p>

<form action="{$link->getModuleLink('InstamojoPrestaShop', 'validation', [], true)|escape:'htmlall':'UTF-8'}" method="post">
{if isset($showPhoneBox)}
<div style="padding:20px 0px;margin:20px 0;">
<label>Mobile No.</label>
<input class='form-controls' type="text" name='mobile' value="{$mobile}">
<div>
<input class='btn btn-primary' type='submit' name='updatePhone' value='Update Phone'>
</div>
</div>
{else}
<input type="hidden" name="confirm" value="1" />

<p class="cart_navigation" id="cart_navigation">
<a href="{$link->getPageLink('order', true)}?step=3" class="button_large">{l s='Other payment methods' mod='InstamojoPrestaShop'}</a>
<input type="submit" value="{l s='Confirm Order' mod='InstamojoPrestaShop'}" class="exclusive_large" />
</p>
{/if}
</form>
File renamed without changes.

0 comments on commit a11528e

Please sign in to comment.