本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例11: setProduct
public function setProduct(Mage_Catalog_Model_Product $product)
{
$store = Mage::app()->getStore($product->getStoreId());
$product->setStore($store);
$this->_product = $product;
return $this;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}