本文整理汇总了PHP中Mage_Sales_Model_Order::getCustomerId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCustomerId方法的具体用法?PHP Mage_Sales_Model_Order::getCustomerId怎么用?PHP Mage_Sales_Model_Order::getCustomerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getCustomerId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _canViewOrder
/**
* Check order view availability
*
* @param Mage_Sales_Model_Order $order
* @return bool
*/
protected function _canViewOrder($order)
{
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
if ($order->getId() && $order->getCustomerId() && $order->getCustomerId() == $customerId) {
return true;
}
return false;
}
示例2: _canViewOrder
/**
* Check order view availability
*
* @param Mage_Sales_Model_Order $order
* @return bool
*/
protected function _canViewOrder($order)
{
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
$availableStates = Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates();
if ($order->getId() && $order->getCustomerId() && $order->getCustomerId() == $customerId && in_array($order->getState(), $availableStates, $strict = true)) {
return true;
}
return false;
}
示例3: order
/**
* Retrieve the meta data for an order
* Usage by listrakRemarketingOrderList and listrakRemarketingOrderStatusList API calls
*
* @return array['meta1', 'meta2', 'meta3', 'meta4', 'meta5'] or null
*/
public function order($storeId, Mage_Sales_Model_Order $order)
{
if ($order->getCustomerId()) {
$customer = Mage::getModel("customer/customer")->load($order->getCustomerId());
if ($customer) {
return array('meta1' => $this->_getAttributeValue($customer, 'subscription_end_date'), 'meta2' => $this->_getAttributeValue($customer, 'registered_machine'));
}
}
return array();
}
示例4: isOrderEditable
/**
* Returns true if order may be edited by currently logged in customer
*
* @param Mage_Sales_Model_Order $order
* @return boolean
*/
public function isOrderEditable(Mage_Sales_Model_Order $order)
{
if (!$order->getCustomerId()) {
return false;
}
if (Mage::getSingleton('customer/session')->getCustomerId() != $order->getCustomerId()) {
return false;
}
$allowedStates = explode(',', Mage::getStoreConfig('sales/editcustomoptions/allowed_order_state'));
return in_array($order->getState(), $allowedStates);
}
示例5: _sendEmail
/**
* @param Mage_Sales_Model_Order $order
* @throws Mage_Core_Exception
*/
protected function _sendEmail(Mage_Sales_Model_Order $order)
{
// Send email
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
/** @var Mage_Core_Helper_Data $helper */
$helper = Mage::helper('core');
$loginUrl = Mage::getUrl('ho_customer/account/login', array('encryption' => $helper->getEncryptor()->encrypt($order->getCustomerId()), 'forward_url' => base64_encode(Mage::getUrl('ho_customer/account/completeProfile'))));
/** @var Mage_Core_Model_Email_Template $emailTemplate */
$emailTemplate = Mage::getModel('core/email_template');
$emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()))->sendTransactional($this->getConfig()->getEmailTemplate($order->getStoreId()), $this->getConfig()->getEmailSender($order->getStoreId()), $order->getCustomerEmail(), $order->getCustomerName(), array('order' => $order, 'login_url' => $loginUrl));
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
$customer->setData('complete_profile_sent', true)->getResource()->saveAttribute($customer, 'complete_profile_sent');
$translate->setTranslateInline(true);
}
示例6: hookToOrderSaveEvent
public function hookToOrderSaveEvent()
{
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
//Fetch the data from select box and throw it here
$_heared4us_data = null;
$_heared4us_data = Mage::getSingleton('core/session')->getInchooHeared4us();
//Save fhc id to order obcject
$order->setData(self::ORDER_ATTRIBUTE_FHC_ID, $_heared4us_data);
$order->setData("affiliate_sale_type", $_heared4us_data);
$order->save();
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "UPDATE sales_flat_order_grid SET affiliate_sale_type = {$_heared4us_data} WHERE entity_id = '{$order->getEntityId()}'";
$write->query($sql);
if ($_heared4us_data != 3) {
$entity = $order->getEntityId();
$customer_id = $order->getCustomerId();
$expired = Mage::getModel('affiliate/affiliateexpired')->load($customer_id)->getData();
$historic = '[{"order":"' . $entity . '"}]';
$today = date("Y-m-d 23:59:59");
$expired_date = new DateTime($today);
$interval = new DateInterval('P1M');
$expired_date->add($interval);
$final = $expired_date->format('Y-m-d h:i:s');
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
if ($expired) {
$sql = "UPDATE mw_affiliate_expired SET historic='{$historic}', expired_package = '{$final}' WHERE customer_id = '{$customer_id}'";
} else {
$sql = "INSERT INTO mw_affiliate_expired VALUES({$customer_id}, '{$final}', NULL, '{$historic}')";
}
$write->query($sql);
}
}
示例7: checkRelation
public function checkRelation(Mage_Sales_Model_Order $order)
{
/**
* Check customer existing
*/
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
if (!$customer->getId()) {
$this->_getSession()->addNotice(Mage::helper('adminhtml')->__(' The customer does not exist in the system anymore.'));
}
/**
* Check Item products existing
*/
$productIds = array();
foreach ($order->getAllItems() as $item) {
$productIds[] = $item->getProductId();
}
$productCollection = Mage::getModel('catalog/product')->getCollection()->addIdFilter($productIds)->load();
$hasBadItems = false;
foreach ($order->getAllItems() as $item) {
if (!$productCollection->getItemById($item->getProductId())) {
$this->_getSession()->addError(Mage::helper('adminhtml')->__('The item %s (SKU %s) does not exist in the catalog anymore.', $item->getName(), $item->getSku()));
$hasBadItems = true;
}
}
if ($hasBadItems) {
$this->_getSession()->addError(Mage::helper('adminhtml')->__('Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.'));
}
return $this;
}
示例8: _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;
}
示例9: createByApiResponse
/**
* @param Mage_Sales_Model_Order $order
* @param Payone_Api_Response_Interface $response
* @param Payone_Api_Request_Interface $request
* @throws Payone_Core_Exception_TransactionAlreadyExists
* @return null|Payone_Core_Model_Domain_Transaction
*/
public function createByApiResponse(Mage_Sales_Model_Order $order, Payone_Api_Response_Interface $response, Payone_Api_Request_Interface $request)
{
$transaction = $this->getFactory()->getModelTransaction();
$transaction->load($response->getTxid(), 'txid');
// should not exist but to be sure load by txid
if ($transaction->hasData()) {
throw new Payone_Core_Exception_TransactionAlreadyExists($response->getTxid());
}
$transaction->setTxid($response->getTxid());
$transaction->setLastTxaction($response->getStatus());
$transaction->setUserid($response->getUserid());
$transaction->setStoreId($order->getStoreId());
$transaction->setOrderId($order->getId());
$transaction->setReference($order->getIncrementId());
$transaction->setCurrency($order->getOrderCurrencyCode());
$transaction->setCustomerId($order->getCustomerId());
$transaction->setClearingtype($request->getClearingtype());
$transaction->setMode($request->getMode());
$transaction->setMid($request->getMid());
$transaction->setAid($request->getAid());
$transaction->setPortalid($request->getPortalid());
$transaction->setLastSequencenumber(0);
$data = $response->toArray();
$transaction->addData($data);
$transaction->save();
return $transaction;
}
示例10: _sendPaymentDeclineEmail
/**
* Send Payment Decline email
*/
protected function _sendPaymentDeclineEmail(Mage_Sales_Model_Order $order, $type = 'soft')
{
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('amazon_payments_async_decline_' . $type);
$orderUrl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId(), '_store' => $order->getStoreId(), '_forced_secure' => true));
$templateParams = array('order_url' => $orderUrl, 'store' => Mage::app()->getStore($order->getStoreId()), 'customer' => Mage::getModel('customer/customer')->load($order->getCustomerId()));
$sender = array('name' => Mage::getStoreConfig('trans_email/ident_general/email', $order->getStoreId()), 'email' => Mage::getStoreConfig('trans_email/ident_general/name', $order->getStoreId()));
$emailTemplate->sendTransactional($emailTemplate->getId(), $sender, $order->getCustomerEmail(), $order->getCustomerName(), $templateParams, $order->getStoreId());
}
示例11: toQuote
/**
* Converting order object to quote object
*
* @param Mage_Sales_Model_Order $order
* @return Mage_Sales_Model_Quote
*/
public function toQuote(Mage_Sales_Model_Order $order, $quote = null)
{
if (!$quote instanceof Mage_Sales_Model_Quote) {
$quote = Mage::getModel('sales/quote');
}
$quote->setStoreId($order->getStoreId())->setOrderId($order->getId())->setCustomerId($order->getCustomerId())->setCustomerEmail($order->getCustomerEmail())->setCustomerGroupId($order->getCustomerGroupId())->setCustomerTaxClassId($order->getCustomerTaxClassId())->setCustomerIsGuest($order->getCustomerIsGuest())->setBaseCurrencyCode($order->getBaseCurrencyCode())->setStoreCurrencyCode($order->getStoreCurrencyCode())->setQuoteCurrencyCode($order->getOrderCurrencyCode())->setStoreToBaseRate($order->getStoreToBaseRate())->setStoreToQuoteRate($order->getStoreToOrderRate())->setGrandTotal($order->getGrandTotal())->setBaseGrandTotal($order->getBaseGrandTotal())->setCouponCode($order->getCouponCode())->setGiftcertCode($order->getGiftcertCode())->setAppliedRuleIds($order->getAppliedRuleIds())->collectTotals();
Mage::dispatchEvent('sales_convert_order_to_quote', array('order' => $order, 'quote' => $quote));
return $quote;
}
示例12: _sendPaymentDeclineEmail
/**
* Send Payment Decline email
*/
protected function _sendPaymentDeclineEmail(Mage_Sales_Model_Order $order)
{
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('amazon_payments_async_decline');
$orderUrl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId(), '_store' => $order->getStoreId(), '_forced_secure' => true));
$templateParams = array('order_url' => $orderUrl, 'store' => Mage::app()->getStore($order->getStoreId()), 'customer' => Mage::getModel('customer/customer')->load($order->getCustomerId()));
$processedTemplate = $emailTemplate->getProcessedTemplate($templateParams);
// Test template:
//var_dump($emailTemplate->debug()); echo $processedTemplate;
$emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $order->getStoreId()))->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $order->getStoreId()))->send($order->getCustomerEmail(), $order->getCustomerName(), $templateParams);
}
示例13: _getCustomerId
/**
* get an id for the customer
* @return string
*/
protected function _getCustomerId()
{
/** bool $isGuest */
$isGuest = !$this->_order->getCustomerId();
/** @var int $customerId */
$customerId = $this->_order->getCustomerId() ?: $this->_getGuestCustomerId();
/** @var mixed $store */
$store = $this->_order->getStore();
return $this->_helper->prefixCustomerId($customerId, $store, $isGuest);
}
示例14: _processOrder
/**
* Operate with order using information from silent post
*
* @param Mage_Sales_Model_Order $order
*/
protected function _processOrder(Mage_Sales_Model_Order $order)
{
$response = $this->getResponse();
$payment = $order->getPayment();
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$canSendNewOrderEmail = true;
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
$canSendNewOrderEmail = false;
$fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
$payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
}
if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
$payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
}
if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
$payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
}
switch ($response->getType()) {
case self::TRXTYPE_AUTH_ONLY:
$payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
break;
case self::TRXTYPE_SALE:
$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
break;
}
$order->save();
$customerId = $order->getCustomerId();
if ($response->getResult() == self::RESPONSE_CODE_APPROVED && $response->getMethod() == 'CC' && $customerId && $payment->hasAdditionalInformation('cc_save_future') && $payment->getAdditionalInformation('cc_save_future') == 'Y') {
// Obtain CC type
$ccType = 'OT';
$responseCcType = $response->getCardtype();
if (!is_null($responseCcType)) {
$payflowResponseCcTypesMap = array(0 => 'VI', 1 => 'MC', 2 => 'DI', 3 => 'AE', 4 => 'OT', 5 => 'JCB');
if (isset($payflowResponseCcTypesMap[$responseCcType])) {
$ccType = $payflowResponseCcTypesMap[$responseCcType];
}
}
$ccExpMonth = $response->getExpdate() ? substr($response->getExpdate(), 0, 2) : '';
if ($ccExpMonth[0] == '0') {
$ccExpMonth = $ccExpMonth[1];
}
// Create new stored card
$customerstoredModel = Mage::getModel('cls_paypal/customerstored');
$customerstoredModel->setData(array('transaction_id' => $response->getPnref(), 'customer_id' => $customerId, 'cc_type' => $ccType, 'cc_last4' => $response->getAcct() ? substr($response->getAcct(), -4) : '', 'cc_exp_month' => $ccExpMonth, 'cc_exp_year' => $response->getExpdate() ? '20' . substr($response->getExpdate(), 2) : '', 'date' => Varien_Date::formatDate(true, true), 'payment_method' => $payment->getMethod()));
$customerstoredModel->save();
}
try {
if ($canSendNewOrderEmail) {
$order->sendNewOrderEmail();
}
Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save();
} catch (Exception $e) {
Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
}
}
示例15: getReviewVendorUrl
public function getReviewVendorUrl(Mage_Sales_Model_Order $order, $vendorId)
{
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
if ($orderId = $order->getIncrementId()) {
if ($customerId = $customer->getId()) {
$url = Mage::getUrl('vendor/review/write', array('vendor_id' => $vendorId, 'customer_id' => $customerId, 'order_id' => $orderId, 'hash' => $this->hashKey($customerId, $vendorId, $orderId)));
return $url;
}
}
return '';
}