public function render(Varien_Object $row) { if (!$row->getEntityId()) { $row->setFirstname($this->__('Guest')); } echo $row->getFirstname(); }
/** * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { if ($row->getCustomerId()) { $name = $row->getFirstname() . ' ' . $row->getLastname(); $result = sprintf('<a href="%s">%s</a>', Mage::getUrl('adminhtml/customer/edit', array('id' => $row->getCustomerId())), $name); } else { $result = 'Guest'; } return $result; }
/** * 1)Called everytime the adyen_boleto is called or used in checkout * @descrition Assign data to info model instance * * @param mixed $data * @return Mage_Payment_Model_Info */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } // get delivery date $delivery_days = (int) $this->_getConfigData('delivery_days', 'adyen_boleto'); $delivery_days = !empty($delivery_days) ? $delivery_days : 5; $delivery_date = date("Y-m-d\\TH:i:s ", mktime(date("H"), date("i"), date("s"), date("m"), date("j") + $delivery_days, date("Y"))); $info = $this->getInfoInstance(); $boleto = array('firstname' => $data->getFirstname(), 'lastname' => $data->getLastname(), 'social_security_number' => $data->getSocialSecurityNumber(), 'selected_brand' => $data->getBoletoType(), 'delivery_date' => $delivery_date); $info = $this->getInfoInstance(); $info->setPoNumber(serialize($boleto)); $info->setCcType($data->getBoletoType()); return $this; }
/** * Get billing address request data * * @param Varien_Object $address * @return array */ protected function _getBillingAddress(Varien_Object $address) { $request = array('billing_first_name' => $address->getFirstname(), 'billing_last_name' => $address->getLastname(), 'billing_city' => $address->getCity(), 'billing_state' => $address->getRegion(), 'billing_zip' => $address->getPostcode(), 'billing_country' => $address->getCountry()); // convert streets to tow lines format $street = Mage::helper('customer/address')->convertStreetLines($address->getStreet(), 2); $request['billing_address1'] = isset($street[0]) ? $street[0] : ''; $request['billing_address2'] = isset($street[1]) ? $street[1] : ''; return $request; }
/** * Assigning shipping address to soap object * * @param Varien_Object $shipping */ protected function addShippingAddress($shipping) { //checking if we have shipping address, in case of virtual order we will not have it if ($shipping) { $shipTo = new stdClass(); $shipTo->firstName = $shipping->getFirstname(); $shipTo->lastName = $shipping->getLastname(); $shipTo->company = $shipping->getCompany(); $shipTo->street1 = $shipping->getStreet(1); $shipTo->street2 = $shipping->getStreet(2); $shipTo->city = $shipping->getCity(); $shipTo->state = $shipping->getRegion(); $shipTo->postalCode = $shipping->getPostcode(); $shipTo->country = $shipping->getCountry(); $shipTo->phoneNumber = $this->cleanPhoneNum($shipping->getTelephone()); $this->_request->shipTo = $shipTo; Mage::getSingleton('core/session')->setShipping($shipTo); } }
public function registerAction() { if (!Mage::helper('magenotification')->checkLicenseKeyFrontController($this)) { return; } $programId = $this->getRequest()->getParam('id'); $program = Mage::getModel('luckydraw/program')->load($programId); if (!$program->getId()) { return false; } if ($program->getStatus() != Magestore_Luckydraw_Model_Program::STATUS_PROCESSING) { return $this->responseErrorMessage($this->__('Cannot register for this program at this time!')); } $post = new Varien_Object($this->_filterDates($this->getRequest()->getPost(), array('dob'))); if ($this->_getConfigHelper()->getRegisterConfig('captcha')) { $captchaCode = $this->_getCoreSession()->getData('register_account_captcha_code_$programId'); if (!$captchaCode || $captchaCode != $post->getData('account_captcha')) { Mage::getSingleton('core/session')->addError($this->__('Please enter the correct captcha code!')); return false; } } $sessCus = Mage::getSingleton('customer/session')->getCustomer(); if ($sessCus && $sessCus->getId()) { if ($post->getCustomerId() != $sessCus->getId()) { return false; } $customer = Mage::getModel('luckydraw/customer')->load($sessCus->getId()); } else { $customer = Mage::getModel('luckydraw/customer'); } $customer->addData($post->getData())->setFirstname($post->getFirstname())->setLastname($post->getLastname()); $model = Mage::getModel('luckydraw/code'); $codes = $model->getCollectionByProgramEmail($program->getId(), $customer->getEmail()); if ($codes->count()) { Mage::getSingleton('core/session')->addError($this->__('You have played this program already!')); return false; } if ($this->_getConfigHelper()->getRegisterConfig('address')) { if ($post->getData('account_address_id')) { $model->setData('address_id', $post->getData('account_address_id')); } else { $address = Mage::getModel('customer/address')->setData($post->getData('account'))->setParentId($customer->getId())->setFirstname($customer->getFirstname())->setLastname($customer->getLastname())->setId(null); $customer->addAddress($address); $errors = $address->validate(); } } if (!isset($errors) || !is_array($errors)) { $errors = array(); } try { $validationCustomer = $customer->validate(); if (is_array($validationCustomer)) { $errors = array_merge($validationCustomer, $errors); } $validationResult = count($errors) == 0; if (true === $validationResult) { $customer->save(); if (isset($address) && !$address->getId()) { $address->save(); $model->setData('address_id', $address->getId()); } } else { foreach ($errors as $error) { Mage::getSingleton('core/session')->addError($error); } Mage::getSingleton('core/session')->setRegisterLuckydraw($post->getData()); return false; } } catch (Exception $e) { Mage::getSingleton('core/session')->addError($e->getMessage()); Mage::getSingleton('core/session')->setRegisterLuckydraw($post->getData()); return false; } $model->setData('program_id', $programId)->setData('customer_id', $customer->getId())->setData('email', $customer->getEmail())->setData('name', $customer->getName())->setData('created_time', now())->setData('credit_rate', $program->getData('credit_rate')); if ($code = $this->_getCodeReferrer($programId)) { $model->setData('refer_user', $code->getData('customer_id'))->setData('refer_email', $code->getData('email')); } $codeStatus = Magestore_Luckydraw_Model_Code::STATUS_INACTIVE; $needSendActiveEmail = true; if ($sessCus && $sessCus->getId()) { if (!$this->_getConfigHelper()->getRegisterConfig('verify')) { $codeStatus = Magestore_Luckydraw_Model_Code::STATUS_PENDING; $needSendActiveEmail = false; } } else { if ($customer->isConfirmationRequired()) { $customer->sendNewAccountEmail('confirmation', $this->_getReferrerUrl(), Mage::app()->getStore()->getId()); Mage::getSingleton('core/session')->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()))); $needSendActiveEmail = false; } else { $customer->sendNewAccountEmail('registered', $this->_getReferrerUrl(), Mage::app()->getStore()->getId()); Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer); if (!$this->_getConfigHelper()->getRegisterConfig('verify')) { $codeStatus = Magestore_Luckydraw_Model_Code::STATUS_PENDING; $needSendActiveEmail = false; } } } $model->setData('status', $codeStatus); try { $model->setData('program', $program)->save(); if ($needSendActiveEmail) { $model->sendActiveEmail(); Mage::getSingleton('core/session')->addSuccess($this->__('Draw code confirmation is required. Please check your email for the confirmation link. To resend the confirmation email, please <a href="%s">click here</a>.', Mage::getUrl('*/*/resend', array('id' => $programId, 'code' => $model->getDrawCode())))); Mage::getSingleton('customer/session')->setLuckycode($model->getData('draw_code')); } elseif ($codeStatus == Magestore_Luckydraw_Model_Code::STATUS_PENDING) { $model->sendRegisterEmail(); Mage::getSingleton('customer/session')->setLuckycode($model->getData('draw_code')); } } catch (Exception $e) { Mage::getSingleton('core/session')->addError($e->getMessage()); } }
/** * Returns current customer * @return Varien_Object */ public function getCustomer() { if ($this->getCustomerId()) { return Mage::getModel('customer/customer')->load($this->getCustomerId()); } else { $data = $this->getQuote()->getBillingAddress()->getData(); $customer = new Varien_Object(); foreach ($data as $k => $v) { $customer->setData($k, $v); } $customer->setName($customer->getFirstname() . ' ' . $customer->getLastname()); return $customer; } }
/** * Create new AccessCode * @param Varien_Object $billing * @param Varien_Object $infoInstance * @param string $method * @param null $request * @return Eway_Rapid31_Model_Response */ public function createAccessCode(Varien_Object $billing, Varien_Object $infoInstance, $method = 'AccessCodes', $request = null) { // Empty Varien_Object's data $tokenCustomerID = $request->get('TokenCustomerID'); $this->unsetData(); $customerParam = Mage::getModel('ewayrapid/field_customer'); $customerParam->setTokenCustomerID($tokenCustomerID)->setTitle($billing->getPrefix())->setFirstName($billing->getFirstname())->setLastName($billing->getLastname())->setCompanyName($billing->getCompany())->setJobDescription($billing->getJobDescription())->setStreet1($billing->getStreet1())->setStreet2($billing->getStreet2())->setCity($billing->getCity())->setState($billing->getRegion())->setPostalCode($billing->getPostcode())->setCountry(strtolower($billing->getCountryModel()->getIso2Code()))->setEmail($billing->getEmail())->setPhone($billing->getTelephone())->setMobile($billing->getMobile())->setComments('')->setFax($billing->getFax())->setUrl(''); $returnUrl = Mage::getBaseUrl() . '/ewayrapid/mycards/saveToken?ccType=' . $infoInstance->getCcType() . '&expYear=' . $infoInstance->getCcExpYear(); if ($request->get('is_default') == 'on') { $returnUrl .= '&is_default=on'; } if ($infoInstance->getCcStartMonth()) { $returnUrl .= '&startMonth=' . $infoInstance->getCcStartMonth(); } if ($infoInstance->getCcStartYear()) { $returnUrl .= '&startYear=' . $infoInstance->getCcStartYear(); } if ($infoInstance->getCcIssueNumber()) { $returnUrl .= '&issueNumber=' . $infoInstance->getCcIssueNumber(); } // Binding address on url param $returnUrl .= '&street1=' . base64_encode($billing->getStreet1()) . '&street2=' . base64_encode($billing->getStreet2()); $tokenId = $request->get('token_id'); if (!empty($tokenId)) { // ID token customer will be defined to update $returnUrl = $returnUrl . '&token_id=' . $tokenId; } $this->setCustomer($customerParam); $this->setRedirectUrl($returnUrl); $this->setCancelUrl($returnUrl); $this->setMethod(!empty($tokenCustomerID) ? 'UpdateTokenCustomer' : 'CreateTokenCustomer'); $this->setCustomerIP($_SERVER["REMOTE_ADDR"]); $this->setDeviceID(''); $this->setTransactionType("Purchase"); $this->setCustomerReadOnly(true); // Create new access code //$formMethod = !empty($tokenCustomerID) ? 'PUT' : 'POST'; $response = $this->_doRapidAPI($method); return $response; }
public function render(Varien_Object $row) { $adminname = $row->getFirstname() . ' ' . $row->getLastname(); return $adminname; }