0

we are using "Cash On Delivery" Payment method in magento 1.9.0

we support cash on delivery to only some zip/pin codes locations.

means we will accept cash only from some zip codes [means locations].

under "checkout" in "shipping address", customer will type his/her "zip code" .

using that zip code we have to validation.

means if we deliver the product to that zip code, than "COD" payment method should visible under "payment method"

otherwise "COD" should not visible.

if someone is unclear with above question , please refer following link :

https://stackoverflow.com/questions/16439761/how-to-restrict-default-cod-in-magento-to-certain-zip-codes-only

this is the question.

can anyone explain in detail about above solution....

or

also here in following link :

https://stackoverflow.com/questions/29248124/restrict-default-cash-on-delivery-for-some-zip-pin-codes-in-magento-1-9-0/29259050#29259050

there is an option to enter list of zip codes that are restricted. but we need a solution for list of zip codes that allowed.

1

1 Answer 1

2

As you already created a table to store COD available pin codes, get customer's pin-code with below code and match with your table pin -code values.

Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getPostcode(); //or Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress()->getPostcode(); 

Now you need to put a condition to show COD method. Update below file...

app\design\frontend\base\default\template\checkout\onepage\payment\methods.phtml

Find code near line 43

if(($_method->getCode() == "cashondelivery") && --Your custom condition--) 
1
  • i will check and inform you soon..... Commented Mar 27, 2015 at 11:12

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.