本文整理汇总了PHP中Mage_Catalog_Model_Product::unsetData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Product::unsetData方法的具体用法?PHP Mage_Catalog_Model_Product::unsetData怎么用?PHP Mage_Catalog_Model_Product::unsetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Product
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Product::unsetData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSelectionFinalPrice
/**
* Obtain final price of selection in a bundle product
*
* @param Mage_Catalog_Model_Product_Configuration_Item_Interface $item
* @param Mage_Catalog_Model_Product $selectionProduct
*
* @return decimal
*/
public function getSelectionFinalPrice(Mage_Catalog_Model_Product_Configuration_Item_Interface $item, $selectionProduct)
{
$selectionProduct->unsetData('final_price');
return $item->getProduct()->getPriceModel()->getSelectionFinalTotalPrice($item->getProduct(), $selectionProduct, $item->getQty() * 1, $this->getSelectionQty($item->getProduct(), $selectionProduct->getSelectionId()), false, true);
}
示例2: testIsSalable
public function testIsSalable()
{
$this->_product->unsetData('is_salable');
$this->assertTrue($this->_model->isSalable($this->_product));
}
示例3: generateProductUrl
/**
* Generates url for a product
*
* @param Mage_Catalog_Model_Product $product
* @param Mage_Core_Model_Store $store
*
* @return string the url.
*/
public function generateProductUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
{
// Unset the cached url first, as it won't include the `___store` param
// if it's cached. We need to define the specific store view in the url
// in case the same domain is used for all sites.
$product->unsetData('url');
/** @var Nosto_Tagging_Helper_Data $helper */
$helper = Mage::helper('nosto_tagging');
$url_params = array('_nosid' => true, '_ignore_category' => true, '_store' => $store->getId(), '_store_to_url' => true);
$product_url = $product->getUrlInStore($url_params);
if ($helper->getUsePrettyProductUrls($store)) {
$product_url = $this->removeQueryParamFromUrl($product_url, '___store');
}
return $product_url;
}
示例4: buildUrl
/**
* Builds the absolute store front url for the product page.
*
* The url includes the "___store" GET parameter in order for the Nosto
* crawler to distinguish between stores that do not have separate domains
* or paths.
*
* @param Mage_Catalog_Model_Product $product the product model.
* @param Mage_Core_Model_Store $store the store model.
*
* @return string
*/
protected function buildUrl(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store)
{
// Unset the cached url first, as it won't include the `___store` param
// if it's cached. We need to define the specific store view in the url
// in case the same domain is used for all sites.
$product->unsetData('url');
return $product->getUrlInStore(array('_nosid' => true, '_ignore_category' => true, '_store' => $store->getCode()));
}
示例5: loadData
/**
* Loads the product info from a Magento product model.
*
* @param Mage_Catalog_Model_Product $product the product model.
* @param Mage_Core_Model_Store|null $store the store to get the product data for.
*/
public function loadData(Mage_Catalog_Model_Product $product, Mage_Core_Model_Store $store = null)
{
if (is_null($store)) {
$store = Mage::app()->getStore();
}
// Unset the cached url first, as it won't include the `___store` param
// if it's cached. We need to define the specific store view in the url
// in case the same domain is used for all sites.
$this->_url = $product->unsetData('url')->getUrlInStore(array('_nosid' => true, '_ignore_category' => true, '_store' => $store->getCode()));
$this->_productId = $product->getId();
$this->_name = $product->getName();
$this->_imageUrl = $this->buildImageUrl($product, $store);
$this->_price = Mage::helper('tax')->getPrice($product, Mage::helper('nosto_tagging/price')->getProductFinalPrice($product), true);
$this->_listPrice = Mage::helper('tax')->getPrice($product, Mage::helper('nosto_tagging/price')->getProductPrice($product), true);
$this->_currencyCode = $store->getCurrentCurrencyCode();
$this->_availability = $product->isAvailable() ? self::PRODUCT_IN_STOCK : self::PRODUCT_OUT_OF_STOCK;
if (Mage::helper('core')->isModuleEnabled('Mage_Tag')) {
$tagCollection = Mage::getModel('tag/tag')->getCollection()->addPopularity()->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED)->addProductFilter($product->getId())->setFlag('relation', true)->addStoreFilter($store->getId())->setActiveFilter();
foreach ($tagCollection as $tag) {
$this->_tags[] = $tag->getName();
}
}
if (!$product->canConfigure()) {
$this->_tags[] = self::PRODUCT_ADD_TO_CART;
}
$this->_categories = $this->getProductCategories($product);
$this->_shortDescription = (string) $product->getShortDescription();
$this->_description = (string) $product->getDescription();
$this->_brand = $product->getManufacturer() ? (string) $product->getAttributeText('manufacturer') : '';
$this->_datePublished = $product->getCreatedAt();
}
示例6: processProduct
/**
* Update product url key
*
* @param Mage_Catalog_Model_Product $product
* @param string $newUrlKey
* @param int $storeId
*/
function processProduct($product, $newUrlKey, $storeId)
{
$store = Mage::app()->getStore();
Mage::app()->setCurrentStore(Mage::app()->getStore(0));
if (!$this->isEntityProcessed(self::ENTITY_TYPE_PRODUCT, $product->getId() . '-' . $storeId) && !preg_match('~-[a-f0-9]{32}$~i', $newUrlKey)) {
$product->setStoreId($storeId ? $storeId : null);
$product->setUrlKey($newUrlKey . '-' . md5($product->getStoreId() . $product->getId()));
$product->save();
$this->_reindexProduct($product->getId());
$product->unsetData('request_path');
$product->unsetData('url');
$this->markEntityProcessed(self::ENTITY_TYPE_PRODUCT, $product->getId() . '-' . $product->getStoreId());
}
Mage::app()->setCurrentStore($store);
}