/** * Here we insert the translations of the field labels. * * Registered users don't have to insert their data, they only get the * option to subscribe to or unsubscribe from the newsletter. * * @return void * * @author Sebastian Diel <*****@*****.**>, * Sascha Koehler <*****@*****.**> * @since 23.04.2014 */ protected function fillInFieldValues() { parent::fillInFieldValues(); $member = SilvercartCustomer::currentRegisteredCustomer(); $this->clearSessionMessages(); // Set translations $this->formFields['Salutation']['value'] = array('' => _t('SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE'), "Frau" => _t('SilvercartAddress.MISSES'), "Herr" => _t('SilvercartAddress.MISTER')); $this->formFields['Salutation']['title'] = _t('SilvercartAddress.SALUTATION'); $this->formFields['FirstName']['title'] = _t('SilvercartAddress.FIRSTNAME', 'firstname'); $this->formFields['Surname']['title'] = _t('SilvercartAddress.SURNAME'); $this->formFields['Email']['title'] = _t('SilvercartAddress.EMAIL', 'email address'); $this->formFields['NewsletterAction']['title'] = _t('SilvercartNewsletterForm.ACTIONFIELD_TITLE'); $this->formFields['NewsletterAction']['value']['1'] = _t('SilvercartNewsletterForm.ACTIONFIELD_SUBSCRIBE'); $this->formFields['NewsletterAction']['value']['2'] = _t('SilvercartNewsletterForm.ACTIONFIELD_UNSUBSCRIBE'); $this->preferences['submitButtonTitle'] = _t('SilvercartPage.SUBMIT'); // Fill in field values for registered customers and set them to readonly. if ($member) { $this->formFields['Salutation']['checkRequirements'] = array(); $this->formFields['Salutation']['type'] = 'ReadonlyField'; $this->formFields['Salutation']['value'] = $member->Salutation; $this->formFields['FirstName']['checkRequirements'] = array(); $this->formFields['FirstName']['type'] = 'ReadonlyField'; $this->formFields['FirstName']['value'] = $member->FirstName; $this->formFields['Surname']['checkRequirements'] = array(); $this->formFields['Surname']['type'] = 'ReadonlyField'; $this->formFields['Surname']['value'] = $member->Surname; $this->formFields['Email']['checkRequirements'] = array(); $this->formFields['Email']['type'] = 'ReadonlyField'; $this->formFields['Email']['value'] = $member->Email; // Remove action field according to newsletter status of the customer if ($member->SubscribedToNewsletter) { $this->formFields['NewsletterAction']['value'] = array('2' => _t('SilvercartNewsletterForm.ACTIONFIELD_UNSUBSCRIBE')); $this->formFields['NewsletterAction']['title'] = _t('SilvercartNewsletter.SUBSCRIBED') . ' - ' . $this->formFields['NewsletterAction']['title']; } else { $this->formFields['NewsletterAction']['value'] = array('1' => _t('SilvercartNewsletterForm.ACTIONFIELD_SUBSCRIBE')); $this->formFields['NewsletterAction']['title'] = _t('SilvercartNewsletter.UNSUBSCRIBED') . ' - ' . $this->formFields['NewsletterAction']['title']; } } }
/** * Fills in the field values * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 11.03.2013 */ protected function fillInFieldValues() { parent::fillInFieldValues(); if ($this->getProduct()->isInCart()) { $this->formFields['productQuantity']['value'] = $this->getProduct()->getQuantityInCart(); } }
/** * Set initial values in form fields * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 11.04.2014 */ protected function fillInFieldValues() { parent::fillInFieldValues(); }