当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Catalog_Model_Product::getStatus方法代码示例

本文整理汇总了PHP中Mage_Catalog_Model_Product::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Product::getStatus方法的具体用法?PHP Mage_Catalog_Model_Product::getStatus怎么用?PHP Mage_Catalog_Model_Product::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Catalog_Model_Product的用法示例。


在下文中一共展示了Mage_Catalog_Model_Product::getStatus方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: decorateStatus

 /**
  * Decorate status column values
  *
  * @param  string                                   $value Check result
  * @param  Mage_Catalog_Model_Product|Varien_Object $row   Current row
  * @return string                                   Cell content
  */
 public function decorateStatus($value, $row)
 {
     $class = '';
     if ($row->getStatus()) {
         $cell = '<span class="grid-severity-notice"><span>' . $value . '</span></span>';
     } else {
         $cell = '<span class="grid-severity-critical"><span>' . $value . '</span></span>';
     }
     return $cell;
 }
开发者ID:helirexi,项目名称:firegento-debug,代码行数:17,代码来源:Grid.php

示例2: 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);
     }
 }
开发者ID:xiaoguizhidao,项目名称:sailthru-magento-extension,代码行数:26,代码来源:Content.php

示例3: _isObjectIndexable

 protected function _isObjectIndexable(Mage_Catalog_Model_Product $object)
 {
     if ($object->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
         return false;
     }
     if ($object->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG && $object->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) {
         return false;
     }
     return true;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:10,代码来源:Abstract.php

示例4: _isPurchasable

 private function _isPurchasable(Mage_Catalog_Model_Product $product, Mage_Catalog_Model_Product $parent = null)
 {
     if ($product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
         return "false";
     }
     if ($parent == null) {
         return Mage::getSingleton('listrak/product_purchasable_visibility')->isProductPurchasableBySetting(Mage::getStoreConfig('remarketing/productcategories/purchasable_visibility'), $product) ? "true" : "false";
     } else {
         return $parent->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED && Mage::getSingleton('listrak/product_purchasable_visibility')->isProductPurchasableBySetting(Mage::getStoreConfig('remarketing/productcategories/purchasable_visibility'), $parent) ? "true" : "false";
     }
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:11,代码来源:Product.php

示例5: isSalable

 /**
  * Check is product available for sale
  *
  * @param Mage_Catalog_Model_Product $product
  * @return bool
  */
 public function isSalable($product)
 {
     $salable = $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
     if ($salable && $product->hasData('is_salable')) {
         $salable = $product->getData('is_salable');
     }
     return (bool) (int) $salable;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:14,代码来源:Abstract.php

示例6: _isEnabled

 /**
  * Returns whether the product is enabled in the catalog
  *
  * @param Mage_Catalog_Model_Product $product Current product
  *
  * @return bool
  */
 private function _isEnabled(Mage_Catalog_Model_Product $product)
 {
     return $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:11,代码来源:Product.php

示例7: __construct

 public function __construct(Mage_Catalog_Model_Product $product)
 {
     $this->id = $product->getId();
     $this->sku = $product->getSku();
     $this->name = $product->getName();
     $statuses = Mage::getModel('catalog/product_status')->getOptionArray();
     $this->status = $statuses[$product->getStatus()];
     $options = Mage::getModel('catalog/product_visibility')->getOptionArray();
     $this->visibility = $options[$product->getVisibility()];
     $this->price = (double) number_format($product->getPrice(), 2, '.', '');
     $this->specialPrice = (double) number_format($product->getSpecialPrice(), 2, '.', '');
     $this->url = $product->getProductUrl();
     $this->imagePath = Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getSmallImage());
     $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
     $this->stock = (double) number_format($stock->getQty(), 2, '.', '');
     $short_description = $product->getShortDescription();
     //limit short description
     if (strlen($short_description) > 250) {
         $short_description = substr($short_description, 0, 250);
     }
     $this->short_description = $short_description;
     //category data
     $count = 0;
     $categoryCollection = $product->getCategoryCollection()->addNameToResult();
     foreach ($categoryCollection as $cat) {
         $this->categories[$count]['Id'] = $cat->getId();
         $this->categories[$count]['Name'] = $cat->getName();
         $count++;
     }
     //website data
     $count = 0;
     $websiteIds = $product->getWebsiteIds();
     foreach ($websiteIds as $websiteId) {
         $website = Mage::app()->getWebsite($websiteId);
         $this->websites[$count]['Id'] = $website->getId();
         $this->websites[$count]['Name'] = $website->getName();
         $count++;
     }
     //bundle product options
     if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
         $optionCollection = $product->getTypeInstance()->getOptionsCollection();
         $selectionCollection = $product->getTypeInstance()->getSelectionsCollection($product->getTypeInstance()->getOptionsIds());
         $options = $optionCollection->appendSelections($selectionCollection);
         foreach ($options as $option) {
             $count = 0;
             $title = str_replace(' ', '', $option->getDefaultTitle());
             $selections = $option->getSelections();
             $sOptions = array();
             foreach ($selections as $selection) {
                 $sOptions[$count]['name'] = $selection->getName();
                 $sOptions[$count]['sku'] = $selection->getSku();
                 $sOptions[$count]['id'] = $selection->getProductId();
                 $sOptions[$count]['price'] = (double) number_format($selection->getPrice(), 2, '.', '');
                 $count++;
             }
             $this->{$title} = $sOptions;
         }
     }
     //configurable product options
     if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
         $productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
         foreach ($productAttributeOptions as $productAttribute) {
             $count = 0;
             $label = strtolower(str_replace(' ', '', $productAttribute['label']));
             $options = array();
             foreach ($productAttribute['values'] as $attribute) {
                 $options[$count]['option'] = $attribute['default_label'];
                 $options[$count]['price'] = (double) number_format($attribute['pricing_value'], 2, '.', '');
                 $count++;
             }
             $this->{$label} = $options;
         }
     }
 }
开发者ID:dotmailer,项目名称:dotmailer-magento-extension,代码行数:74,代码来源:Product.php

示例8: testGetStatus

 public function testGetStatus()
 {
     $this->assertEquals(Mage_Catalog_Model_Product_Status::STATUS_ENABLED, $this->_model->getStatus());
     $this->_model->setStatus(Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
     $this->assertEquals(Mage_Catalog_Model_Product_Status::STATUS_DISABLED, $this->_model->getStatus());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:6,代码来源:ProductGetters.php

示例9: _canRedirect

 /**
  * Checks that the configurable product exists and can be show to the
  * customer
  * 
  * @return bool
  */
 protected function _canRedirect()
 {
     return $this->_product && $this->_product->getId() && $this->_product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_DISABLED && $this->_product->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE;
 }
开发者ID:styxiak,项目名称:Magento-SimpleRedirect,代码行数:10,代码来源:Observer.php


注:本文中的Mage_Catalog_Model_Product::getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。