本文整理汇总了PHP中Magento\Framework\Object::getCustomerId方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::getCustomerId方法的具体用法?PHP Object::getCustomerId怎么用?PHP Object::getCustomerId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Object
的用法示例。
在下文中一共展示了Object::getCustomerId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
/**
* Create url for passed item using passed url model
* @param \Magento\Framework\Object $item
* @return string
*/
public function getUrl($item)
{
if ($this->_authorization->isAllowed('Magento_Customer::manage') && $item->getCustomerId()) {
return parent::getUrl($item);
}
return false;
}
示例2: render
/**
* Renders grid column
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
$id = $row->getCustomerId();
if (!$id) {
return __('Show Reviews');
}
return sprintf('<a href="%s">%s</a>', $this->getUrl('review/product/', array('customerId' => $id)), __('Show Reviews'));
}
示例3: render
/**
* Render review type
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
if ($row->getCustomerId()) {
return __('Customer');
}
if ($row->getStoreId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
return __('Administrator');
}
return __('Guest');
}
示例4: _afterSave
/**
* Set default shipping to address
*
* @param \Magento\Framework\Object $address
* @return $this
*/
protected function _afterSave(\Magento\Framework\Object $address)
{
if ($address->getIsCustomerSaveTransaction()) {
return $this;
}
if ($address->getId() && ($address->getIsDefaultBilling() || $address->getIsDefaultShipping())) {
$customer = $this->_createCustomer()->load($address->getCustomerId());
if ($address->getIsDefaultBilling()) {
$customer->setDefaultBilling($address->getId());
}
if ($address->getIsDefaultShipping()) {
$customer->setDefaultShipping($address->getId());
}
$customer->save();
}
return $this;
}
示例5: getRowUrl
/**
* @param \Magento\Framework\Object $row
*
* @return string
*/
public function getRowUrl($row)
{
return $this->getUrl('customer/index/edit', array('id' => $row->getCustomerId(), 'active_tab' => 'cart'));
}
示例6: registerIds
/**
* Add information about product ids to visitor/customer
*
* @param \Magento\Framework\Object|\Magento\Reports\Model\Product\Index\AbstractIndex $object
* @param array $productIds
* @return $this
*/
public function registerIds(\Magento\Framework\Object $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;
}
示例7: _afterDelete
/**
* {@inheritdoc}
*/
protected function _afterDelete(\Magento\Framework\Object $address)
{
if ($address->getId()) {
$customer = $this->_createCustomer()->load($address->getCustomerId());
if ($customer->getDefaultBilling() == $address->getId()) {
$customer->setDefaultBilling(null);
}
if ($customer->getDefaultShipping() == $address->getId()) {
$customer->setDefaultShipping(null);
}
$customer->save();
}
return parent::_afterDelete($address);
}
示例8: render
/**
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
return $row->getCustomerId() > 0 ? __('Customer') : __('Visitor');
}
示例9: _afterDelete
/**
* {@inheritdoc}
*/
protected function _afterDelete(\Magento\Framework\Object $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);
}
示例10: fillCustomerContacts
/**
* @param Object $order
* @param Object $request
* @return Object
*/
public function fillCustomerContacts(Object $order, Object $request)
{
$customerId = $order->getCustomerId();
if ($customerId) {
$request->setCustref($customerId);
}
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$request = $this->setBilling($request, $billing);
$request->setEmail($order->getCustomerEmail());
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$request = $this->setShipping($request, $shipping);
return $request;
}
return $request;
}