Jason hokan Posted July 4, 2015 Share Posted July 4, 2015 Hi,I want active cash on delivery for some zone and for this If user address is in my target zone I want show cash on delivery option in payment page, how can I detect user zone in payment page ? Link to comment Share on other sites More sharing options...
bellini13 Posted July 4, 2015 Share Posted July 4, 2015 Prestashop allows you to restrict payment modules based on Countries, do you really need to restrict it based on Zones? Link to comment Share on other sites More sharing options...
Jason hokan Posted July 5, 2015 Author Share Posted July 5, 2015 I want control to show or hide Cash On Delivery option, it's not important zone,country or state but state is better for me? thanks Link to comment Share on other sites More sharing options...
bellini13 Posted July 5, 2015 Share Posted July 5, 2015 you can restrict countries in the Modules > Payment page in the back office Link to comment Share on other sites More sharing options...
Jason hokan Posted July 6, 2015 Author Share Posted July 6, 2015 how can I control this with code in payment page ? I want add some option for some state ! Link to comment Share on other sites More sharing options...
Jason hokan Posted July 6, 2015 Author Share Posted July 6, 2015 (edited) I add this code under hookPayment function in cashondelivery module plugin ( in cashondelivery.php file) public function hookPayment($params) { // add this code under your hookpayment function: global $smarty; $address = new Address(intval($params['cart']->id_address_delivery)); $smarty->assign(array( 'address' => $address, )); } and after that add this code on /cashondelivery/views/templates/hook/payment.tpl {if $address->id_state == 111 } .... {/if} and it is resolved. Edited July 6, 2015 by Jason hokan (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now