// Context part 12
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7649 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -45,7 +45,7 @@ class AddressControllerCore extends FrontController
|
||||
public function preProcess()
|
||||
{
|
||||
parent::preProcess();
|
||||
|
||||
$context = Context::getContext();
|
||||
if ($back = Tools::getValue('back'))
|
||||
$this->smarty->assign('back', Tools::safeOutput($back));
|
||||
if ($mod = Tools::getValue('mod'))
|
||||
@@ -202,11 +202,10 @@ class AddressControllerCore extends FrontController
|
||||
}
|
||||
elseif (!$id_address)
|
||||
{
|
||||
$customer = new Customer((int)(self::$cookie->id_customer));
|
||||
if (Validate::isLoadedObject($customer))
|
||||
if (Validate::isLoadedObject($context->customer))
|
||||
{
|
||||
$_POST['firstname'] = $customer->firstname;
|
||||
$_POST['lastname'] = $customer->lastname;
|
||||
$_POST['firstname'] = $context->customer->firstname;
|
||||
$_POST['lastname'] = $context->customer->lastname;
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('ajax') AND sizeof($this->errors))
|
||||
|
||||
@@ -50,15 +50,15 @@ class AddressesControllerCore extends FrontController
|
||||
|
||||
$multipleAddressesFormated = array();
|
||||
$ordered_fields = array();
|
||||
$customer = new Customer((int)(self::$cookie->id_customer));
|
||||
|
||||
$customer = $context->customer;
|
||||
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
die(Tools::displayError('Customer not found'));
|
||||
|
||||
// Retro Compatibility Theme < 1.4.1
|
||||
$this->smarty->assign('addresses', $customer->getAddresses((int)(self::$cookie->id_lang)));
|
||||
$this->smarty->assign('addresses', $customer->getAddresses($context->language->id));
|
||||
|
||||
$customerAddressesDetailed = $customer->getAddresses((int)(self::$cookie->id_lang));
|
||||
$customerAddressesDetailed = $customer->getAddresses($context->language->id);
|
||||
|
||||
$total = 0;
|
||||
foreach($customerAddressesDetailed as $addressDetailed)
|
||||
@@ -74,12 +74,12 @@ class AddressesControllerCore extends FrontController
|
||||
++$total;
|
||||
|
||||
// Retro theme < 1.4.2
|
||||
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
|
||||
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
|
||||
}
|
||||
|
||||
// Retro theme 1.4.2
|
||||
if (($key = array_search('Country:name', $ordered_fields)))
|
||||
$ordered_fields[$key] = 'country';
|
||||
if (($key = array_search('Country:name', $ordered_fields)))
|
||||
$ordered_fields[$key] = 'country';
|
||||
|
||||
$this->smarty->assign('addresses_style', array(
|
||||
'company' => 'address_company'
|
||||
@@ -98,7 +98,6 @@ class AddressesControllerCore extends FrontController
|
||||
$this->smarty->assign(array(
|
||||
'multipleAddresses' => $multipleAddressesFormated,
|
||||
'ordered_fields' => $ordered_fields));
|
||||
unset($customer);
|
||||
}
|
||||
|
||||
public function displayContent()
|
||||
|
||||
@@ -31,6 +31,7 @@ class CartControllerCore extends FrontController
|
||||
{
|
||||
$this->init();
|
||||
$this->preProcess();
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Tools::getValue('ajax') == 'true')
|
||||
{
|
||||
@@ -38,15 +39,12 @@ class CartControllerCore extends FrontController
|
||||
{
|
||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
|
||||
{
|
||||
if (self::$cookie->id_customer)
|
||||
{
|
||||
$customer = new Customer((int)(self::$cookie->id_customer));
|
||||
$groups = $customer->getGroups();
|
||||
}
|
||||
if (Validate::isLoadedObject($context->customer))
|
||||
$groups = $context->customer->getGroups();
|
||||
else
|
||||
$groups = array(1);
|
||||
if ((int)self::$cart->id_address_delivery)
|
||||
$deliveryAddress = new Address((int)self::$cart->id_address_delivery);
|
||||
$deliveryAddress = new Address(self::$cart->id_address_delivery);
|
||||
$result = array('carriers' => Carrier::getCarriersForOrder((int)Country::getIdZone((isset($deliveryAddress) AND (int)$deliveryAddress->id) ? (int)$deliveryAddress->id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
|
||||
}
|
||||
$result['summary'] = self::$cart->getSummaryDetails();
|
||||
|
||||
Reference in New Issue
Block a user