updated some function names according to their working
This commit is contained in:
@@ -83,10 +83,10 @@ class CustomerGuestDetailCore extends ObjectModel
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
public function deleteCartCustomerGuestByIdCustomer($idCustomer, $offset = 0)
|
||||
public function deleteCustomerGuestByIdCustomer($idCustomer, $offset = 0)
|
||||
{
|
||||
$res = true;
|
||||
if ($guests = $this->getCustomerRelatedGuestDetails($idCustomer, false, false, false, $offset)) {
|
||||
if ($guests = $this->getCustomerGuestsByIdCustomer($idCustomer, false, false, false, $offset)) {
|
||||
foreach ($guests as $guest) {
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail((int) $guest['id_customer_guest_detail']);
|
||||
$objCustomerGuestDetail->delete();
|
||||
@@ -96,7 +96,7 @@ class CustomerGuestDetailCore extends ObjectModel
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0)
|
||||
public function getCustomerGuestsByIdCustomer($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone`
|
||||
|
||||
@@ -941,7 +941,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$shop = new Shop($customer->id_shop);
|
||||
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail();
|
||||
$customerGuests = $objCustomerGuestDetail->getCustomerRelatedGuestDetails($customer->id);
|
||||
$customerGuests = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer($customer->id);
|
||||
$this->tpl_view_vars = array(
|
||||
'customer' => $customer,
|
||||
'gender' => $gender,
|
||||
|
||||
@@ -1081,7 +1081,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$lastname = trim(Tools::getValue('lastname'));
|
||||
$email = trim(Tools::getValue('email'));
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail();
|
||||
if ($guestDetails = $objCustomerGuestDetail->getCustomerRelatedGuestDetails(
|
||||
if ($guestDetails = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer(
|
||||
$this->context->cart->id_customer,
|
||||
$firstname,
|
||||
$lastname,
|
||||
@@ -1167,7 +1167,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$objCustomerGuestDetail->id_customer = $this->context->customer->id;
|
||||
if ($objCustomerGuestDetail->save()) {
|
||||
if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_NUM')) {
|
||||
$objCustomerGuestDetail->deleteCartCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed);
|
||||
$objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed);
|
||||
}
|
||||
// To prevent duplications for the same cart.
|
||||
CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id);
|
||||
|
||||
Reference in New Issue
Block a user