当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Customer_Model_Customer::getId方法代码示例

本文整理汇总了PHP中Mage_Customer_Model_Customer::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::getId方法的具体用法?PHP Mage_Customer_Model_Customer::getId怎么用?PHP Mage_Customer_Model_Customer::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Customer_Model_Customer的用法示例。


在下文中一共展示了Mage_Customer_Model_Customer::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createFromCustomer

 public static function createFromCustomer(Mage_Customer_Model_Customer $customer)
 {
     /** @var Mage_Log_Model_Customer $logCustomer */
     $logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer->getId());
     switch ($customer->getGender()) {
         case '1':
             $gender = 1;
             break;
         case '2':
             $gender = 2;
             break;
         default:
             $gender = 0;
     }
     $aCustomer = new self();
     $aCustomer->email = $customer->getEmail();
     $aCustomer->type = 'e';
     $aCustomer->gender = $gender;
     $aCustomer->id = $customer->getId();
     $aCustomer->first_name = $customer->getFirstname();
     $aCustomer->last_name = $customer->getLastname();
     if (($birthday = $customer->getDob()) !== null) {
         $aCustomer->birthday = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime($birthday));
     }
     if (($document_id = $customer->getTaxvat()) !== null) {
         $aCustomer->document_id = $document_id;
     }
     $aCustomer->date_joined = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime('@' . $customer->getCreatedAtTimestamp()));
     if (($lastLogin = $logCustomer->getLoginAtTimestamp()) != null) {
         $aCustomer->last_login = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime('@' . $lastLogin));
     }
     return $aCustomer;
 }
开发者ID:aplazame,项目名称:magento,代码行数:33,代码来源:Customer.php

示例2: load

 public function load($printQuery = false, $logQuery = false)
 {
     $this->_select = $this->_read->select();
     $entityTable = $this->getEntity()->getEntityTable();
     $paidTable = $this->getAttribute('grand_total')->getBackend()->getTable();
     $idField = $this->getEntity()->getIdFieldName();
     $this->getSelect()->from(array('sales' => $entityTable), array('store_id', 'lifetime' => 'sum(sales.base_grand_total)', 'avgsale' => 'avg(sales.base_grand_total)', 'num_orders' => 'count(sales.base_grand_total)'))->where('sales.entity_type_id=?', $this->getEntity()->getTypeId())->group('sales.store_id');
     if ($this->_customer instanceof Mage_Customer_Model_Customer) {
         $this->getSelect()->where('sales.customer_id=?', $this->_customer->getId());
     }
     $this->printLogQuery($printQuery, $logQuery);
     try {
         $values = $this->_read->fetchAll($this->getSelect()->__toString());
     } catch (Exception $e) {
         $this->printLogQuery(true, true, $this->getSelect()->__toString());
         throw $e;
     }
     $stores = Mage::getResourceModel('core/store_collection')->setWithoutDefaultFilter()->load()->toOptionHash();
     if (!empty($values)) {
         foreach ($values as $v) {
             $obj = new Varien_Object($v);
             $storeName = isset($stores[$obj->getStoreId()]) ? $stores[$obj->getStoreId()] : null;
             $this->_items[$v['store_id']] = $obj;
             $this->_items[$v['store_id']]->setStoreName($storeName);
             $this->_items[$v['store_id']]->setAvgNormalized($obj->getAvgsale() * $obj->getNumOrders());
             foreach ($this->_totals as $key => $value) {
                 $this->_totals[$key] += $obj->getData($key);
             }
         }
         if ($this->_totals['num_orders']) {
             $this->_totals['avgsale'] = $this->_totals['lifetime'] / $this->_totals['num_orders'];
         }
     }
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:35,代码来源:Collection.php

示例3: setCustomerFilter

 /**
  * Set customer filter
  *
  * @param Mage_Customer_Model_Customer $customer
  * @return Mage_Customer_Model_Resource_Address_Collection
  */
 public function setCustomerFilter($customer)
 {
     if ($customer->getId()) {
         $this->addAttributeToFilter('parent_id', $customer->getId());
     } else {
         $this->addAttributeToFilter('parent_id', '-1');
     }
     return $this;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:15,代码来源:Collection.php

示例4: loadByCustomer

 /**
  * Load subscriber by customer
  *
  * @param Mage_Customer_Model_Customer $customer
  * @return array
  */
 public function loadByCustomer(Mage_Customer_Model_Customer $customer)
 {
     $select = $this->_read->select()->from($this->getMainTable())->where('customer_id=:customer_id');
     Mage::fireLog($customer->getId(), "loadByCustomer");
     $result = $this->_read->fetchRow($select, array('customer_id' => $customer->getId()));
     if ($result) {
         return $result;
     }
     $select = $this->_read->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email');
     $result = $this->_read->fetchRow($select, array('subscriber_email' => $customer->getEmail()));
     if ($result) {
         return $result;
     }
     return array();
 }
开发者ID:swsnow,项目名称:lexiconn_mailinglist,代码行数:21,代码来源:Subscriber.php

示例5: assignCustomerWithAddressChange

 public function assignCustomerWithAddressChange(Mage_Customer_Model_Customer $customer, Mage_Sales_Model_Quote_Address $billingAddress = null, Mage_Sales_Model_Quote_Address $shippingAddress = null)
 {
     if ($customer->getId()) {
         $this->setCustomer($customer);
         if (!is_null($billingAddress)) {
             $this->setBillingAddress($billingAddress);
         } else {
             $defaultBillingAddress = $customer->getDefaultBillingAddress();
             if ($defaultBillingAddress && $defaultBillingAddress->getId()) {
                 $billingAddress = Mage::getModel('request4quote/quote_address')->importCustomerAddress($defaultBillingAddress);
                 $this->setBillingAddress($billingAddress);
             }
         }
         if (is_null($shippingAddress)) {
             $defaultShippingAddress = $customer->getDefaultShippingAddress();
             if ($defaultShippingAddress && $defaultShippingAddress->getId()) {
                 $shippingAddress = Mage::getModel('request4quote/quote_address')->importCustomerAddress($defaultShippingAddress);
             } else {
                 $shippingAddress = Mage::getModel('request4quote/quote_address');
             }
         }
         $this->setShippingAddress($shippingAddress);
     }
     return $this;
 }
开发者ID:VinuWebtech,项目名称:production267,代码行数:25,代码来源:Quote.php

示例6: paytraceCustomer

 /**
  * EITHER CREATE OR UPDATE THE CUSTOMER
  * 
  * TO CREATE
  * http://help.paytrace.com/api-create-customer-profile
  * 
  * TO UPDATE
  * http://help.paytrace.com/api-update-customer-profile
  * 
  * TO DELETE
  * if $card is empty then we delete the card from paytrace
  * 
  * @param Mage_Customer_Model_Customer $customer
  */
 public function paytraceCustomer(Mage_Customer_Model_Customer $customer, Widgetized_Level3_Model_Card $card = null)
 {
     $defaults = array('UN' => $this->getConfigData('login'), 'PSWD' => $this->getConfigData('trans_key'), 'TERMS' => 'Y', 'METHOD' => 'CreateCustomer', 'CUSTID' => $customer->getId(), 'BNAME' => $customer->getFirstname() . ' ' . $customer->getLastname(), 'CC' => '', 'EXPMNTH' => '', 'EXPYR' => '');
     $addressId = $customer->getDefaultBilling();
     $billing = Mage::getModel('sales/order_address')->load($addressId);
     if ($billing) {
         $defaults['BADDRESS'] = $billing->getPostcode();
         $defaults['BCITY'] = $billing->getCity();
         $defaults['BSTATE'] = $billing->getRegion();
         $defaults['BZIP'] = $billing->getPostcode();
         $defaults['BCOUNTRY'] = $billing->getCountryId();
     }
     if ($card) {
         $defaults['CC'] = $card->getNumber();
         $defaults['EXPMNTH'] = $card->getMonth();
         $defaults['EXPYR'] = $card->getYear();
     }
     try {
         $result = $this->call(array_keys($defaults), $defaults);
     } catch (Exception $ex) {
         $message = $this->__($ex->getMessage());
         if ($card) {
             $card->setToken($message);
             $card->save();
         }
     }
 }
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:41,代码来源:Paytrace.php

示例7: canShowTab

 /**
  * Check whether tab can be showed
  *
  * @return bool
  */
 public function canShowTab()
 {
     if (!$this->_customer) {
         return false;
     }
     return $this->_customer->getId() && $this->_authSession->isAllowed('Mage_Tag::tag');
 }
开发者ID:nemphys,项目名称:magento2,代码行数:12,代码来源:Tag.php

示例8: withCustomer

 /**
  * @param \Mage_Customer_Model_Customer $customer
  * @return $this
  */
 public function withCustomer($customer)
 {
     $this->attributes['customer_id'] = $customer->getId();
     $this->attributes['firstname'] = $customer->getFirstname();
     $this->attributes['lastname'] = $customer->getLastname();
     return $this;
 }
开发者ID:jameshalsall,项目名称:Manager,代码行数:11,代码来源:Address.php

示例9: getSubAccounts

 public function getSubAccounts(Mage_Customer_Model_Customer $customer)
 {
     /** @var  $collection Cminds_MultiUserAccounts_Model_Resource_SubAccount_Collection */
     $collection = $this->getCollection();
     $collection->addFieldToFilter('parent_customer_id', $customer->getId());
     return $collection;
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:7,代码来源:SubAccount.php

示例10: _sales

 /**
  * @param Mage_Customer_Model_Customer $customer
  */
 protected function _sales(&$customer)
 {
     $orderTable = $this->_getCoreResource()->getTableName("sales_flat_order");
     $_result = $this->_getAdapter()->select()->from($orderTable, array("first_purchase" => new Zend_Db_Expr("MIN(`created_at`)"), "last_purchase" => new Zend_Db_Expr("MAX(`created_at`)"), "purchases_number" => new Zend_Db_Expr("COUNT(`created_at`)"), "lifetime_sales" => new Zend_Db_Expr("SUM(`grand_total`)")))->where("customer_id = ?", $customer->getId());
     $customer->addData($this->_getAdapter()->fetchRow($_result));
     //setting new data to customer
 }
开发者ID:sereban,项目名称:magento-marketo-integration,代码行数:10,代码来源:Customer.php

示例11: _saveCustomerAfterOrder

 /**
  * Save customer
  *
  * @param Mage_Customer_Model_Customer $order
  */
 protected function _saveCustomerAfterOrder($order)
 {
     if ($this->_customer) {
         if (!$this->_customer->getId()) {
             $this->_customer->save();
             $order->setCustomerId($this->_customer->getId());
             $this->getBillingAddress()->setCustomerId($this->_customer->getId());
             $this->getShippingAddress()->setCustomerId($this->_customer->getId());
             $this->_customer->sendNewAccountEmail();
         } else {
             $saveCusstomerAddress = false;
             if ($this->getBillingAddress()->getSaveInAddressBook()) {
                 $billingAddress = $this->getBillingAddress()->exportCustomerAddress();
                 if ($this->getBillingAddress()->getCustomerAddressId()) {
                     $billingAddress->setId($this->getBillingAddress()->getCustomerAddressId());
                 }
                 $this->_customer->addAddress($billingAddress);
                 $saveCusstomerAddress = true;
             }
             if ($this->getShippingAddress()->getSaveInAddressBook()) {
                 $shippingAddress = $this->getShippingAddress()->exportCustomerAddress();
                 if ($this->getShippingAddress()->getCustomerAddressId()) {
                     $shippingAddress->setId($this->getShippingAddress()->getCustomerAddressId());
                 }
                 $this->_customer->addAddress($shippingAddress);
                 $saveCusstomerAddress = true;
             }
             if ($saveCusstomerAddress) {
                 $this->_customer->save();
             }
         }
     }
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:38,代码来源:Sales_Order_Create.php

示例12: setCustomer

 /**
  * Setter for $_customer
  *
  * @param Mage_Customer_Model_Customer $customer
  * @return Enterprise_Checkout_Model_Cart
  */
 public function setCustomer($customer)
 {
     if ($customer instanceof Varien_Object && $customer->getId()) {
         $this->_customer = $customer;
         $this->_quote = null;
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:14,代码来源:Cart.php

示例13: subscribe

 public function subscribe(Mage_Customer_Model_Customer $parent, $email, $name, $msg = "")
 {
     $this->setReferralParentId($parent->getId())->setReferralEmail($email)->setReferralName($name);
     if ($this->sendSubscription($parent, $email, $name, $msg)) {
         return $this->save();
     }
     return false;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:8,代码来源:Referral.php

示例14: _moveAttributesData

 /**
  * @param Mage_Customer_Model_Customer $customer
  */
 protected function _moveAttributesData($customer)
 {
     $attributes = array('po_limit' => $this->_poLimitId, 'po_credit' => $this->_poCreditId);
     foreach ($attributes as $attributeCode => $attributeId) {
         try {
             $select = $this->_db->select()->from($customer->getResource()->getTable('customer_entity_int'), array('value'))->where('attribute_id = ?', $attributeId)->where('entity_id = ?', $customer->getId());
             $value = $this->_db->fetchOne($select);
             if ((int) $value > 0) {
                 $this->_db->insert($customer->getResource()->getTable('customer_entity_decimal'), array('entity_type_id' => $customer->getEntityTypeId(), 'attribute_id' => $attributeId, 'entity_id' => $customer->getId(), 'value' => (int) $value));
             }
         } catch (Exception $e) {
         }
         try {
             $this->_db->delete($customer->getResource()->getTable('customer_entity_int'), 'entity_type_id = ' . $customer->getEntityTypeId() . ' AND attribute_id = ' . $attributeId . ' AND ' . 'entity_id = ' . $customer->getId());
         } catch (Exception $e) {
         }
     }
 }
开发者ID:flintdigital,项目名称:mage-mod-ar-po-emja,代码行数:21,代码来源:po_upgrade_3.0.3.php

示例15: getAllPasswordHashesForCustomer

 public function getAllPasswordHashesForCustomer(Mage_Customer_Model_Customer $customer)
 {
     $passwordHashes = [];
     $records = $this->getCollection()->addFilter('customer_id', $customer->getId());
     foreach ($records as $record) {
         array_push($passwordHashes, $record->getPasswordHash());
     }
     return $passwordHashes;
 }
开发者ID:all-bear,项目名称:magento.pci_password,代码行数:9,代码来源:PasswordHistory.php


注:本文中的Mage_Customer_Model_Customer::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。