Jump to content

Control tpl file through hook


nitaish

Recommended Posts

Hello Everyone,

Can you help us with below query

How to access .tpl file data to hook file.

We are trying to select one currency payment method INR onclick i want to show only two radio buttons banktransfer and ccavenuev2. How can i control it through hook.

If customer currency is INR it should show Bank transfer and ccAvenue gateway option else banktransfer and stripe.

We were able to achive this via .tpl modification but we need this to be execute through a hook and not editing any tpl files.

i can do this....

 

function MySmartyModifierHook(array $vars) {
	
   global $smarty;

	 if ($vars['templatefile'] != 'paymentmethod'){
		 
        return 'this is paymentmethod area';

    // ... your code here ...
} 
	
	
    class Geolocation{
        public function sm_loc($params, Smarty_Internal_Template $template) {
            return "100.70";
        }
    }
 
    // Register the Smarty plugin
     $smarty->registerPlugin('modifier', 'myModifier', array('Geolocation', 'sm_loc'));
	 
} 

// Assign the hook
add_hook('ShoppingCartCheckoutOutput', 1, 'MySmartyModifierHook'); 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated