本文整理汇总了PHP中Magento\Catalog\Model\Product::isSaleable方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::isSaleable方法的具体用法?PHP Product::isSaleable怎么用?PHP Product::isSaleable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product
的用法示例。
在下文中一共展示了Product::isSaleable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsSalable
/**
* @covers \Magento\Catalog\Model\Product::isSalable
* @covers \Magento\Catalog\Model\Product::isSaleable
* @covers \Magento\Catalog\Model\Product::isAvailable
* @covers \Magento\Catalog\Model\Product::isInStock
*/
public function testIsSalable()
{
$this->_model->load(1);
// fixture
$this->assertTrue((bool) $this->_model->isSalable());
$this->assertTrue((bool) $this->_model->isSaleable());
$this->assertTrue((bool) $this->_model->isAvailable());
$this->assertTrue($this->_model->isInStock());
$this->_model->setStatus(0);
$this->assertFalse((bool) $this->_model->isSalable());
$this->assertFalse((bool) $this->_model->isSaleable());
$this->assertFalse((bool) $this->_model->isAvailable());
$this->assertFalse($this->_model->isInStock());
}
示例2: testIsSalable
/**
* @covers \Magento\Catalog\Model\Product::isSalable
* @covers \Magento\Catalog\Model\Product::isSaleable
* @covers \Magento\Catalog\Model\Product::isAvailable
* @covers \Magento\Catalog\Model\Product::isInStock
*/
public function testIsSalable()
{
$this->_model = $this->productRepository->get('simple');
// fixture
$this->assertTrue((bool) $this->_model->isSalable());
$this->assertTrue((bool) $this->_model->isSaleable());
$this->assertTrue((bool) $this->_model->isAvailable());
$this->assertTrue($this->_model->isInStock());
$this->_model->setStatus(0);
$this->assertFalse((bool) $this->_model->isSalable());
$this->assertFalse((bool) $this->_model->isSaleable());
$this->assertFalse((bool) $this->_model->isAvailable());
$this->assertFalse($this->_model->isInStock());
}
示例3: isSelected
/**
* Define if selection is selected
*
* @param \Magento\Catalog\Model\Product $selection
* @return bool
*/
public function isSelected($selection)
{
$selectedOptions = $this->_getSelectedOptions();
if (is_numeric($selectedOptions)) {
return $selection->getSelectionId() == $selectedOptions;
} elseif (is_array($selectedOptions) && !empty($selectedOptions)) {
return in_array($selection->getSelectionId(), $selectedOptions);
} elseif ($selectedOptions == 'None') {
return false;
} else {
return $selection->getIsDefault() && $selection->isSaleable();
}
}
示例4: isSaleable
/**
* {@inheritdoc}
*/
public function isSaleable()
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'isSaleable');
if (!$pluginInfo) {
return parent::isSaleable();
} else {
return $this->___callPlugins('isSaleable', func_get_args(), $pluginInfo);
}
}