本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}