Jump to content

getting pincode of the customer in cod template file


opnh

Recommended Posts

Hello

 

I want to enable cash on delivery only for particular range of pin codes and if it is out of range cash on delivery has to disable, the pincodes are not in an order so I created an array of pincodes .

 

I am using prestashop 1.6.1.5  I am putting the array in /themes/mythememodules/cashondelivery/views/templates/front/validation.tpl  but I am not getting the right syntax to declare an array using smarty 

 

 

validation.tpl   code

 

{capture name=path}{l s='Shipping' mod='cashondelivery'}{/capture}
 
{$something=['110021','110022','110030','110037','110038','110043']}
 
 
 
{if in_array($smarty.post.postcode, $something)}
 
 
<h1 class="page-heading">{l s='Order summary' mod='cashondelivery'}</h1>
 
{assign var='current_step' value='payment'}
{include file="$tpl_dir./order-steps.tpl"}
 
<form action="{$link->getModuleLink('cashondelivery', 'validation', [], true)|escape:'html'}" method="post">
<div class="box">
        <input type="hidden" name="confirm" value="1" />
        <h3 class="page-subheading">{l s='Cash on delivery (COD) payment' mod='cashondelivery'}</h3>
        <p>
            - {l s='You have chosen the cash on delivery method.' mod='cashondelivery'}
            <br/>
            - {l s='The total amount of your order is' mod='cashondelivery'}
            <span id="amount_{$currencies.0.id_currency}" class="price">{convertPrice price=$total}</span>
            {if $use_taxes == 1}
                {l s='(tax incl.)' mod='cashondelivery'}
            {/if}
        </p>
        <p>
            <b>{l s='Please confirm your order by clicking \'I confirm my order\'.' mod='cashondelivery'}.</b>
        </p>        
    </div>
    <p class="cart_navigation" id="cart_navigation">
        <a href="{$link->getPageLink('order', true)}?step=3" class="button-exclusive btn btn-default"><i class="icon-chevron-left"></i>{l s='Other payment methods' mod='cashondelivery'}</a>
        <button type="submit" class="button-exclusive btn btn-default pull-right"><span>{l s='I confirm my order' mod='cashondelivery'}</span></button>
    </p>
</form>
{/if}
 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...