本文整理汇总了PHP中Magento\Catalog\Model\Product::getIsSalable方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getIsSalable方法的具体用法?PHP Product::getIsSalable怎么用?PHP Product::getIsSalable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product
的用法示例。
在下文中一共展示了Product::getIsSalable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetIsSalableHasDataIsSaleable
public function testGetIsSalableHasDataIsSaleable()
{
$typeInstanceMock = $this->getMock('Magento\\Catalog\\Model\\Product\\Type\\Simple', [], [], '', false);
$this->model->setTypeInstance($typeInstanceMock);
$this->model->setData('is_saleable', true);
$this->model->setData('is_salable', false);
self::assertTrue($this->model->getIsSalable());
}
示例2: goBack
/**
* Resolve response
*
* @param string $backUrl
* @param \Magento\Catalog\Model\Product $product
* @return $this|\Magento\Framework\Controller\Result\Redirect
*/
protected function goBack($backUrl = null, $product = null)
{
if (!$this->getRequest()->isAjax()) {
return parent::_goBack($backUrl);
}
$result = [];
if ($backUrl || ($backUrl = $this->getBackUrl())) {
$result['backUrl'] = $backUrl;
} else {
if ($product && !$product->getIsSalable()) {
$result['product'] = ['statusText' => __('Out of stock')];
}
}
$this->getResponse()->representJson($this->_objectManager->get('Magento\\Framework\\Json\\Helper\\Data')->jsonEncode($result));
}
示例3: goBack
/**
* Resolve response
*
* @param string $backUrl
* @param \Magento\Catalog\Model\Product $product
* @return $this|\Magento\Framework\Controller\Result\Redirect
*/
protected function goBack($backUrl = null, $product = null)
{
if (!$this->getRequest()->isAjax()) {
return parent::_goBack($backUrl);
}
$result = [];
if ($backUrl || ($backUrl = $this->getBackUrl())) {
$result['backUrl'] = $backUrl;
} else {
$this->_view->loadLayout(['default'], true, true, false);
$layout = $this->_view->getLayout();
$result['messages'] = $layout->getBlock('global_messages')->toHtml();
if ($this->_checkoutSession->getCartWasUpdated()) {
$result['minicart'] = $layout->getBlock('minicart')->toHtml();
}
if ($product && !$product->getIsSalable()) {
$result['product'] = ['statusText' => __('Out of stock')];
}
}
$this->getResponse()->representJson($this->_objectManager->get('Magento\\Framework\\Json\\Helper\\Data')->jsonEncode($result));
}
示例4: getIsSalable
/**
* {@inheritdoc}
*/
public function getIsSalable()
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'getIsSalable');
if (!$pluginInfo) {
return parent::getIsSalable();
} else {
return $this->___callPlugins('getIsSalable', func_get_args(), $pluginInfo);
}
}