Hacking MarketPress Shipping Form (text field to dropdown box)

On the page "/store/shopping-cart/shipping" it asks you for your address. Where you select your country it offers only a drop down box with only approved countries you set in the admin dashboard.

I wish to do the same thing for the "City" field. My MarketPress is used to offer a service or "installation" of software so to speak. I install the software locally and use these contact details to contact them. I edited the plugin code to change phrases that say "shipping" information to "contact" (ex: Please enter your CONTACT information).

To ensure users don't use my MarketPress if they are outside of my city I wish to use a drop down box for the "City" field. Only allowing them to select cities I currently offer service to.

I am going to try and hack the plugin myself to do this.. Any ideas on what I should do? I may end up trying to change the "Country" to "City" and modify the country options in the drop down.. I think I would have to change language settings if the plugin code? In that case I would also have to move around fields to display the country somehow and move the old "country" field (now a city field) to the correct location in the form (to follow correct formatting of inputting an address).

Any ideas, input, or knowledge of a fast/easy way to do this would be greatly appreciated! Thanks!

  • _981
    • Site Builder, Child of Zeus

    I solved this myself, simply changed areas like

    <input size="25" id="mp_shipping_info_city" name="mp_shipping_info[city]" type="text" value="<?php echo esc_attr($city); ?>" />

    to

    <select id="mp_shipping_info_city" name="mp_shipping_info[city]">
       <option value="CITY-HERE">CITY_HERE</option>
            </select>

    in marketpress.php and some areas like "province" in marketpress-includes/template-functions.php

    When I changed the province to display one province I had to follow the 2 letter code format "ON" for Ontario, otherwise you get an error "Please enter a valid two-letter Canadian Province abbreviation."

    I also localized the plugin to change "state/province" to "province", and "ZIP/Postal Code" to "Postal Code".

    yet another problem solved by myself xD thanks anyways and hopefully this can help anyone else out there maybe.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.