When you have only one country to ship to and it is clear that you are shipping only to that country alone, you can simplify your shipping estimation by removing a country field:
In addition, if you will look at View Cart page and will notice that it has a lot of states as javascript array that takes about 50% of the whole webpage HTML code. Since we are working only with US, we don’t care about other states and they still load as a webpage source. So, I went ahead and made it load only US states, much smaller HTML code for the view cart page.
$avail_cond = “WHERE cc.status = 'A' AND a.status = 'A'”;
$avail_join = 'LEFT JOIN ?:countries as cc ON cc.code = a.country_code';
} else {
$avail_cond = '';
$avail_join = '';
}
88c94
< return db_get_array(“SELECT a.state_id, a.code, b.state, c.country FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s LEFT JOIN ?:country_descriptions as c ON c.code = a.country_code AND c.lang_code = ?s $avail_cond ORDER BY a.country_code, b.state”, $lang_code, $lang_code);
—
return db_get_array(“SELECT a.state_id, a.code, b.state, c.country FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s LEFT JOIN ?:country_descriptions as c ON c.code = a.country_code AND c.lang_code = ?s $avail_join $avail_cond ORDER BY a.country_code, b.state”, $lang_code, $lang_code);
90c96
< return db_get_hash_multi_array(“SELECT a.country_code, a.code, b.state FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s $avail_cond ORDER BY a.country_code, b.state”, array('country_code'), $lang_code);
—
return db_get_hash_multi_array(“SELECT a.country_code, a.code, b.state FROM ?:states as a LEFT JOIN ?:state_descriptions as b ON b.state_id = a.state_id AND b.lang_code = ?s $avail_join $avail_cond ORDER BY a.country_code, b.state”, array('country_code'), $lang_code);
In addition, if you will look at View Cart page and will notice that it has a lot of states as javascript array that takes about 50% of the whole webpage HTML code. Since we are working only with US, we don't care about other states and they still load as a webpage source. So, I went ahead and made it load only US states, much smaller HTML code for the view cart page.