/** * Fill the form with default values * * @return void * * @author Sebastian Diel <*****@*****.**>, * Roland Lehmann <*****@*****.**> * @since 15.11.2014 */ protected function fillInFieldValues() { $member = SilvercartCustomer::currentUser(); $id = $this->customParameters['addressID']; if ($member && $id) { $filter = array("MemberID" => $member->ID, "ID" => $id); $this->address = SilvercartAddress::get()->filter($filter)->first(); if ($this->address) { $this->formFields['Salutation']['selectedValue'] = $this->address->Salutation; $this->formFields['AcademicTitle']['value'] = $this->address->AcademicTitle; $this->formFields['FirstName']['value'] = $this->address->FirstName; $this->formFields['Surname']['value'] = $this->address->Surname; $this->formFields['Addition']['value'] = $this->address->Addition; $this->formFields['Street']['value'] = $this->address->Street; $this->formFields['StreetNumber']['value'] = $this->address->StreetNumber; $this->formFields['Postcode']['value'] = $this->address->Postcode; $this->formFields['City']['value'] = $this->address->City; $this->formFields['PhoneAreaCode']['value'] = $this->address->PhoneAreaCode; $this->formFields['Phone']['value'] = $this->address->Phone; $this->formFields['Fax']['value'] = $this->address->Fax; $this->formFields['Country']['selectedValue'] = $this->address->SilvercartCountry()->ID; if (SilvercartConfig::enablePackstation()) { $this->formFields['PostNumber']['value'] = $this->address->PostNumber; $this->formFields['Packstation']['value'] = $this->address->Packstation; $this->formFields['IsPackstation']['selectedValue'] = $this->address->IsPackstation; } if (SilvercartConfig::enableBusinessCustomers()) { $this->formFields['Company']['value'] = $this->address->Company; $this->formFields['TaxIdNumber']['value'] = $this->address->TaxIdNumber; } } } }
/** * Indicates wether business customers should be enabled. * * @return boolean * * @author Sebastian Diel <*****@*****.**>, * Sascha Koehler <*****@*****.**> * @since 14.04.2015 */ public function EnableBusinessCustomers() { $enableBusinessCustomers = false; $customer = $this->getCustomer(); if (SilvercartConfig::enableBusinessCustomers() || $customer instanceof Member && $customer->isB2BCustomer()) { $enableBusinessCustomers = true; } return $enableBusinessCustomers; }
/** * Indicates wether the registration fields specific to business customers * should be shown. * * @return boolean * * @author Sascha Koehler <*****@*****.**> * @since 22.12.2011 */ public function EnableBusinessCustomers() { return SilvercartConfig::enableBusinessCustomers(); }
/** * Returns wether to enable business customers or not. * * @return boolean * * @author Sascha Koehler <*****@*****.**> * @since 22.12.2011 */ public static function enableBusinessCustomers() { if (is_null(self::$enableBusinessCustomers)) { self::$enableBusinessCustomers = self::getConfig()->enableBusinessCustomers; } return self::$enableBusinessCustomers; }