當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataObject::getCustomerId方法代碼示例

本文整理匯總了PHP中Magento\Framework\DataObject::getCustomerId方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataObject::getCustomerId方法的具體用法?PHP DataObject::getCustomerId怎麽用?PHP DataObject::getCustomerId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\DataObject的用法示例。


在下文中一共展示了DataObject::getCustomerId方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * Renders grid column
  *
  * @param \Magento\Framework\DataObject $row
  * @return \Magento\Framework\Phrase|string
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     $id = $row->getCustomerId();
     if (!$id) {
         return __('Show Reviews');
     }
     return sprintf('<a href="%s">%s</a>', $this->getUrl('review/product/', ['customerId' => $id]), __('Show Reviews'));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:Customer.php

示例2: render

 /**
  * Render review type
  *
  * @param \Magento\Framework\DataObject $row
  * @return \Magento\Framework\Phrase
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     if ($row->getCustomerId()) {
         return __('Customer');
     }
     if ($row->getStoreId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
         return __('Administrator');
     }
     return __('Guest');
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:16,代碼來源:Type.php

示例3: _afterDelete

 /**
  * {@inheritdoc}
  */
 protected function _afterDelete(\Magento\Framework\DataObject $address)
 {
     if ($address->getId()) {
         $customer = $this->customerRepository->getById($address->getCustomerId());
         if ($customer->getDefaultBilling() == $address->getId()) {
             $customer->setDefaultBilling(null);
         }
         if ($customer->getDefaultShipping() == $address->getId()) {
             $customer->setDefaultShipping(null);
         }
         $this->customerRepository->save($customer);
     }
     return parent::_afterDelete($address);
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:17,代碼來源:Address.php

示例4: getRowUrl

 /**
  * @param \Magento\Framework\DataObject $row
  *
  * @return string
  */
 public function getRowUrl($row)
 {
     return $this->getUrl('customer/index/edit', ['id' => $row->getCustomerId(), 'active_tab' => 'cart']);
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:9,代碼來源:Grid.php

示例5: registerIds

 /**
  * Add information about product ids to visitor/customer
  *
  * @param \Magento\Framework\DataObject|\Magento\Reports\Model\Product\Index\AbstractIndex $object
  * @param int[] $productIds
  * @return $this
  */
 public function registerIds(\Magento\Framework\DataObject $object, $productIds)
 {
     $row = ['visitor_id' => $object->getVisitorId(), 'customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId()];
     $data = [];
     foreach ($productIds as $productId) {
         $productId = (int) $productId;
         if ($productId) {
             $row['product_id'] = $productId;
             $data[] = $row;
         }
     }
     $matchFields = ['product_id', 'store_id'];
     foreach ($data as $row) {
         $this->_resourceHelper->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields);
     }
     return $this;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:24,代碼來源:AbstractIndex.php

示例6: registerIds

 /**
  * Add information about product ids to visitor/customer
  *
  * @param \Magento\Framework\DataObject|\Magento\Reports\Model\Product\Index\AbstractIndex $object
  * @param int[] $productIds
  * @return $this
  */
 public function registerIds(\Magento\Framework\DataObject $object, $productIds)
 {
     $row = ['visitor_id' => $object->getVisitorId(), 'customer_id' => $object->getCustomerId(), 'store_id' => $object->getStoreId()];
     $addedAt = (new \DateTime())->getTimestamp();
     $data = [];
     foreach ($productIds as $productId) {
         $productId = (int) $productId;
         if ($productId) {
             $row['product_id'] = $productId;
             $row['added_at'] = $this->dateTime->formatDate($addedAt);
             $data[] = $row;
         }
         $addedAt -= $addedAt > 0 ? 1 : 0;
     }
     $matchFields = ['product_id', 'store_id'];
     foreach ($data as $row) {
         $this->_resourceHelper->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields);
     }
     return $this;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:27,代碼來源:AbstractIndex.php


注:本文中的Magento\Framework\DataObject::getCustomerId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。