本文整理汇总了PHP中Magento\Framework\Object::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::getId方法的具体用法?PHP Object::getId怎么用?PHP Object::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Object
的用法示例。
在下文中一共展示了Object::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders grid column
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
$readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __('Read Details') . '</a>' : '';
$markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())) . '">' . __('Mark as Read') . '</a>' : '';
$encodedUrl = $this->_urlHelper->getEncodedUrl();
return sprintf('%s%s<a class="action-delete" href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>', $readDetailsHtml, $markAsReadHtml, $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId(), \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $encodedUrl)), __('Are you sure?'), __('Remove'));
}
示例2: render
/**
* Renderer for "Action" column in Newsletter templates grid
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
if ($row->isValidForSend()) {
$actions[] = ['url' => $this->getUrl('*/queue/edit', ['template_id' => $row->getId()]), 'caption' => __('Queue Newsletter')];
}
$actions[] = ['url' => $this->getUrl('*/*/preview', ['id' => $row->getId()]), 'popup' => true, 'caption' => __('Preview')];
$this->getColumn()->setActions($actions);
return parent::render($row);
}
示例3: getEditUrl
/**
* Retrieve gift message save url
*
* @param \Magento\Framework\Object $item
* @param string $type
* @param array $params
* @return string
*/
public function getEditUrl(\Magento\Framework\Object $item, $type, $params = array())
{
if ($item->getGiftMessageId()) {
$params = array_merge($params, array('message' => $item->getGiftMessageId(), 'item' => $item->getId(), 'type' => $type));
return $this->_getUrl('giftmessage/index/edit', $params);
} else {
$params = array_merge($params, array('item' => $item->getId(), 'type' => $type));
return $this->_getUrl('giftmessage/index/new', $params);
}
}
示例4: beforeSave
/**
* Set new increment id
*
* @param \Magento\Framework\Object $object
* @return $this
*/
public function beforeSave($object)
{
if (!$object->getId()) {
$this->getAttribute()->getEntity()->setNewIncrementId($object);
}
return $this;
}
示例5: getChildOrderIds
/**
* Return recurring payment child Orders Ids
*
*
* @param \Magento\Framework\Object $object
* @return array
*/
public function getChildOrderIds($object)
{
$adapter = $this->_getReadAdapter();
$bind = array(':payment_id' => $object->getId());
$select = $adapter->select()->from(array('main_table' => $this->getTable('recurring_payment_order')), array('order_id'))->where('payment_id=:payment_id');
return $adapter->fetchCol($select, $bind);
}
示例6: render
/**
* Render grid column
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
$actions = [];
$actions[] = ['url' => $this->getUrl('adminhtml/*/preview', ['id' => $row->getId()]), 'popup' => true, 'caption' => __('Preview')];
$this->getColumn()->setActions($actions);
return parent::render($row);
}
示例7: _setAttributeValue
/**
* Set attribute value
*
* @param \Magento\Framework\Object $object
* @return $this
*/
protected function _setAttributeValue($object)
{
$storeId = $object->getStoreId();
$defaultStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
if (!isset($this->_entityAttributeValues[$object->getId()])) {
return $this;
}
$productValues = $this->_entityAttributeValues[$object->getId()];
if (!isset($productValues[$storeId]) && !isset($productValues[$defaultStoreId])) {
return $this;
}
$value = isset($productValues[$storeId]) ? $productValues[$storeId] : $productValues[$defaultStoreId];
$value = $this->_prepareDatetimeValue($value, $object);
$value = $this->_prepareMultiselectValue($value, $object);
$object->setData($this->getAttribute(), $value);
return $this;
}
示例8: render
/**
* Renders grid column
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
if ($row->getSubscriberStatus() == \Magento\Newsletter\Model\Subscriber::STATUS_SUBSCRIBED) {
return '<input type="checkbox" name="subscriber[]" value="' . $row->getId() . '" class="subscriberCheckbox"/>';
} else {
return '';
}
}
示例9: render
/**
* Renders column
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
$actions = [];
if ($row->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_NEVER) {
if (!$row->getQueueStartAt() && $row->getSubscribersTotal()) {
$actions[] = ['url' => $this->getUrl('*/*/start', ['id' => $row->getId()]), 'caption' => __('Start')];
}
} elseif ($row->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_SENDING) {
$actions[] = ['url' => $this->getUrl('*/*/pause', ['id' => $row->getId()]), 'caption' => __('Pause')];
$actions[] = ['url' => $this->getUrl('*/*/cancel', ['id' => $row->getId()]), 'confirm' => __('Do you really want to cancel the queue?'), 'caption' => __('Cancel')];
} elseif ($row->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_PAUSE) {
$actions[] = ['url' => $this->getUrl('*/*/resume', ['id' => $row->getId()]), 'caption' => __('Resume')];
}
$actions[] = ['url' => $this->getUrl('*/*/preview', ['id' => $row->getId()]), 'caption' => __('Preview'), 'popup' => true];
$this->getColumn()->setActions($actions);
return parent::render($row);
}
示例10: _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;
}
示例11: beforeSave
/**
* Before save
*
* @param \Magento\Framework\Object $object
* @return $this
*/
public function beforeSave($object)
{
if ($object->getId()) {
return $this;
}
if (!$object->hasData('website_id')) {
$object->setData('website_id', $this->_storeManager->getStore()->getWebsiteId());
}
return $this;
}
示例12: render
/**
* Renders grid column
*
* @param \Magento\Framework\Object $row
* @return string
*/
public function render(\Magento\Framework\Object $row)
{
$values = $this->_getValues();
$value = $row->getData($this->getColumn()->getIndex());
if (is_array($values)) {
$checked = in_array($value, $values) ? ' checked="checked"' : '';
} else {
$checked = $value === $this->getColumn()->getValue() ? ' checked="checked"' : '';
}
$html = '<input type="radio" name="' . $this->getColumn()->getHtmlName() . '" ';
$html .= 'value="' . $row->getId() . '" class="radio"' . $checked . '/>';
return $html;
}
示例13: beforeSave
/**
* Before save
*
* @param \Magento\Framework\Object $object
* @return $this
*/
public function beforeSave($object)
{
if ($object->getId()) {
return $this;
}
if (!$object->hasStoreId()) {
$object->setStoreId($this->_storeManager->getStore()->getId());
}
if (!$object->hasData('created_in')) {
$object->setData('created_in', $this->_storeManager->getStore($object->getStoreId())->getName());
}
return $this;
}
示例14: prepare
/**
* Set qty and custom price for quote item
*
* @param Item $item
* @param \Magento\Framework\Object $request
* @param Product $candidate
* @return void
*/
public function prepare(Item $item, Object $request, Product $candidate)
{
/**
* We specify qty after we know about parent (for stock)
*/
if ($request->getResetCount() && !$candidate->getStickWithinParent() && $item->getId() == $request->getId()) {
$item->setData(CartItemInterface::KEY_QTY, 0);
}
$item->addQty($candidate->getCartQty());
$customPrice = $request->getCustomPrice();
if (!empty($customPrice)) {
$item->setCustomPrice($customPrice);
$item->setOriginalCustomPrice($customPrice);
}
}
示例15: _toLinkHtml
/**
* Render single action as link html
*
* @param array $action
* @param \Magento\Framework\Object $row
* @return string|false
*/
protected function _toLinkHtml($action, \Magento\Framework\Object $row)
{
$product = $row->getProduct();
if (isset($action['process']) && $action['process'] == 'configurable') {
if ($product->canConfigure()) {
$style = '';
$onClick = sprintf('onclick="return %s.configureItem(%s)"', $action['control_object'], $row->getId());
return sprintf('<a href="%s" %s %s>%s</a>', $action['url'], $style, $onClick, $action['caption']);
} else {
return false;
}
} else {
return parent::_toLinkHtml($action, $row);
}
}