Skip to content

Commit

Permalink
Pass estimates down to checkout #410
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Brookbanks committed Jun 1, 2015
1 parent e64f8aa commit ac7587a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions classes/cubecart.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,9 @@ private function _basket($editable = true) {
if($_GET['_a']=='basket') {
if(isset($_POST['get-estimate'])) {
$_POST['estimate']['postcode'] = empty($_POST['estimate']['postcode']) ? $GLOBALS['config']->get('config', 'store_postcode') : $_POST['estimate']['postcode'];
$basket_data['delivery_address'] = $GLOBALS['user']->formatAddress($_POST['estimate'],false);
$basket_data['delivery_address'] = $GLOBALS['user']->formatAddress($_POST['estimate'],false,true);
$this->_basket['delivery_address'] = $basket_data['delivery_address'];
$this->_basket['billing_address'] = $basket_data['delivery_address'];
$GLOBALS['cart']->save();
$GLOBALS['gui']->setNotify($GLOBALS['language']->basket['shipping_address_updated']);
}
Expand Down Expand Up @@ -1055,10 +1056,10 @@ private function _checkout() {
if (isset($this->_basket['customer'])) {
$GLOBALS['smarty']->assign('USER', $this->_basket['customer']);
}
if (isset($this->_basket['billing_address']) && $this->_basket['billing_address']['user_defined']) {
if ((isset($this->_basket['billing_address']) && $this->_basket['billing_address']['user_defined']) || $this->_basket['billing_address']['estimate']) {
$GLOBALS['smarty']->assign('BILLING', $this->_basket['billing_address']);
}
if (isset($this->_basket['delivery_address']) && $this->_basket['delivery_address']['user_defined']) {
if (isset($this->_basket['delivery_address']) && $this->_basket['delivery_address']['user_defined'] || $this->_basket['delivery_address']['estimate']) {
$GLOBALS['smarty']->assign('DELIVERY', $this->_basket['delivery_address']);
}

Expand Down
3 changes: 2 additions & 1 deletion classes/user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public function deleteAddress($delete) {
* @param array
* @return array
*/
public function formatAddress($address = array(), $user_defined = true) {
public function formatAddress($address = array(), $user_defined = true, $estimate = false) {

if(!$user_defined && !is_array($address)) {
$address = array(
Expand All @@ -427,6 +427,7 @@ public function formatAddress($address = array(), $user_defined = true) {
$address['country_iso3'] = getCountryFormat($address['country_id'], 'numcode', 'iso3');
$address['state'] = getStateFormat($address['state_id']);
$address['user_defined'] = $user_defined;
$address['estimate'] = $estimate;
return $address;
}

Expand Down

0 comments on commit ac7587a

Please sign in to comment.