/** * Save address * * @return boolean */ protected function doActionSave() { $result = parent::doActionSave(); if ($result && $this->getModelForm()->getModelObject() && $this->getModelForm()->getModelObject()->getAddressId()) { // New address is not yet saved in profile \XLite\Core\Database::getEM()->flush(); $addresses = $this->getProfile()->getAddresses(); foreach ($addresses as $address) { if ($this->getModelForm()->getModelObject()->getAddressId() == $address->getAddressId()) { $address->setIsBilling(true); } else { $address->setIsBilling(false); } } // For those, who doesn't understand from the first time $this->getModelForm()->getModelObject()->setIsBilling(true); \XLite\Core\Database::getEM()->flush(); } return $result; }
/** * Skip profileId param correction for Drupal storefront * * @param integer $profileId Profile ID * * @return integer */ protected function correctProfileIdForURLParams($profileId) { if (!\XLite\Module\CDev\DrupalConnector\Handler::getInstance()->checkCurrentCMS()) { $profileId = parent::correctProfileIdForURLParams($profileId); } return $profileId; }