0

So in my explorations I've found that Magento only has the States stored in the back end, but I don't want to remove the entire state, just one city in that state. I've seen options to include a city option, or remove city drop down, but I can't seem to find a way to just remove one city.

Am I just over looking something really basic, or am I going to need to dive into the code and log all the cities in every state and then exclude the one city I don't want to allow to order?

Thanks in advance for reading this, and I'm sorry if I'm asking a dumb question but I just can't seem to find an answer.

1

You can do client-side validation as specified by @MageCoder. Another approach is to have server side validation. In onepage checkout when someone fillups the addess and proceed, it send request to saveShippingAction() in Mage/Checkout/controllers/OnepageController.php. Here you could perform validation.

if($data['city'] == 'New York')   
{
    $result['goto_section'] = 'shipping_method';
    $result['update_section'] = array(
                            'name' => 'shipping-method',
                            'html' => Mage::helper('checkout')->__('Shipping not allowed'));
    $this->_prepareDataJSON($result);
 }

Make sure you override the controller else your customisation will be lost.

0
  • You can create custom validation on that city field
  • If user enter that city then it resticct to proceed

https://claireparker.github.io/magento-1-frontend-bits/validation-rule/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.