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


PHP Mage_Catalog_Model_Product::getStoreId方法代码示例

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


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

示例1: createIndexData

 public function createIndexData(Mage_Catalog_Model_Product $object)
 {
     $searchEntityId = $object->getId();
     $priceAttributeId = $this->getTierPriceAttribute()->getId();
     if ($object->isGrouped()) {
         $priceAttributeId = $this->getPriceAttribute()->getId();
         $associated = $object->getTypeInstance()->getAssociatedProducts();
         $searchEntityId = array();
         foreach ($associated as $product) {
             $searchEntityId[] = $product->getId();
         }
     }
     if (!count($searchEntityId)) {
         return false;
     }
     $result = array();
     $data = array();
     $data['store_id'] = $object->getStoreId();
     $data['entity_id'] = $object->getId();
     $search['store_id'] = $object->getStoreId();
     $search['entity_id'] = $searchEntityId;
     $search['attribute_id'] = $priceAttributeId;
     foreach ($this->_customerGroups as $group) {
         $search['customer_group_id'] = $group->getId();
         $data['customer_group_id'] = $group->getId();
         $value = $this->_getResource()->getMinimalValue($search);
         if (is_null($value)) {
             continue;
         }
         $data['value'] = $value;
         $result[] = $data;
     }
     return $result;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:34,代码来源:Minimalprice.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)
 {
     $entry->cleanTaxes();
     if (Mage::helper('tax')->getConfig()->priceIncludesTax()) {
         return $entry;
     }
     $calc = Mage::helper('tax')->getCalculator();
     $customerTaxClass = $calc->getDefaultCustomerTaxClass($product->getStoreId());
     $rates = $calc->getRatesByCustomerAndProductTaxClasses($customerTaxClass, $product->getTaxClassId());
     $targetCountry = Mage::getSingleton('googleshopping/config')->getTargetCountry($product->getStoreId());
     $ratesTotal = 0;
     foreach ($rates as $rate) {
         if ($targetCountry == $rate['country']) {
             $regions = $this->_parseRegions($rate['state'], $rate['postcode']);
             $ratesTotal += count($regions);
             if ($ratesTotal > self::RATES_MAX) {
                 Mage::throwException(Mage::helper('googleshopping')->__("Google shopping only supports %d tax rates per product", self::RATES_MAX));
             }
             foreach ($regions as $region) {
                 $entry->addTax(array('tax_rate' => $rate['value'] * 100, 'tax_country' => empty($rate['country']) ? '*' : $rate['country'], 'tax_region' => $region));
             }
         }
     }
     return $entry;
 }
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:32,代码来源:Tax.php

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

示例4: 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)
 {
     $config = Mage::getSingleton('Mage_GoogleShopping_Model_Config');
     $targetCountry = $config->getTargetCountry($product->getStoreId());
     $value = $config->getCountryInfo($targetCountry, 'language', $product->getStoreId());
     return $this->_setAttribute($entry, 'content_language', self::ATTRIBUTE_TYPE_TEXT, $value);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:14,代码来源:ContentLanguage.php

示例5: 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)
 {
     $config = Mage::getSingleton('googleshoppingapi/config');
     $targetCountry = $config->getTargetCountry($product->getStoreId());
     $value = $config->getCountryInfo($targetCountry, 'language', $product->getStoreId());
     $shoppingProduct->setContentLanguage($value);
 }
开发者ID:shakhawat4g,项目名称:MagentoExtensions,代码行数:14,代码来源:ContentLanguage.php

示例6: loadProductPrices

 /**
  * Load product tier prices
  *
  * @deprecated since 1.3.2.3
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @return array
  */
 public function loadProductPrices($product, $attribute)
 {
     $websiteId = null;
     if ($attribute->isScopeGlobal()) {
         $websiteId = 0;
     } else {
         if ($product->getStoreId()) {
             $websiteId = Mage::app()->getStore($product->getStoreId())->getWebsiteId();
         }
     }
     return $this->loadPriceData($product->getId(), $websiteId);
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:21,代码来源:Tierprice.php

示例7: getProductUrl

 /**
  * Get product url
  *
  * @param  Mage_Catalog_Model_Product $product
  * @param  bool $useSid
  * @return string
  */
 public function getProductUrl($product, $useSid = true)
 {
     $cacheUrlKey = 'url_' . ($product->getCategoryId() && !$product->getDoNotUseCategoryId() ? $product->getCategoryId() : 'NONE') . '_' . intval($useSid);
     $url = $product->getData($cacheUrlKey);
     if (is_null($url)) {
         if ($product->getStoreId()) {
             $this->getUrlInstance()->setStore($product->getStoreId());
         }
         // auto add SID to URL
         $originalSid = $this->getUrlInstance()->getUseSession();
         $this->getUrlInstance()->setUseSession($useSid);
         if ($product->hasData('request_path') && $product->getRequestPath() != '') {
             $this->setData($cacheUrlKey, $this->getUrlInstance()->getDirectUrl($product->getRequestPath()));
             $this->getUrlInstance()->setUseSession($originalSid);
             return $this->getData($cacheUrlKey);
         }
         if (VPROF) {
             Varien_Profiler::start('REWRITE: ' . __METHOD__);
         }
         $rewrite = $this->getUrlRewrite();
         if ($product->getStoreId()) {
             $rewrite->setStoreId($product->getStoreId());
         } else {
             $rewrite->setStoreId(AO::app()->getStore()->getId());
         }
         $idPath = 'product/' . $product->getId();
         if ($product->getCategoryId() && !$product->getDoNotUseCategoryId() && AO::getStoreConfig('catalog/seo/product_use_categories')) {
             $idPath .= '/' . $product->getCategoryId();
         }
         $rewrite->loadByIdPath($idPath);
         //echo $this->getUrlInstance()->getBaseUrl();
         if ($rewrite->getId()) {
             $this->setData($cacheUrlKey, $this->getUrlInstance()->getDirectUrl($rewrite->getRequestPath()));
             if (VPROF) {
                 Varien_Profiler::stop('REWRITE: ' . __METHOD__);
             }
             $this->getUrlInstance()->setUseSession($originalSid);
             return $this->getData($cacheUrlKey);
         }
         if (VPROF) {
             Varien_Profiler::stop('REWRITE: ' . __METHOD__);
         }
         if (VPROF) {
             Varien_Profiler::start('REGULAR: ' . __METHOD__);
         }
         $url = $this->getUrlInstance()->getUrl('catalog/product/view', array('id' => $product->getId(), 's' => $product->getUrlKey(), 'category' => $product->getCategoryId()));
         $this->getUrlInstance()->setUseSession($originalSid);
         if (VPROF) {
             Varien_Profiler::stop('REGULAR: ' . __METHOD__);
         }
     }
     return $url;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:60,代码来源:Product_Url.php

示例8: _getItemsCollection

 /**
  * Get items which are available for update/delete when product is saved
  *
  * @param Mage_Catalog_Model_Product $product
  * @return Mage_GoogleShopping_Model_Resource_Item_Collection
  */
 protected function _getItemsCollection($product)
 {
     $items = Mage::getResourceModel('Mage_GoogleShopping_Model_Resource_Item_Collection')->addProductFilterId($product->getId());
     if ($product->getStoreId()) {
         $items->addStoreFilter($product->getStoreId());
     }
     foreach ($items as $item) {
         if (!Mage::getStoreConfigFlag('google/googleshopping/observed', $item->getStoreId())) {
             $items->removeItemByKey($item->getId());
         }
     }
     return $items;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:19,代码来源:Observer.php

示例9: afterSave

 /**
  * After Save Attribute manipulation
  *
  * @param Mage_Catalog_Model_Product $object
  * @return Mage_Catalog_Model_Product_Attribute_Backend_Price
  */
 public function afterSave($object)
 {
     $value = $object->getData($this->getAttribute()->getAttributeCode());
     /**
      * Orig value is only for existing objects
      */
     $oridData = $object->getOrigData();
     $origValueExist = $oridData && array_key_exists($this->getAttribute()->getAttributeCode(), $oridData);
     if ($object->getStoreId() != 0 || !$value || $origValueExist) {
         return $this;
     }
     if ($this->getAttribute()->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE) {
         $baseCurrency = Mage::app()->getBaseCurrencyCode();
         $storeIds = $object->getStoreIds();
         if (is_array($storeIds)) {
             foreach ($storeIds as $storeId) {
                 $storeCurrency = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
                 if ($storeCurrency == $baseCurrency) {
                     continue;
                 }
                 $rate = Mage::getModel('directory/currency')->load($baseCurrency)->getRate($storeCurrency);
                 if (!$rate) {
                     $rate = 1;
                 }
                 $newValue = $value * $rate;
                 $object->addAttributeUpdate($this->getAttribute()->getAttributeCode(), $newValue, $storeId);
             }
         }
     }
     return $this;
 }
开发者ID:nshiff,项目名称:magento-example,代码行数:37,代码来源:Price.php

示例10: setProduct

 /**
  * @param Mage_Catalog_Model_Product $productModel
  * @return Ess_M2ePro_Model_Magento_Product
  */
 public function setProduct(Mage_Catalog_Model_Product $productModel)
 {
     $this->_productModel = $productModel;
     $this->setProductId($this->_productModel->getId());
     $this->setStoreId($this->_productModel->getStoreId());
     return $this;
 }
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:11,代码来源:Product.php

示例11: setProduct

 public function setProduct(Mage_Catalog_Model_Product $product)
 {
     $store = Mage::app()->getStore($product->getStoreId());
     $product->setStore($store);
     $this->_product = $product;
     return $this;
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:7,代码来源:Abstract.php

示例12: 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)
 {
     $destInfo = Mage::getSingleton('googleshoppingapi/config')->getDestinationsInfo($product->getStoreId());
     //         $shoppingProduct->setDestinationsMode($destInfo);
     // TODO: implement support for destinations
     //array(3) { ["ProductSearch"]=> NULL ["ProductAds"]=> NULL ["CommerceSearch"]=> NULL }
     return $shoppingProduct;
 }
开发者ID:shakhawat4g,项目名称:MagentoExtensions,代码行数:15,代码来源:Destinations.php

示例13: 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)
 {
     $entry->cleanTaxes();
     if (Mage::helper('Mage_Tax_Helper_Data')->getConfig()->priceIncludesTax()) {
         return $entry;
     }
     $calc = Mage::helper('Mage_Tax_Helper_Data')->getCalculator();
     $customerTaxClass = $calc->getDefaultCustomerTaxClass($product->getStoreId());
     $rates = $calc->getRatesByCustomerAndProductTaxClasses($customerTaxClass, $product->getTaxClassId());
     $targetCountry = Mage::getSingleton('Mage_GoogleShopping_Model_Config')->getTargetCountry($product->getStoreId());
     foreach ($rates as $rate) {
         if ($targetCountry == $rate['country']) {
             $entry->addTax(array('tax_rate' => $rate['value'] * 100, 'tax_country' => empty($rate['country']) ? '*' : $rate['country'], 'tax_region' => empty($rate['state']) ? '*' : $rate['state']));
         }
     }
     return $entry;
 }
开发者ID:relue,项目名称:magento2,代码行数:24,代码来源:Tax.php

示例14: loadGallery

 /**
  * Load gallery images for product
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Catalog_Model_Product_Attribute_Backend_Media $object
  * @return array
  */
 public function loadGallery($product, $object)
 {
     // Select gallery images for product
     $select = $this->_getReadAdapter()->select()->from(array('main' => $this->getMainTable()), array('value_id', 'value AS file'))->joinLeft(array('value' => $this->getTable(self::GALLERY_VALUE_TABLE)), 'main.value_id=value.value_id AND value.store_id=' . (int) $product->getStoreId(), array('label', 'position', 'disabled'))->joinLeft(array('default_value' => $this->getTable(self::GALLERY_VALUE_TABLE)), 'main.value_id=default_value.value_id AND default_value.store_id=0', array('label_default' => 'label', 'position_default' => 'position', 'disabled_default' => 'disabled'))->where('main.attribute_id = ?', $object->getAttribute()->getId())->where('main.entity_id = ?', $product->getId())->order('IF(value.position IS NULL, default_value.position, value.position) ASC');
     $result = $this->_getReadAdapter()->fetchAll($select);
     $this->_removeDuplicates($result);
     return $result;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:15,代码来源:Resource_Eav_Mysql4_Product_Attribute_Backend_Media.php

示例15: 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)
 {
     $targetCountry = Mage::getSingleton('Mage_GoogleShopping_Model_Config')->getTargetCountry($product->getStoreId());
     $value = Mage::getModel('Mage_GoogleShopping_Model_Type')->loadByAttributeSetId($product->getAttributeSetId(), $targetCountry);
     $val = $value->getCategory() == Mage_GoogleShopping_Helper_Category::CATEGORY_OTHER ? '' : $value->getCategory();
     $this->_setAttribute($entry, 'google_product_category', self::ATTRIBUTE_TYPE_TEXT, htmlspecialchars_decode($val, ENT_NOQUOTES));
     return $entry;
 }
开发者ID:relue,项目名称:magento2,代码行数:15,代码来源:GoogleProductCategory.php


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