本文整理汇总了PHP中Mage_Sales_Model_Quote::getCustomerDob方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getCustomerDob方法的具体用法?PHP Mage_Sales_Model_Quote::getCustomerDob怎么用?PHP Mage_Sales_Model_Quote::getCustomerDob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getCustomerDob方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertBirthdate
/**
* add birthdate to params list, if it is available
*
* @param Mage_Sales_Model_Quote $quote Quote
* @return array Either empty or with birthdate
*/
public function convertBirthdate($quote)
{
if (is_null($quote->getCustomerDob())) {
return array();
}
return array('GEBURTSDATUM' => Mage::getModel('core/date')->date('d.m.Y', $quote->getCustomerDob()));
}
示例2: _buildParams
/**
* @param Mage_Sales_Model_Quote $quote
* @return array
*/
protected function _buildParams($quote)
{
$billingAddress = $quote->getBillingAddress();
$gender = 'female';
if ($quote->getCustomerGender() == self::GENDER_MALE) {
$gender = 'male';
}
$street = preg_split("/\\s+(?=\\S*+\$)/", $billingAddress->getStreet1());
$params = array('gender' => $gender, 'firstname' => $billingAddress->getFirstname(), 'lastname' => $billingAddress->getLastname(), 'country' => $billingAddress->getCountry(), 'street' => $street[0], 'housenumber' => $street[1], 'zip' => $billingAddress->getPostcode(), 'city' => $billingAddress->getCity(), 'birthday' => $this->_formatDob($quote->getCustomerDob()), 'currency' => 'EUR', 'amount' => $this->_formatAmount($quote->getGrandTotal()));
return $params;
}
示例3: isAvailable
/**
* Open Invoice NL is not available if quote has a coupon
*
* @param Mage_Sales_Model_Quote $quote
* @return boolean
*/
public function isAvailable($quote = null)
{
/* availability depends on quote */
if (false == $quote instanceof Mage_Sales_Model_Quote) {
return false;
}
/* not available if there is no gender or no birthday */
if (is_null($quote->getCustomerGender()) || is_null($quote->getCustomerDob())) {
return false;
}
return parent::isAvailable($quote);
}
示例4: isAvailable
/**
* Open Invoice DE is not available if quote has a coupon
*
* @param Mage_Sales_Model_Quote $quote
* @return boolean
*/
public function isAvailable($quote = null)
{
/* availability depends on quote */
if (false == $quote instanceof Mage_Sales_Model_Quote) {
return false;
}
/* not available if quote contains a coupon and allow_discounted_carts is disabled */
if (!$this->isAvailableForDiscountedCarts() && $quote->getSubtotal() != $quote->getSubtotalWithDiscount()) {
return false;
}
/* not available if there is no gender or no birthday */
if (is_null($quote->getCustomerGender()) || is_null($quote->getCustomerDob())) {
return false;
}
return parent::isAvailable($quote);
}
示例5: getDob
/**
* Gets the Day of Birth from the Quote or Order if guest, else from the customer
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote
* @return String
*/
public function getDob($quote)
{
return $quote->getCustomerDob();
}
示例6: _isAvailableRatePay
/**
* @param Mage_Sales_Model_Quote $quote
*
* @return bool
*/
protected function _isAvailableRatePay($quote)
{
$currencies = explode(',', $this->getConfigData('currencies'));
if (!in_array($quote->getQuoteCurrencyCode(), $currencies)) {
return false;
}
$dob = $quote->getCustomerDob();
$minAge = (int) $this->getConfigData('min_age');
//we only need to check the dob if it's set. Else we ask for dob on payment selection page.
if ($dob) {
$dobObject = new DateTime($dob);
$currentYear = date('Y');
$currentMonth = date('m');
$currentDay = date('d');
$ageCheckDate = $currentYear - $minAge . '-' . $currentMonth . '-' . $currentDay;
$ageCheckObject = new DateTime($ageCheckDate);
if ($ageCheckObject < $dobObject) {
return false;
}
}
if ($quote->hasVirtualItems()) {
return false;
}
if (!$this->compareAddresses($quote)) {
return false;
}
return parent::isAvailable($quote);
}
示例7: getRequestCustomer
/**
* Gets all needed Informations for customer Block of the Request
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quoteOrOrder
* @return array
*/
public function getRequestCustomer($quoteOrOrder)
{
$customer = array();
$contacts = array();
$billing = array();
$shipping = array();
$dob = new Zend_Date($quoteOrOrder->getCustomerDob());
$customer['dob'] = $dob->toString("yyyy-MM-dd");
$customer['gender'] = $this->getHelper()->getGenderCode($quoteOrOrder);
$customer['firstName'] = $quoteOrOrder->getBillingAddress()->getFirstname();
$customer['lastName'] = $quoteOrOrder->getBillingAddress()->getLastname();
$customer['ip'] = Mage::helper('core/http')->getRemoteAddr(false);
$customer['nationality'] = $quoteOrOrder->getBillingAddress()->getCountryId();
$customer['company'] = $quoteOrOrder->getBillingAddress()->getCompany();
$customer['vatId'] = $quoteOrOrder->getCustomerTaxvat();
$contacts['email'] = $quoteOrOrder->getCustomerEmail();
$contacts['phone'] = $quoteOrOrder->getBillingAddress()->getTelephone();
if ($quoteOrOrder->getBillingAddress()->getFax() != '') {
$contacts['fax'] = $quoteOrOrder->getBillingAddress()->getFax();
}
// Different handling of street fields in case of NL orders
$billingStreetFull = $quoteOrOrder->getBillingAddress()->getStreetFull();
$billingStreet1 = $quoteOrOrder->getBillingAddress()->getStreet1();
$billingStreet2 = $quoteOrOrder->getBillingAddress()->getStreet2();
if ($quoteOrOrder->getBillingAddress()->getCountryId() == "NL" && !empty($billingStreet2)) {
$billing['street'] = $billingStreet1;
$billing['streetAdditional'] = $billingStreet2;
} else {
$billing['street'] = preg_replace('~[\\r\\n]+~', ' ', $billingStreetFull);
}
$billing['zipCode'] = $quoteOrOrder->getBillingAddress()->getPostcode();
$billing['city'] = $quoteOrOrder->getBillingAddress()->getCity();
$billing['countryId'] = $quoteOrOrder->getBillingAddress()->getCountryId();
$shipping['firstName'] = $quoteOrOrder->getShippingAddress()->getFirstname();
$shipping['lastName'] = $quoteOrOrder->getShippingAddress()->getLastname();
// Different handling of street fields in case of NL orders
$shippingStreetFull = $quoteOrOrder->getShippingAddress()->getStreetFull();
$shippingStreet1 = $quoteOrOrder->getShippingAddress()->getStreet1();
$shippingStreet2 = $quoteOrOrder->getShippingAddress()->getStreet2();
if ($quoteOrOrder->getShippingAddress()->getCountryId() == "NL" && !empty($shippingStreet2)) {
$shipping['street'] = $shippingStreet1;
$shipping['streetAdditional'] = $shippingStreet2;
} else {
$shipping['street'] = preg_replace('~[\\r\\n]+~', ' ', $shippingStreetFull);
}
$shipping['zipCode'] = $quoteOrOrder->getShippingAddress()->getPostcode();
$shipping['city'] = $quoteOrOrder->getShippingAddress()->getCity();
$shipping['countryId'] = $quoteOrOrder->getShippingAddress()->getCountryId();
if ($quoteOrOrder->getShippingAddress()->getCompany()) {
$shipping['company'] = $quoteOrOrder->getShippingAddress()->getCompany();
}
$customer['contacts'] = $contacts;
$customer['billing'] = $billing;
$customer['shipping'] = $shipping;
return $customer;
}
示例8: CreateMagentoShopRequest
function CreateMagentoShopRequest(Mage_Sales_Model_Quote $quote)
{
$request = new Byjuno_Cdp_Helper_Api_Classes_ByjunoRequest();
$request->setClientId(Mage::getStoreConfig('byjuno/api/clientid', Mage::app()->getStore()));
$request->setUserID(Mage::getStoreConfig('byjuno/api/userid', Mage::app()->getStore()));
$request->setPassword(Mage::getStoreConfig('byjuno/api/password', Mage::app()->getStore()));
$request->setVersion("1.00");
try {
$request->setRequestEmail(Mage::getStoreConfig('byjuno/api/mail', Mage::app()->getStore()));
} catch (Exception $e) {
}
$b = $quote->getCustomerDob();
if (!empty($b)) {
$request->setDateOfBirth(Mage::getModel('core/date')->date('Y-m-d', strtotime($b)));
}
Mage::getSingleton('checkout/session')->setData('dob_amasty', '');
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["dob"])) {
$request->setDateOfBirth(Mage::getModel('core/date')->date('Y-m-d', strtotime($_POST["billing"]["dob"])));
Mage::getSingleton('checkout/session')->setData('dob_amasty', $_POST["billing"]["dob"]);
}
$g = $quote->getCustomerGender();
if (!empty($g)) {
if ($g == '1') {
$request->setGender('1');
} else {
if ($g == '2') {
$request->setGender('2');
}
}
}
$request->setRequestId(uniqid((string) $quote->getBillingAddress()->getId() . "_"));
$reference = $quote->getCustomer()->getId();
if (empty($reference)) {
$request->setCustomerReference("guest_" . $quote->getBillingAddress()->getId());
} else {
$request->setCustomerReference($quote->getCustomer()->getId());
}
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["method"]) && $_POST["method"] == 'guest') {
$request->setCustomerReference(uniqid("guest_"));
}
$request->setFirstName((string) $quote->getBillingAddress()->getFirstname());
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["firstname"])) {
$request->setFirstName((string) $_POST["billing"]["firstname"]);
}
$request->setLastName((string) $quote->getBillingAddress()->getLastname());
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["lastname"])) {
$request->setLastName((string) $_POST["billing"]["lastname"]);
}
$request->setFirstLine(trim((string) $quote->getBillingAddress()->getStreetFull()));
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["street"])) {
$street = '';
if (!empty($_POST["billing"]["street"][0])) {
$street .= $_POST["billing"]["street"][0];
}
if (!empty($_POST["billing"]["street"][1])) {
$street .= $_POST["billing"]["street"][1];
}
$request->setFirstLine((string) trim($street));
}
$request->setCountryCode(strtoupper((string) $quote->getBillingAddress()->getCountry()));
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["country_id"])) {
$request->setCountryCode((string) $_POST["billing"]["country_id"]);
}
$request->setPostCode((string) $quote->getBillingAddress()->getPostcode());
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["postcode"])) {
$request->setPostCode($_POST["billing"]["postcode"]);
}
$request->setTown((string) $quote->getBillingAddress()->getCity());
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["city"])) {
$request->setTown($_POST["billing"]["city"]);
}
$request->setFax((string) trim($quote->getBillingAddress()->getFax(), '-'));
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["fax"])) {
$request->setFax(trim($_POST["billing"]["fax"], '-'));
}
$request->setLanguage((string) substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
if ($quote->getBillingAddress()->getCompany()) {
$request->setCompanyName1($quote->getBillingAddress()->getCompany());
}
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["company"])) {
$request->setCompanyName1(trim($_POST["billing"]["company"], '-'));
}
$request->setTelephonePrivate((string) trim($quote->getBillingAddress()->getTelephone(), '-'));
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["telephone"])) {
$request->setTelephonePrivate(trim($_POST["billing"]["telephone"], '-'));
}
$request->setEmail((string) $quote->getBillingAddress()->getEmail());
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["email"])) {
$request->setEmail((string) $_POST["billing"]["email"]);
}
Mage::getSingleton('checkout/session')->setData('gender_amasty', '');
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty') {
$g = isset($_POST["billing"]["gender"]) ? $_POST["billing"]["gender"] : '';
$request->setGender($g);
Mage::getSingleton('checkout/session')->setData('gender_amasty', $g);
}
if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["prefix"])) {
if (strtolower($_POST["billing"]["prefix"]) == 'herr') {
$request->setGender('1');
Mage::getSingleton('checkout/session')->setData('gender_amasty', '1');
//.........这里部分代码省略.........