本文整理汇总了PHP中Mage_Sales_Model_Order::getCustomerGender方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCustomerGender方法的具体用法?PHP Mage_Sales_Model_Order::getCustomerGender怎么用?PHP Mage_Sales_Model_Order::getCustomerGender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getCustomerGender方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCustomerData
/**
* @return array
*/
protected function _prepareCustomerData()
{
$customer_id = null;
$customer = null;
$customer_log = null;
$billing_address = $this->_order->getBillingAddress();
$customer_verified = false;
$customer_orders_count = 0;
$gender = $this->_order->getCustomerGender();
if (!$this->_order->getCustomerIsGuest()) {
$customer_id = $this->_order->getCustomerId();
if ($customer_id) {
/** @var Mage_Customer_Model_Customer $customer */
$customer = Mage::getModel("customer/customer");
$customer->load($customer_id);
/** @var Mage_Log_Model_Customer $customer_log */
$customer_log = Mage::getModel('log/customer')->load($customer_id);
}
$customer_verified = $this->getCustomerIsConfirmedStatus($customer);
$orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer_id);
/** @noinspection PhpUndefinedMethodInspection */
$customer_orders_count = $orders->count();
}
$data = array_filter(array('customer_id' => $customer_id, 'customer_is_guest' => $this->_order->getCustomerIsGuest(), 'verified' => $customer_verified, 'language_code' => $this->_language_code, 'last_login_on' => $customer_log ? $customer_log->getLoginAt() : null, 'created_on' => $customer ? $customer->getData('created_at') : null, 'updated_on' => $customer ? $customer->getData('updated_at') : null, 'birthdate' => $this->_order->getCustomerDob(), 'email' => $this->_order->getCustomerEmail(), 'title' => '', 'prefix' => $this->_order->getCustomerPrefix(), 'suffix' => $this->_order->getCustomerSuffix(), 'first_name' => $this->_order->getCustomerFirstname(), 'middle_name' => $this->_order->getCustomerMiddlename(), 'last_name' => $this->_order->getCustomerLastname(), 'company_name' => $billing_address ? $billing_address->getCompany() : null, 'gender' => $gender == 1 ? 'male' : ($gender == 2 ? 'female' : null), 'telephone1' => $billing_address ? $billing_address->getTelephone() : null, 'telephone2' => '', 'telephone3' => '', 'fax' => $billing_address ? $billing_address->getFax() : null, 'vat_number' => $this->_order->getCustomerTaxvat(), 'reg_ip_address' => '', 'customer_orders_count' => $customer_orders_count));
return $data;
}
示例2: _getCustomerGenderLabel
/**
* get the label for the customer's gender
* @param Mage_Sales_Model_Order
* @return string
*/
protected function _getCustomerGenderLabel(Mage_Sales_Model_Order $order)
{
$customerGenderLabel = null;
// get the label for the customer's gender and use the filtered mapping to
// get the ROM equivalent.
$optionId = $order->getCustomerGender();
foreach ($this->_getGenderOptions() as $option) {
if ($option['value'] === $optionId) {
$customerGenderLabel = $option['label'];
break;
}
}
return $customerGenderLabel;
}
示例3: getGenderCode
/**
* This method returns the customer gender code
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote
* @return string
*/
public function getGenderCode($quote)
{
$gender = $quote->getCustomerGender();
if ($gender) {
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('customer', 'gender');
$option = $attribute->getFrontend()->getOption($gender);
switch (strtolower($option)) {
case 'male':
return 'M';
case 'female':
return 'F';
}
}
$gender = $quote->getCustomerPrefix();
if ($gender) {
switch (strtolower($gender)) {
case 'herr':
case 'mr':
return 'M';
case 'frau':
case 'mrs':
return 'F';
}
}
return 'U';
}
示例4: getGender
/**
* get gender text for customer
*
* @param Mage_Sales_Model_Order $order
*/
public function getGender(Mage_Sales_Model_Order $order)
{
$gender = Mage::getSingleton('eav/config')->getAttribute('customer', 'gender')->getSource()->getOptionText($order->getCustomerGender());
return $gender;
}
示例5: CreateMagentoShopRequestOrder
function CreateMagentoShopRequestOrder(Mage_Sales_Model_Order $order, $paymentmethod)
{
$request = new Byjuno_Cdp_Helper_Api_Classes_ByjunoRequest();
$request->setClientId(Mage::getStoreConfig('payment/cdp/clientid', Mage::app()->getStore()));
$request->setUserID(Mage::getStoreConfig('payment/cdp/userid', Mage::app()->getStore()));
$request->setPassword(Mage::getStoreConfig('payment/cdp/password', Mage::app()->getStore()));
$request->setVersion("1.00");
try {
$request->setRequestEmail(Mage::getStoreConfig('payment/cdp/mail', Mage::app()->getStore()));
} catch (Exception $e) {
}
$b = $order->getCustomerDob();
if (!empty($b)) {
$request->setDateOfBirth(Mage::getModel('core/date')->date('Y-m-d', strtotime($b)));
}
$g = $order->getCustomerGender();
if (!empty($g)) {
if ($g == '1') {
$request->setGender('1');
} else {
if ($g == '2') {
$request->setGender('2');
}
}
}
$requestId = uniqid((string) $order->getBillingAddress()->getId() . "_");
$request->setRequestId($requestId);
$reference = $order->getCustomerId();
if (empty($reference)) {
$request->setCustomerReference("guest_" . $order->getBillingAddress()->getId());
} else {
$request->setCustomerReference($order->getCustomerId());
}
$request->setFirstName((string) $order->getBillingAddress()->getFirstname());
$request->setLastName((string) $order->getBillingAddress()->getLastname());
$request->setFirstLine(trim((string) $order->getBillingAddress()->getStreetFull()));
$request->setCountryCode(strtoupper((string) $order->getBillingAddress()->getCountry()));
$request->setPostCode((string) $order->getBillingAddress()->getPostcode());
$request->setTown((string) $order->getBillingAddress()->getCity());
$request->setFax((string) trim($order->getBillingAddress()->getFax(), '-'));
$request->setLanguage((string) substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
if ($order->getBillingAddress()->getCompany()) {
$request->setCompanyName1($order->getBillingAddress()->getCompany());
}
$request->setTelephonePrivate((string) trim($order->getBillingAddress()->getTelephone(), '-'));
$request->setEmail((string) $order->getBillingAddress()->getEmail());
$extraInfo["Name"] = 'ORDERCLOSED';
$extraInfo["Value"] = 'NO';
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'ORDERAMOUNT';
$extraInfo["Value"] = number_format($order->getGrandTotal(), 2, '.', '');
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'ORDERCURRENCY';
$extraInfo["Value"] = $order->getBaseCurrencyCode();
$request->setExtraInfo($extraInfo);
/* shipping information */
if ($order->canShip()) {
$extraInfo["Name"] = 'DELIVERY_FIRSTNAME';
$extraInfo["Value"] = $order->getShippingAddress()->getFirstname();
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'DELIVERY_LASTNAME';
$extraInfo["Value"] = $order->getShippingAddress()->getLastname();
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'DELIVERY_FIRSTLINE';
$extraInfo["Value"] = trim($order->getShippingAddress()->getStreetFull());
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'DELIVERY_HOUSENUMBER';
$extraInfo["Value"] = '';
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'DELIVERY_COUNTRYCODE';
$extraInfo["Value"] = strtoupper($order->getShippingAddress()->getCountry());
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'DELIVERY_POSTCODE';
$extraInfo["Value"] = $order->getShippingAddress()->getPostcode();
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'DELIVERY_TOWN';
$extraInfo["Value"] = $order->getShippingAddress()->getCity();
$request->setExtraInfo($extraInfo);
if ($order->getShippingAddress()->getCompany() != '' && Mage::getStoreConfig('payment/api/businesstobusiness', Mage::app()->getStore()) == 'enable') {
$extraInfo["Name"] = 'DELIVERY_COMPANYNAME';
$extraInfo["Value"] = $order->getShippingAddress()->getCompany();
$request->setExtraInfo($extraInfo);
}
}
$extraInfo["Name"] = 'PP_TRANSACTION_NUMBER';
$extraInfo["Value"] = $requestId;
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'ORDERID';
$extraInfo["Value"] = $order->getIncrementId();
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'PAYMENTMETHOD';
$extraInfo["Value"] = 'BYJUNO-INVOICE';
$request->setExtraInfo($extraInfo);
$extraInfo["Name"] = 'CONNECTIVTY_MODULE';
$extraInfo["Value"] = 'Byjuno Magento module 1.0.0';
$request->setExtraInfo($extraInfo);
return $request;
}
示例6: getGender
/**
* This method returns the customer gender code
*
* @param Mage_Sales_Model_Order $order
* @return string
*/
public function getGender(Mage_Sales_Model_Order $order)
{
$gender = $order->getCustomerGender();
if ($gender) {
$attribute = Mage::getModel('eav/entity_attribute')->loadByCode('customer', 'gender');
$option = $attribute->getFrontend()->getOption($gender);
switch (strtolower($option)) {
case 'male':
return 'M';
case 'female':
return 'F';
}
}
return '';
}