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


PHP Mage_Catalog_Model_Product::getStore方法代码示例

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


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

示例1: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Google_Service_ShoppingContent_Product $shoppingProduct
  * @return Google_Service_ShoppingContent_Product
  */
 public function convertAttribute($product, $shoppingProduct)
 {
     $url = $product->getProductUrl(false);
     if ($url) {
         $config = Mage::getSingleton('googleshoppingapi/config');
         if (!Mage::getStoreConfigFlag('web/url/use_store') && $config->getAddStoreCodeToUrl()) {
             Mage::log($config->getAddStoreCodeToUrl() ? "true" : "false");
             $urlInfo = parse_url($url);
             $store = $product->getStore()->getCode();
             if (isset($urlInfo['query']) && $urlInfo['query'] != '') {
                 $url .= '&___store=' . $store;
             } else {
                 $url .= '?___store=' . $store;
             }
         }
         if ($config->getAddUtmSrcGshopping($product->getStoreId())) {
             $url .= '&utm_source=GoogleShopping';
         }
         if ($customUrlParameters = $config->getCustomUrlParameters($product->getStoreId())) {
             $url .= $customUrlParameters;
         }
         $shoppingProduct->setLink($url);
     }
     return $shoppingProduct;
 }
开发者ID:rithala,项目名称:GoogleMagento,代码行数:32,代码来源:Link.php

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

示例3: __construct

 /**
  * @param Mage_Catalog_Model_Product $product
  */
 public function __construct(Mage_Catalog_Model_Product $product)
 {
     // Get the locale of this product.  Should probably do this for all stores
     $locale = $product->getStore()->getConfig('general/locale/code');
     $this->_product = $product;
     $this->_locale = preg_split('/_/', $locale);
     $this->_currency = Mage::app()->getBaseCurrencyCode();
     $this->setData($this->_createProduct($product));
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:12,代码来源:Product.php

示例4: getUrl

 /**
  * Returns url to product image
  *
  * @param  Mage_Catalog_Model_Product $product
  * @return string|false
  */
 public function getUrl($product)
 {
     $image = $product->getData($this->getAttribute()->getAttributeCode());
     if ($image) {
         $url = Mage::app()->getStore($product->getStore())->getBaseUrl('media') . 'catalog/product/' . $image;
     } else {
         $url = false;
     }
     return $url;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:16,代码来源:Image.php

示例5: getCustomerTaxPercent

 /**
  * Retrieve current tax percent for customer based on subscription and product
  *
  * @param Adyen_Subscription_Model_Subscription $subscription
  * @param Mage_Catalog_Model_Product $product
  * @return int
  */
 public function getCustomerTaxPercent(Adyen_Subscription_Model_Subscription $subscription, Mage_Catalog_Model_Product $product)
 {
     $percent = $product->getTaxPercent();
     $includingPercent = null;
     $taxClassId = $product->getTaxClassId();
     if (is_null($percent)) {
         if ($taxClassId) {
             $request = Mage::getSingleton('tax/calculation')->getRateRequest($subscription->getShippingAddress(), $subscription->getBillingAddress(), $subscription->getCustomer()->getTaxClassId(), $product->getStore());
             $percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId));
         }
     }
     return $percent ?: 0;
 }
开发者ID:Adyen,项目名称:adyen-magento-subscription,代码行数:20,代码来源:Quote.php

示例6: getLinks

 /**
  * Get downloadable product links
  *
  * @param Mage_Catalog_Model_Product $product
  * @return array
  */
 public function getLinks($product)
 {
     if (is_null($product->getDownloadableLinks())) {
         $_linkCollection = Mage::getModel('Mage_Downloadable_Model_Link')->getCollection()->addProductToFilter($product->getId())->addTitleToResult($product->getStoreId())->addPriceToResult($product->getStore()->getWebsiteId());
         $linksCollectionById = array();
         foreach ($_linkCollection as $link) {
             /* @var Mage_Downloadable_Model_Link $link */
             $link->setProduct($product);
             $linksCollectionById[$link->getId()] = $link;
         }
         $product->setDownloadableLinks($linksCollectionById);
     }
     return $product->getDownloadableLinks();
 }
开发者ID:nemphys,项目名称:magento2,代码行数:20,代码来源:Type.php

示例7: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Google_Service_ShoppingContent_Product $shoppingProduct
  * @return Google_Service_ShoppingContent_Product
  */
 public function convertAttribute($product, $shoppingProduct)
 {
     $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
     $parentItem = Mage::getModel('catalog/product')->load($parentId);
     $cCatId = array_reverse($childItem->getCategoryIds());
     $pCatId = array_reverse($parentItem->getCategoryIds());
     $cCat = Mage::getModel('catalog/category')->load($cCatId[0]);
     $pCat = Mage::getModel('catalog/category')->load($pCatId[0]);
     $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
     if (!Mage::getStoreConfig('web/seo/use_rewrites')) {
         if ($product->getTypeId() == 'simple' && $parentItem->getTypeId() == 'configurable' || 'bundle' || 'grouped') {
             $url = $parentItem->getProductUrl(false);
         } else {
             $url = $childItem->getProductUrl(false);
         }
     } else {
         if ($product->getTypeId() == 'simple' && $parentItem->getTypeId() == 'configurable' || 'bundle' || 'grouped') {
             $url = "{$baseUrl}{$parentItem->getUrlPath($pCat)}";
         } else {
             $url = "{$baseUrl}{$product->getUrlPath($cCat)}";
         }
     }
     if ($url) {
         $config = Mage::getSingleton('googleshoppingapi/config');
         if (!Mage::getStoreConfigFlag('web/url/use_store') && $config->getAddStoreCodeToUrl()) {
             Mage::log($config->getAddStoreCodeToUrl() ? "true" : "false");
             $urlInfo = parse_url($url);
             $store = $product->getStore()->getCode();
             if (isset($urlInfo['query']) && $urlInfo['query'] != '') {
                 $url .= '&___store=' . $store;
             } else {
                 $url .= '?___store=' . $store;
             }
         }
         if ($config->getAddUtmSrcGshopping($product->getStoreId())) {
             $url .= '&utm_source=GoogleShopping';
         }
         if ($customUrlParameters = $config->getCustomUrlParameters($product->getStoreId())) {
             $url .= $customUrlParameters;
         }
         $shoppingProduct->setLink($url);
     }
     return $shoppingProduct;
 }
开发者ID:Behunin,项目名称:GoogleShoppingApi,代码行数:51,代码来源:Link.php

示例8: convertAttribute

 /**
  * Set current attribute to entry (for specified product)
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Google_Service_ShoppingContent_Product $shoppingProduct
  * @return Google_Service_ShoppingContent_Product
  */
 public function convertAttribute($product, $shoppingProduct)
 {
     $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
     $parentItem = Mage::getModel('catalog/product')->load($parentId);
     $category = Mage::getModel('catalog/category')->load();
     if (!Mage::getStoreConfig('web/seo/use_rewrites')) {
         if ($product->getTypeId() == 'simple' && $parentItem->getTypeId() == 'configurable' || 'bundle' || 'grouped') {
             $url = $parentItem->getProductUrl(false);
         } else {
             $url = $product->getProductUrl(false);
         }
     } else {
         if ($product->getTypeId() == 'simple' && $parentItem->getTypeId() == 'configurable' || 'bundle' || 'grouped') {
             $url = sprintf('%s%s', Mage::getBaseUrl(), $parentItem->getUrlPath($category));
         } else {
             $url = sprintf('%s%s', Mage::getBaseUrl(), $product->getUrlPath($category));
         }
     }
     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;
             }
         }
         $config = Mage::getSingleton('googleshoppingapi/config');
         if ($config->getAddUtmSrcGshopping($product->getStoreId())) {
             $url .= '&utm_source=GoogleShopping';
         }
         if ($customUrlParameters = $config->getCustomUrlParameters($product->getStoreId())) {
             $url .= $customUrlParameters;
         }
         $shoppingProduct->setLink($url);
     }
     return $shoppingProduct;
 }
开发者ID:Behunin,项目名称:MagentoExtensions,代码行数:46,代码来源:Link.php

示例9: addPriceIndexToProduct

 /**
  * Add price index to bundle product after load
  *
  * @param Mage_Catalog_Model_Product $product
  * @return Mage_Bundle_Model_Price_Index
  */
 public function addPriceIndexToProduct($product)
 {
     $websiteId = $product->getStore()->getWebsiteId();
     $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
     $prices = $this->_getResource()->loadPriceIndex($product->getId(), $websiteId, $groupId);
     if (isset($prices[$product->getId()])) {
         $product->setData('_price_index', true)->setData('_price_index_min_price', $prices[$product->getId()]['min_price'])->setData('_price_index_max_price', $prices[$product->getId()]['max_price']);
     }
     return $this;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:16,代码来源:Index.php

示例10: assignProduct

 /**
  * Assign Stock Status to Product
  *
  * @param Mage_Catalog_Model_Product $product
  * @param int $stockId
  * @param int $stockStatus
  * @return Mage_CatalogInventory_Model_Stock_Status
  */
 public function assignProduct(Mage_Catalog_Model_Product $product, $stockId = 1, $stockStatus = null)
 {
     if (is_null($stockStatus)) {
         $websiteId = $product->getStore()->getWebsiteId();
         $status = $this->getProductStatus($product->getId(), $websiteId, $stockId);
         $stockStatus = isset($status[$product->getId()]) ? $status[$product->getId()] : null;
     }
     $product->setIsSalable($stockStatus);
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:18,代码来源:Status.php

示例11: setProduct

 /**
  * Initialize collection parent product and add limitation join
  *
  * @param Mage_Catalog_Model_Product $product
  * @return Mage_Catalog_Model_Resource_Product_Link_Product_Collection
  */
 public function setProduct(Mage_Catalog_Model_Product $product)
 {
     $this->_product = $product;
     if ($product && $product->getId()) {
         $this->_hasLinkFilter = true;
         $this->setStore($product->getStore());
     }
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:15,代码来源:Collection.php

示例12: _applySpecialPrice

 /**
  * Apply special price for bundle
  *
  * @param   Mage_Catalog_Model_Product $product
  * @param   decimal $finalPrice
  * @return  decimal
  */
 protected function _applySpecialPrice($product, $finalPrice)
 {
     $specialPrice = $product->getSpecialPrice();
     if (is_numeric($specialPrice)) {
         $storeDate = Mage::app()->getLocale()->storeDate($product->getStore());
         $fromDate = Mage::app()->getLocale()->date($product->getSpecialFromDate(), null, null, false);
         $toDate = Mage::app()->getLocale()->date($product->getSpecialToDate(), null, null, false);
         if ($product->getSpecialFromDate() && $storeDate->compare($fromDate) < 0) {
         } elseif ($product->getSpecialToDate() && $storeDate->compare($toDate) > 0) {
         } else {
             // special price in percents
             $specialPrice = $finalPrice * $specialPrice / 100;
             $finalPrice = min($finalPrice, $specialPrice);
         }
     }
     return $finalPrice;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:24,代码来源:Price.php

示例13: _renderPrice

 protected function _renderPrice(Mage_Catalog_Model_Product $product, $price)
 {
     $store = $product->getStore();
     $convertedPrice = $store->roundPrice($store->convertPrice($price));
     $price = Mage::helper('tax')->getPrice($product, $convertedPrice);
     return Mage::helper('core')->formatPrice($price);
 }
开发者ID:EliasZ,项目名称:Ho_SimpleBundle,代码行数:7,代码来源:Data.php

示例14: _applySpecialPrice

 /**
  * Apply special price for product if not return price that was before
  *
  * @param   Mage_Catalog_Model_Product $product
  * @param   double $finalPrice
  * @return  double
  */
 protected function _applySpecialPrice($product, $finalPrice)
 {
     $specialPrice = $product->getSpecialPrice();
     if (is_numeric($specialPrice)) {
         $storeDate = Mage::app()->getLocale()->storeDate($product->getStore());
         $fromDate = Mage::app()->getLocale()->date($product->getSpecialFromDate(), null, null, false);
         $toDate = Mage::app()->getLocale()->date($product->getSpecialToDate(), null, null, false);
         if ($product->getSpecialFromDate() && $storeDate->compare($fromDate, Zend_Date::DATES) < 0) {
         } elseif ($product->getSpecialToDate() && $storeDate->compare($toDate, Zend_Date::DATES) > 0) {
         } else {
             $finalPrice = min($finalPrice, $specialPrice);
         }
     }
     return $finalPrice;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:22,代码来源:Price.php

示例15: getItemForProduct

 /**
  * Get an item in the collection for the given product using the sku
  * of the product and the configured client id and catalog id for the store
  * the product was loaded within the context of.
  * @param  Mage_Catalog_Model_Product $product
  * @return EbayEnterprise_Catalog_Model_Pim_Product
  */
 public function getItemForProduct(Mage_Catalog_Model_Product $product)
 {
     $cfg = Mage::helper('eb2ccore')->getConfigModel($product->getStore());
     return $this->getItemById($this->_formatId($product->getSku(), $cfg->clientId, $cfg->catalogId));
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:12,代码来源:Collection.php


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