本文整理汇总了PHP中Mage_Catalog_Model_Product::isAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Product::isAvailable方法的具体用法?PHP Mage_Catalog_Model_Product::isAvailable怎么用?PHP Mage_Catalog_Model_Product::isAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Product
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Product::isAvailable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareStockAlertData
/**
* Check whether the stock alert data can be shown and prepare related data
*
* @return void
*/
public function prepareStockAlertData()
{
if (!$this->_getHelper()->isStockAlertAllowed() || !$this->_product || $this->_product->isAvailable()) {
$this->setTemplate('');
return;
}
$this->setSignupUrl($this->_getHelper()->getSaveUrl('stock'));
}
示例2: prepareStockAlertData
/**
* Check whether the stock alert data can be shown and prepare related data
*/
public function prepareStockAlertData()
{
if (!Mage::getStoreConfigFlag(Mage_ProductAlert_Model_Observer::XML_PATH_STOCK_ALLOW) || !$this->_product || $this->_product->isAvailable()) {
$this->setTemplate('');
return;
}
$this->setSignupUrl(Mage::helper('productalert')->getSaveUrl('stock'));
}
示例3: prepareStockAlertData
/**
* Check whether the stock alert data can be shown and prepare related data
*
* @return void
*/
public function prepareStockAlertData()
{
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($this->_product);
if (!$this->_getHelper()->isStockAlertAllowed() || !$this->_product || $this->_product->isAvailable() || $stock->getQty() != 0) {
$this->setTemplate('');
return;
}
$this->setSignupUrl($this->_getHelper()->getSaveUrl('stock'));
}
示例4: testIsSalable
/**
* @covers Mage_Catalog_Model_Product::isSalable
* @covers Mage_Catalog_Model_Product::isSaleable
* @covers Mage_Catalog_Model_Product::isAvailable
* @covers Mage_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());
}
示例5: getProductData
/**
* Create Product array from Mage_Catalog_Model_Product
*
* @param Mage_Catalog_Model_Product $product
* @return array
*/
public function getProductData(Mage_Catalog_Model_Product $product)
{
try {
$data = array('url' => $product->getProductUrl(), 'title' => htmlspecialchars($product->getName()), 'spider' => 1, 'price' => $product->getPrice(), 'description' => urlencode($product->getDescription()), 'tags' => htmlspecialchars($product->getMetaKeyword()), 'images' => array(), 'vars' => array('sku' => $product->getSku(), 'storeId' => '', 'typeId' => $product->getTypeId(), 'status' => $product->getStatus(), 'categoryId' => $product->getCategoryId(), 'categoryIds' => $product->getCategoryIds(), 'websiteIds' => $product->getWebsiteIds(), 'storeIds' => $product->getStoreIds(), 'groupPrice' => $product->getGroupPrice(), 'formatedPrice' => $product->getFormatedPrice(), 'calculatedFinalPrice' => $product->getCalculatedFinalPrice(), 'minimalPrice' => $product->getMinimalPrice(), 'specialPrice' => $product->getSpecialPrice(), 'specialFromDate' => $product->getSpecialFromDate(), 'specialToDate' => $product->getSpecialToDate(), 'relatedProductIds' => $product->getRelatedProductIds(), 'upSellProductIds' => $product->getUpSellProductIds(), 'getCrossSellProductIds' => $product->getCrossSellProductIds(), 'isSuperGroup' => $product->isSuperGroup(), 'isGrouped' => $product->isGrouped(), 'isConfigurable' => $product->isConfigurable(), 'isSuper' => $product->isSuper(), 'isSalable' => $product->isSalable(), 'isAvailable' => $product->isAvailable(), 'isVirtual' => $product->isVirtual(), 'isRecurring' => $product->isRecurring(), 'isInStock' => $product->isInStock(), 'weight' => $product->getSku()));
// Add product images
if (self::validateProductImage($product->getImage())) {
$data['images']['full'] = array("url" => $product->getImageUrl());
}
if (self::validateProductImage($product->getSmallImage())) {
$data['images']['smallImage'] = array("url" => $product->getSmallImageUrl($width = 88, $height = 77));
}
if (self::validateProductImage($product->getThumbnail())) {
$data['images']['thumb'] = array("url" => $product->getThumbnailUrl($width = 75, $height = 75));
}
return $data;
return $data;
} catch (Exception $e) {
Mage::logException($e);
}
}
示例6: canConfigure
/**
* Check if product can be configured
*
* @param Mage_Catalog_Model_Product $product
* @return bool
*/
public function canConfigure($product = null)
{
return $product instanceof Mage_Catalog_Model_Product && $product->isAvailable() && parent::canConfigure();
}
示例7: buildAvailability
/**
* Builds the availability for the product.
*
* @param Mage_Catalog_Model_Product $product the product model.
*
* @return string
*/
protected function buildAvailability(Mage_Catalog_Model_Product $product)
{
$availability = self::OUT_OF_STOCK;
if (!$product->isVisibleInSiteVisibility()) {
$availability = self::INVISIBLE;
} elseif ($product->isAvailable()) {
$availability = self::IN_STOCK;
}
return $availability;
}