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


PHP Mage_Catalog_Model_Product::getName方法代码示例

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


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

示例1: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Varien_Gdata_Gshopping_Entry $entry
  * @return Varien_Gdata_Gshopping_Entry
  */
 public function convertAttribute($product, $entry)
 {
     $url = $product->getProductUrl(false);
     if ($url) {
         if (!Mage::getStoreConfigFlag('web/url/use_store')) {
             $urlInfo = parse_url($url);
             $store = $product->getStore()->getCode();
             if (isset($urlInfo['query']) && $urlInfo['query'] != '') {
                 $url .= '&___store=' . $store;
             } else {
                 $url .= '?___store=' . $store;
             }
         }
         $links = $entry->getLink();
         if (!is_array($links)) {
             $links = array();
         }
         $link = $entry->getService()->newLink();
         $link->setHref($url);
         $link->setRel('alternate');
         $link->setType('text/html');
         if ($product->getName()) {
             $link->setTitle($product->getName());
         }
         $links[0] = $link;
         $entry->setLink($links);
     }
     return $entry;
 }
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:36,代码来源:Link.php

示例2: getSelectionQtyTitlePrice

 /**
  * Returns the formatted string for the quantity chosen for the given selection
  *
  * @param Mage_Catalog_Model_Product $_selection
  * @param bool                       $includeContainer
  * @return string
  */
 public function getSelectionQtyTitlePrice(Mage_Catalog_Model_Product $_selection, $includeContainer = true)
 {
     if ($this->isGuestView()) {
         return $_selection->getSelectionQty() * 1 . ' x ' . $this->escapeHtml($_selection->getName());
     }
     return parent::getSelectionQtyTitlePrice($_selection, $includeContainer);
 }
开发者ID:ryaan-anthony,项目名称:magento-members-only,代码行数:14,代码来源:TOption.php

示例3: getItemBaseInfo

 public function getItemBaseInfo()
 {
     $helper = Mage::helper('catalog/image');
     $helper->init($this->product, $this->getProductImageType())->keepAspectRatio($this->_keepAspectRatio)->keepFrame($this->_keepFrame);
     $this->item['item_id'] = $this->product->getId();
     $this->item['item_title'] = $this->product->getName();
     $this->item['item_url'] = $this->product->getProductUrl();
     $this->item['cid'] = $this->product->getCategoryIds();
     $this->item['qty'] = $this->product->getStockItem()->getQty();
     $this->item['thumbnail_pic_url'] = (string) $helper->resize($this->thumbnail_with, $this->thumbnail_height);
     $this->item['main_pic_url'] = (string) $helper->resize($this->main_with, $this->main_height);
     $this->item['is_virtual'] = $this->product->isVirtual();
     $this->item['item_status'] = $this->product->isSaleable() ? 'instock' : 'outofstock';
     if (!$this->product->getRatingSummary()) {
         Mage::getModel('review/review')->getEntitySummary($this->product, Mage::app()->getStore()->getId());
     }
     $this->item['allow_add_to_cart'] = !$this->HasOptions();
     $this->item['rating_score'] = round((int) $this->product->getRatingSummary()->getRatingSummary() / 20);
     $this->item['rating_count'] = $this->product->getRatingSummary()->getReviewsCount();
     $this->item['sales_type'] = $this->product->isInStock() ? 'stock' : 'distribute';
     $this->item['qty_min_unit'] = 1;
     $stockItem = $this->product->getStockItem();
     if ($stockItem) {
         if ($stockItem->getMinSaleQty() && $stockItem->getMinSaleQty() > 0) {
             $this->item['qty_min_unit'] = $stockItem->getMinSaleQty();
         }
     }
     $this->item['item_type'] = $this->product->getTypeId();
     return $this->item;
 }
开发者ID:guohuadeng,项目名称:stampApp,代码行数:30,代码来源:ItemController.php

示例4: purge

 /**
  * Purge product
  *
  * @param Mage_Catalog_Model_Product $product
  * @param bool $purgeParentProducts
  * @param bool $purgeCategories
  * @return Phoenix_VarnishCache_Model_Control_Catalog_Product
  */
 public function purge(Mage_Catalog_Model_Product $product, $purgeParentProducts = false, $purgeCategories = false)
 {
     if ($this->_canPurge()) {
         $idsToPurge = array();
         $categoryIdsToPurge = array();
         $idsToPurge[] = $product->getId();
         $this->_getSession()->addSuccess(Mage::helper('varnishcache')->__('Varnish cache for "%s" has been purged.', $product->getName()));
         if ($purgeParentProducts) {
             // purge parent products
             $productRelationCollection = $this->_getProductRelationCollection()->filterByChildId($product->getId());
             foreach ($productRelationCollection as $productRelation) {
                 $idsToPurge[] = $productRelation->getParentId();
             }
             // purge categories of parent products
             if ($purgeCategories) {
                 $categoryProductCollection = $this->_getCategoryProductRelationCollection()->filterAllByProductIds($productRelationCollection->getAllIds());
                 foreach ($categoryProductCollection as $categoryProduct) {
                     $categoryIdsToPurge[] = $categoryProduct->getCategoryId();
                 }
             }
         }
         $this->_purgeByIds($idsToPurge);
         if ($purgeCategories) {
             foreach ($product->getCategoryCollection() as $category) {
                 $categoryIdsToPurge[] = $category->getId();
             }
             $this->_getSession()->addSuccess(Mage::helper('varnishcache')->__('Varnish cache for the product\'s categories has been purged.'));
         }
         $this->_purgeCategoriesByIds($categoryIdsToPurge);
     }
     return $this;
 }
开发者ID:rob3000,项目名称:Magento-PageCache-powered-by-Varnish,代码行数:40,代码来源:Product.php

示例5: _prepareProduct

 /**
  * Processes the product and its options before adding it to a quote or a wishlist
  *
  * @param Varien_Object              $buyRequest  request object
  * @param Mage_Catalog_Model_Product $product     product ibject
  * @param string                     $processMode process mode: strict for cart, lite for wishlist
  *
  * @return array|string
  */
 protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode)
 {
     if ($this->_isStrictProcessMode($processMode)) {
         return Mage::helper('solvingmagento_affiliateproduct')->__('Affiliate product %s cannot be added to cart. ' . ' On the product detail page click the "Go to parent site" button to access the product.', $product->getName());
     }
     return parent::_prepareProduct($buyRequest, $product, $processMode);
 }
开发者ID:hafeez3000,项目名称:Solvingmagento_AffiliateProduct,代码行数:16,代码来源:Type.php

示例6: _collectProductInfo

 /**
  * Collect the basic information about the product and return it as an array.
  *
  * @param Mage_Catalog_Model_Product $product
  * @return array
  */
 protected function _collectProductInfo(Mage_Catalog_Model_Product $product)
 {
     //basic product info, same for every possible product type
     $productInfo = array('id' => $product->getId(), 'type' => $product->getTypeId(), 'name' => $product->getName(), 'saleable' => $product->isSaleable(), 'price' => Mage::helper('tax')->getPrice($product, $product->getFinalPrice()), 'priceTemplate' => $this->getPriceTemplate());
     $manufacturer = $this->_getManufacturer($product);
     if ($manufacturer) {
         $productInfo['manufacturer'] = $manufacturer;
     }
     //if product has active special price
     if ($oldPrice = $this->getOldPrice($product)) {
         $productInfo['oldPrice'] = $oldPrice;
     }
     //allowed sale quantities
     if ($qtyLimits = $this->getProductQtyLimits($product)) {
         list($minQty, $maxQty) = $qtyLimits;
         if ($minQty !== null) {
             $productInfo['minqty'] = $minQty;
         }
         if ($maxQty !== null) {
             $productInfo['maxqty'] = $maxQty;
         }
     }
     //add product tax info
     if ($taxInfo = $this->getProductTax($product)) {
         $productInfo['tax'] = $taxInfo;
     }
     //get additional info, if possible
     //this may be different for various product types
     $productInfo = $this->_collectAdditionalProductInfo($product, $productInfo);
     return $productInfo;
 }
开发者ID:styladev,项目名称:magentoStylaConnect,代码行数:37,代码来源:Abstract.php

示例7: getUpdateListingWrapper

 public function getUpdateListingWrapper(Mage_Catalog_Model_Product $product)
 {
     $reverbListingWrapper = Mage::getModel('reverbSync/wrapper_listing');
     $sku = $product->getSku();
     // $condition = $this->_getCondition();
     $fieldsArray = array('sku' => $sku);
     if ($this->_getListingsUpdateSyncHelper()->isTitleUpdateEnabled()) {
         $fieldsArray['title'] = $product->getName();
     }
     if ($this->_getListingsUpdateSyncHelper()->isPriceUpdateEnabled()) {
         $fieldsArray['price'] = $this->getProductPrice($product);
     }
     if ($this->_getListingsUpdateSyncHelper()->isDescriptionUpdateEnabled()) {
         $fieldsArray['description'] = $this->getProductDescription($product);
     }
     if ($this->_getListingsUpdateSyncHelper()->isInventoryQtyUpdateEnabled()) {
         $hasInventory = $this->_getHasInventory();
         $fieldsArray['has_inventory'] = $hasInventory;
         $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
         $fieldsArray['inventory'] = $stock->getQty();
     }
     $this->_addMappedAttributes($fieldsArray, $product);
     $this->_addArbitraryMappedAttributes($fieldsArray, $product);
     $this->_addProductAcceptOffers($fieldsArray, $product);
     $this->addCategoryToFieldsArray($fieldsArray, $product);
     $this->addProductConditionIfSet($fieldsArray, $product);
     $reverbListingWrapper->setApiCallContentData($fieldsArray);
     $reverbListingWrapper->setMagentoProduct($product);
     return $reverbListingWrapper;
 }
开发者ID:zztimur,项目名称:reverb-magento,代码行数:30,代码来源:Product.php

示例8: productToXmlObject

 /**
  * Retrieve product attributes as xml object
  *
  * @param Mage_Catalog_Model_Product $product
  * @param string $itemNodeName
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function productToXmlObject(Mage_Catalog_Model_Product $product, $itemNodeName = 'item')
 {
     /** @var $item Mage_XmlConnect_Model_Simplexml_Element */
     $item = Mage::getModel('xmlconnect/simplexml_element', '<' . $itemNodeName . '></' . $itemNodeName . '>');
     if ($product && $product->getId()) {
         $item->addChild('entity_id', $product->getId());
         $item->addChild('name', $item->escapeXml($product->getName()));
         $item->addChild('entity_type', $product->getTypeId());
         $item->addChild('short_description', $item->escapeXml($product->getShortDescription()));
         $description = Mage::helper('xmlconnect')->htmlize($item->xmlentities($product->getDescription()));
         $item->addChild('description', $description);
         $item->addChild('link', $product->getProductUrl());
         if ($itemNodeName == 'item') {
             $imageToResize = Mage::helper('xmlconnect/image')->getImageSizeForContent('product_small');
             $propertyToResizeName = 'small_image';
         } else {
             $imageToResize = Mage::helper('xmlconnect/image')->getImageSizeForContent('product_big');
             $propertyToResizeName = 'image';
         }
         $icon = clone Mage::helper('catalog/image')->init($product, $propertyToResizeName)->resize($imageToResize);
         $iconXml = $item->addChild('icon', $icon);
         $file = Mage::helper('xmlconnect')->urlToPath($icon);
         $iconXml->addAttribute('modification_time', filemtime($file));
         $item->addChild('in_stock', (int) $product->getIsInStock());
         $item->addChild('is_salable', (int) $product->isSalable());
         /**
          * By default all products has gallery (because of collection not load gallery attribute)
          */
         $hasGallery = 1;
         if ($product->getMediaGalleryImages()) {
             $hasGallery = sizeof($product->getMediaGalleryImages()) > 0 ? 1 : 0;
         }
         $item->addChild('has_gallery', $hasGallery);
         /**
          * If product type is grouped than it has options as its grouped items
          */
         if ($product->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE || $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
             $product->setHasOptions(true);
         }
         $item->addChild('has_options', (int) $product->getHasOptions());
         if ($minSaleQty = $this->_getMinimalQty($product)) {
             $item->addChild('min_sale_qty', (int) $minSaleQty);
         }
         if (!$product->getRatingSummary()) {
             Mage::getModel('review/review')->getEntitySummary($product, Mage::app()->getStore()->getId());
         }
         $item->addChild('rating_summary', round((int) $product->getRatingSummary()->getRatingSummary() / 10));
         $item->addChild('reviews_count', $product->getRatingSummary()->getReviewsCount());
         if ($this->getChild('product_price')) {
             $this->getChild('product_price')->setProduct($product)->setProductXmlObj($item)->collectProductPrices();
         }
         if ($this->getChild('additional_info')) {
             $this->getChild('additional_info')->addAdditionalData($product, $item);
         }
     }
     return $item;
 }
开发者ID:rajanlamic,项目名称:OpenArtist,代码行数:64,代码来源:Product.php

示例9: setName

 /**
  * set name
  */
 public function setName()
 {
     $parentName = Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_EXPORT_PARENT_PRODUCT_NAME);
     if ($parentName && $this->_parent != null) {
         $name = $this->_parent->getName();
     } else {
         $name = $this->item->getName();
     }
     parent::setName($name);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:13,代码来源:Xml.php

示例10: importCatalogProduct

 /**
  * Import item data from product model object
  *
  * @param   Mage_Catalog_Model_Product $product
  * @return  Mage_Sales_Model_Quote_Item
  */
 public function importCatalogProduct(Mage_Catalog_Model_Product $product)
 {
     $this->setProductId($product->getId())->setSku($product->getSku())->setName($product->getName())->setWeight($product->getWeight())->setTaxClassId($product->getTaxClassId())->setCost($product->getCost())->setIsQtyDecimal($product->getIsQtyDecimal());
     if ($product->getSuperProduct()) {
         $this->setSuperProductId($product->getSuperProduct()->getId());
         if ($product->getSuperProduct()->isConfigurable()) {
             $this->setName($product->getSuperProduct()->getName());
         }
     }
     $this->setProduct($product);
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:18,代码来源:Abstract.php

示例11: beforeSave

 /**
  * Format url_key value
  *
  * @param Mage_Catalog_Model_Product $object
  * @return Mage_Catalog_Model_Product_Attribute_Backend_Urlkey
  */
 public function beforeSave($object)
 {
     $attributeName = $this->getAttribute()->getName();
     $urlKey = $object->getData($attributeName);
     if ($urlKey === false) {
         return $this;
     }
     if ($urlKey == '') {
         $urlKey = $object->getName();
     }
     $urlKey = $object->formatUrlKey($urlKey);
     if (empty($urlKey)) {
         $urlKey = Mage::helper('core')->uniqHash();
     }
     $object->setData($attributeName, $urlKey);
     $this->_validateUrlKey($object);
     return $this;
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:24,代码来源:Urlkey.php

示例12: 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

示例13: _getBreadcrumbPath

 /**
  * Return current category path or get it from current category
  * and creating array of categories|product paths for breadcrumbs
  *
  * @return string
  */
 protected function _getBreadcrumbPath()
 {
     $path = array();
     if ($category = $this->_getProductBreadcrumbCategory()) {
         $pathInStore = $category->getPathInStore();
         $pathIds = array_reverse(explode(',', $pathInStore));
         $categories = $category->getParentCategories();
         // add category path breadcrumb
         foreach ($pathIds as $categoryId) {
             if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
                 $path['category' . $categoryId] = array('label' => $categories[$categoryId]->getName(), 'link' => $categories[$categoryId]->getUrl());
             }
         }
     }
     if ($this->_currentProduct) {
         $path['product'] = array('label' => $this->_currentProduct->getName());
     }
     $this->_categoryPath = $path;
     return $this->_categoryPath;
 }
开发者ID:Atwix,项目名称:ExtendedBreadcrumbs,代码行数:26,代码来源:Data.php

示例14: getProductEntity

 /**
  * Inflate an API object from a product object
  *
  * @param Mage_Catalog_Model_Product $product       Product
  * @param int                        $storeId       Magento store ID
  * @param bool                       $includeExtras Retrieve all information
  *
  * @return array
  */
 public function getProductEntity(Mage_Catalog_Model_Product $product, $storeId, $includeExtras = true)
 {
     $result = array();
     $result['entity_id'] = $product->getEntityId();
     $result['sku'] = $product->getSku();
     $result['name'] = $product->getName();
     $result['price'] = $product->getPrice();
     $result['special_price'] = $product->getSpecialPrice();
     $result['special_from_date'] = $product->getSpecialFromDate();
     $result['special_to_date'] = $product->getSpecialToDate();
     $result['cost'] = $product->getCost();
     $result['description'] = $product->getDescription();
     $result['short_description'] = $product->getShortDescription();
     $result['weight'] = $product->getWeight();
     if ($product->isVisibleInSiteVisibility()) {
         $result['url_path'] = $this->_getProductUrlWithCache($product);
     }
     $parentProduct = $this->_getParentProduct($product);
     if ($parentProduct != null) {
         $result['parent_id'] = $parentProduct->getEntityId();
         $result['parent_sku'] = $parentProduct->getSku();
         if (!$product->isVisibleInSiteVisibility()) {
             $result['name'] = $parentProduct->getName();
             if ($parentProduct->isVisibleInSiteVisibility()) {
                 $result['url_path'] = $this->_getProductUrlWithCache($parentProduct);
             }
         }
         if ($includeExtras && $this->_isConfigurableProduct($parentProduct)) {
             $result['purchasable'] = $this->_isPurchasable($product, $parentProduct);
             /* @var Mage_Catalog_Model_Product_Type_Configurable $typeInst */
             $typeInst = $parentProduct->getTypeInstance(true);
             $attributes = $typeInst->getUsedProductAttributes($parentProduct);
             /* @var Mage_Eav_Model_Entity_Attribute_Abstract $attribute */
             foreach ($attributes as $attribute) {
                 if (!array_key_exists('configurable_attributes', $result)) {
                     $result['configurable_attributes'] = array();
                 }
                 $result['configurable_attributes'][] = array('attribute_name' => $attribute->getAttributeCode());
             }
         }
     }
     if (!isset($result['purchasable'])) {
         $result['purchasable'] = $this->_isPurchasable($product);
     }
     $images = $this->_getProductImages($product);
     if (isset($images['image'])) {
         $result['image'] = $images['image'];
     }
     if (isset($images['small_image'])) {
         $result['small_image'] = $images['small_image'];
     }
     if (isset($images['thumbnail'])) {
         $result['thumbnail'] = $images['thumbnail'];
     }
     if ($includeExtras) {
         $metas = $this->_getMetas($storeId, $product, $parentProduct);
         if ($metas != null) {
             /*if (isset($metas['meta3'])) {
                   $result['meta3'] = $metas['meta3'];
               }*/
             if (isset($metas['meta4'])) {
                 $result['meta4'] = $metas['meta4'];
             }
             if (isset($metas['meta5'])) {
                 $result['meta5'] = $metas['meta5'];
             }
         }
         //Custom for Sportys
         $stores = array();
         foreach ($product->getStoreIds() as $storeID) {
             $store = Mage::getModel('core/store')->load($storeID);
             $stores[] = $store->getCode();
         }
         $result["meta3"] = implode(',', $stores);
         // Brand and Category
         $brandCatProduct = $product;
         if ($parentProduct && !$product->isVisibleInSiteVisibility()) {
             $brandCatProduct = $parentProduct;
         }
         $setSettings = $this->_getProductAttributeSetSettings($brandCatProduct);
         if ($setSettings['brandAttribute'] != null) {
             $result['brand'] = $this->_getProductAttribute($brandCatProduct, $setSettings['brandAttribute']);
         }
         if ($setSettings['catFromMagento']) {
             $cats = $this->_getCategoryInformation($storeId, $brandCatProduct);
             if (isset($cats['category'])) {
                 $result['category'] = $cats['category'];
             }
             if (isset($cats['sub_category'])) {
                 $result['sub_category'] = $cats['sub_category'];
             }
//.........这里部分代码省略.........
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:101,代码来源:Product.php

示例15: getProductEntity

 public function getProductEntity(Mage_Catalog_Model_Product $product, $storeId, $includeExtras = true)
 {
     $result = array();
     $result['entity_id'] = $product->getEntityId();
     $result['sku'] = $product->getSku();
     $result['name'] = $product->getName();
     $result['price'] = $product->getPrice();
     $result['special_price'] = $product->getSpecialPrice();
     $result['special_from_date'] = $product->getSpecialFromDate();
     $result['special_to_date'] = $product->getSpecialToDate();
     $result['cost'] = $product->getCost();
     $result['description'] = $product->getDescription();
     $result['short_description'] = $product->getShortDescription();
     $result['weight'] = $product->getWeight();
     if ($product->isVisibleInSiteVisibility()) {
         $result['url_path'] = $this->_getProductUrlWithCache($product);
     }
     $parentProduct = $this->_getParentProduct($product);
     if ($parentProduct != null) {
         $result['parent_id'] = $parentProduct->getEntityId();
         $result['parent_sku'] = $parentProduct->getSku();
         if (!$product->isVisibleInSiteVisibility()) {
             $result['name'] = $parentProduct->getName();
             if ($parentProduct->isVisibleInSiteVisibility()) {
                 $result['url_path'] = $this->_getProductUrlWithCache($parentProduct);
             }
         }
         if ($includeExtras && Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId()) {
             $result['purchasable'] = $this->_isPurchasable($product, $parentProduct);
             $attributes = $parentProduct->getTypeInstance(true)->getUsedProductAttributes($parentProduct);
             $freshProduct = null;
             foreach ($attributes as $attribute) {
                 if (!array_key_exists('configurable_attributes', $result)) {
                     $result['configurable_attributes'] = array();
                 }
                 $attr = array();
                 $attr['attribute_name'] = $attribute->getFrontend()->getLabel();
                 $attr['value'] = $product->getAttributeText($attribute->getAttributeCode());
                 if (empty($attr['value'])) {
                     // use the EAV tables only if the flat table doesn't work
                     if ($freshProduct == null) {
                         $freshProduct = Mage::getModel('catalog/product')->load($product->getEntityId());
                     }
                     $attr['value'] = $attribute->getFrontend()->getValue($freshProduct);
                 }
                 $result['configurable_attributes'][] = $attr;
             }
         }
     }
     if (!isset($result['purchasable'])) {
         $result['purchasable'] = $this->_isPurchasable($product);
     }
     $images = $this->_getProductImages($product);
     if (isset($images['image'])) {
         $result['image'] = $images['image'];
     }
     if (isset($images['small_image'])) {
         $result['small_image'] = $images['small_image'];
     }
     if (isset($images['thumbnail'])) {
         $result['thumbnail'] = $images['thumbnail'];
     }
     if ($includeExtras) {
         // Metas
         $metas = $this->_getMetas($storeId, $product, $parentProduct);
         if ($metas != null) {
             //if(isset($metas['meta1'])) $result['meta1'] = $metas['meta1'];
             //if(isset($metas['meta2'])) $result['meta2'] = $metas['meta2'];
             //if(isset($metas['meta3'])) $result['meta3'] = $metas['meta3'];
             //if(isset($metas['meta4'])) $result['meta4'] = $metas['meta4'];
             if (isset($metas['meta5'])) {
                 $result['meta5'] = $metas['meta5'];
             }
         }
         //Custom For ST Bernard Sports
         // Set IsNew Flag if product is less then 45 days old.
         $result['meta4'] = strtotime($product->getCreatedAt()) + 45 * 24 * 60 * 60 < time() ? "False" : "True";
         // Brand and Category
         $brandAndCategoryProduct = !$parentProduct || $product->isVisibleInSiteVisibility() ? $product : $parentProduct;
         $setSettings = $this->_getProductAttributeSetSettings($brandAndCategoryProduct);
         if ($setSettings['brandAttribute'] != null) {
             $result['brand'] = $brandAndCategoryProduct->getAttributeText($setSettings['brandAttribute']);
         }
         if ($setSettings['catFromMagento']) {
             $cats = $this->_getCategoryInformation($storeId, $brandAndCategoryProduct);
             if (isset($cats['category'])) {
                 $result['category'] = $cats['category'];
             }
             if (isset($cats['sub_category'])) {
                 $result['sub_category'] = $cats['sub_category'];
             }
             //Custom For ST Bernard Sports
             if (isset($cats['third_category'])) {
                 $result['meta3'] = $cats['third_category'];
             }
         } else {
             if ($setSettings['catFromAttributes']) {
                 if ($setSettings['categoryAttribute'] != null) {
                     $result['category'] = $brandAndCategoryProduct->getAttributeText($setSettings['categoryAttribute']);
                 }
//.........这里部分代码省略.........
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:101,代码来源:Product.php


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