本文整理汇总了PHP中Mage_Catalog_Model_Product::getSpecialPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Product::getSpecialPrice方法的具体用法?PHP Mage_Catalog_Model_Product::getSpecialPrice怎么用?PHP Mage_Catalog_Model_Product::getSpecialPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Product
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Product::getSpecialPrice方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPriceFromChild
/**
* @param Mage_Catalog_Model_Product $child
* @return $this
* @throws InvalidArgumentException
*/
public function setPriceFromChild(Mage_Catalog_Model_Product $child)
{
if ($child === null) {
throw new InvalidArgumentException("Product passed is a non-object");
}
$price = $child->getPrice();
$specialPrice = $child->getSpecialPrice();
$specialFrom = $child->getSpecialFromDate();
$specialTo = $child->getSpecialToDate();
$this->setPrice($price, $specialPrice, $specialFrom, $specialTo);
$this->_priceChild = $child;
return $this;
}
示例2: getProductData
/**
* Create Product array from Mage_Catalog_Model_Product
*
* @param Mage_Catalog_Model_Product $product
* @return array
*/
public function getProductData(Mage_Catalog_Model_Product $product)
{
try {
$data = array('url' => $product->getProductUrl(), 'title' => htmlspecialchars($product->getName()), 'spider' => 1, 'price' => $product->getPrice(), 'description' => urlencode($product->getDescription()), 'tags' => htmlspecialchars($product->getMetaKeyword()), 'images' => array(), 'vars' => array('sku' => $product->getSku(), 'storeId' => '', 'typeId' => $product->getTypeId(), 'status' => $product->getStatus(), 'categoryId' => $product->getCategoryId(), 'categoryIds' => $product->getCategoryIds(), 'websiteIds' => $product->getWebsiteIds(), 'storeIds' => $product->getStoreIds(), 'groupPrice' => $product->getGroupPrice(), 'formatedPrice' => $product->getFormatedPrice(), 'calculatedFinalPrice' => $product->getCalculatedFinalPrice(), 'minimalPrice' => $product->getMinimalPrice(), 'specialPrice' => $product->getSpecialPrice(), 'specialFromDate' => $product->getSpecialFromDate(), 'specialToDate' => $product->getSpecialToDate(), 'relatedProductIds' => $product->getRelatedProductIds(), 'upSellProductIds' => $product->getUpSellProductIds(), 'getCrossSellProductIds' => $product->getCrossSellProductIds(), 'isSuperGroup' => $product->isSuperGroup(), 'isGrouped' => $product->isGrouped(), 'isConfigurable' => $product->isConfigurable(), 'isSuper' => $product->isSuper(), 'isSalable' => $product->isSalable(), 'isAvailable' => $product->isAvailable(), 'isVirtual' => $product->isVirtual(), 'isRecurring' => $product->isRecurring(), 'isInStock' => $product->isInStock(), 'weight' => $product->getSku()));
// Add product images
if (self::validateProductImage($product->getImage())) {
$data['images']['full'] = array("url" => $product->getImageUrl());
}
if (self::validateProductImage($product->getSmallImage())) {
$data['images']['smallImage'] = array("url" => $product->getSmallImageUrl($width = 88, $height = 77));
}
if (self::validateProductImage($product->getThumbnail())) {
$data['images']['thumb'] = array("url" => $product->getThumbnailUrl($width = 75, $height = 75));
}
return $data;
return $data;
} catch (Exception $e) {
Mage::logException($e);
}
}
示例3: _applySpecialPrice
/**
* Apply special price for product if not return price that was before
*
* @param Mage_Catalog_Model_Product $product
* @param float $finalPrice
* @return float
*/
protected function _applySpecialPrice($product, $finalPrice)
{
return $this->calculateSpecialPrice($finalPrice, $product->getSpecialPrice(), $product->getSpecialFromDate(), $product->getSpecialToDate(), $product->getStore());
}
示例4: getProductEntity
public function getProductEntity(Mage_Catalog_Model_Product $product, $storeId, $includeExtras = true)
{
$result = array();
$result['entity_id'] = $product->getEntityId();
$result['sku'] = $product->getSku();
$result['name'] = $product->getName();
$result['price'] = $product->getPrice();
$result['special_price'] = $product->getSpecialPrice();
$result['special_from_date'] = $product->getSpecialFromDate();
$result['special_to_date'] = $product->getSpecialToDate();
$result['cost'] = $product->getCost();
$result['description'] = $product->getDescription();
$result['short_description'] = $product->getShortDescription();
$result['weight'] = $product->getWeight();
if ($product->isVisibleInSiteVisibility()) {
$result['url_path'] = $this->_getProductUrlWithCache($product);
}
$parentProduct = $this->_getParentProduct($product);
if ($parentProduct != null) {
$result['parent_id'] = $parentProduct->getEntityId();
$result['parent_sku'] = $parentProduct->getSku();
if (!$product->isVisibleInSiteVisibility()) {
$result['name'] = $parentProduct->getName();
if ($parentProduct->isVisibleInSiteVisibility()) {
$result['url_path'] = $this->_getProductUrlWithCache($parentProduct);
}
}
if ($includeExtras && Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId()) {
$result['purchasable'] = $this->_isPurchasable($product, $parentProduct);
$attributes = $parentProduct->getTypeInstance(true)->getUsedProductAttributes($parentProduct);
$freshProduct = null;
foreach ($attributes as $attribute) {
if (!array_key_exists('configurable_attributes', $result)) {
$result['configurable_attributes'] = array();
}
$attr = array();
$attr['attribute_name'] = $attribute->getFrontend()->getLabel();
$attr['value'] = $product->getAttributeText($attribute->getAttributeCode());
if (empty($attr['value'])) {
// use the EAV tables only if the flat table doesn't work
if ($freshProduct == null) {
$freshProduct = Mage::getModel('catalog/product')->load($product->getEntityId());
}
$attr['value'] = $attribute->getFrontend()->getValue($freshProduct);
}
$result['configurable_attributes'][] = $attr;
}
}
}
if (!isset($result['purchasable'])) {
$result['purchasable'] = $this->_isPurchasable($product);
}
$images = $this->_getProductImages($product);
if (isset($images['image'])) {
$result['image'] = $images['image'];
}
if (isset($images['small_image'])) {
$result['small_image'] = $images['small_image'];
}
if (isset($images['thumbnail'])) {
$result['thumbnail'] = $images['thumbnail'];
}
if ($includeExtras) {
// Metas
$metas = $this->_getMetas($storeId, $product, $parentProduct);
if ($metas != null) {
//if(isset($metas['meta1'])) $result['meta1'] = $metas['meta1'];
//if(isset($metas['meta2'])) $result['meta2'] = $metas['meta2'];
//if(isset($metas['meta3'])) $result['meta3'] = $metas['meta3'];
//if(isset($metas['meta4'])) $result['meta4'] = $metas['meta4'];
if (isset($metas['meta5'])) {
$result['meta5'] = $metas['meta5'];
}
}
//Custom For ST Bernard Sports
// Set IsNew Flag if product is less then 45 days old.
$result['meta4'] = strtotime($product->getCreatedAt()) + 45 * 24 * 60 * 60 < time() ? "False" : "True";
// Brand and Category
$brandAndCategoryProduct = !$parentProduct || $product->isVisibleInSiteVisibility() ? $product : $parentProduct;
$setSettings = $this->_getProductAttributeSetSettings($brandAndCategoryProduct);
if ($setSettings['brandAttribute'] != null) {
$result['brand'] = $brandAndCategoryProduct->getAttributeText($setSettings['brandAttribute']);
}
if ($setSettings['catFromMagento']) {
$cats = $this->_getCategoryInformation($storeId, $brandAndCategoryProduct);
if (isset($cats['category'])) {
$result['category'] = $cats['category'];
}
if (isset($cats['sub_category'])) {
$result['sub_category'] = $cats['sub_category'];
}
//Custom For ST Bernard Sports
if (isset($cats['third_category'])) {
$result['meta3'] = $cats['third_category'];
}
} else {
if ($setSettings['catFromAttributes']) {
if ($setSettings['categoryAttribute'] != null) {
$result['category'] = $brandAndCategoryProduct->getAttributeText($setSettings['categoryAttribute']);
}
//.........这里部分代码省略.........
示例5: getFinalPrice
/**
* Get product final price
*
* @param double $qty
* @param Mage_Catalog_Model_Product $product
* @return double
*/
public function getFinalPrice($qty = null, $product)
{
/**
* Calculating final price for item of configurable product
*/
if ($product->getSuperProduct() && $product->getSuperProduct()->isConfigurable()) {
$finalPrice = $product->getSuperProduct()->getFinalPrice($qty);
$attributes = $product->getSuperProduct()->getTypeInstance()->getConfigurableAttributes();
foreach ($attributes as $attribute) {
$value = $this->getValueByIndex($attribute->getPrices(), $product->getData($attribute->getProductAttribute()->getAttributeCode()));
if ($value) {
if ($value['pricing_value'] != 0) {
$finalPrice += $product->getSuperProduct()->getPricingValue($value);
}
}
}
} else {
$finalPrice = $product->getPrice();
$tierPrice = $product->getTierPrice($qty);
if (is_numeric($tierPrice)) {
$finalPrice = min($finalPrice, $tierPrice);
}
$specialPrice = $product->getSpecialPrice();
if (is_numeric($specialPrice)) {
$today = floor(time() / 86400) * 86400;
#echo " TEST:"; echo date('Y-m-d H:i:s', $today).' , '.$product->getSpecialToDate();
if ($product->getSpecialFromDate() && $today < strtotime($product->getSpecialFromDate())) {
#echo ' test1: '.$product->getSpecialFromDate();
} elseif ($product->getSpecialToDate() && $today > strtotime($product->getSpecialToDate())) {
#echo ' test2: '.$product->getSpecialToDate();
} else {
$finalPrice = min($finalPrice, $specialPrice);
}
}
}
$product->setFinalPrice($finalPrice);
Mage::dispatchEvent('catalog_product_get_final_price', array('product' => $product));
return $product->getData('final_price');
}
示例6: getProductEntity
/**
* Inflate an API object from a product object
*
* @param Mage_Catalog_Model_Product $product Product
* @param int $storeId Magento store ID
* @param bool $includeExtras Retrieve all information
*
* @return array
*/
public function getProductEntity(Mage_Catalog_Model_Product $product, $storeId, $includeExtras = true)
{
$result = array();
$result['entity_id'] = $product->getEntityId();
$result['sku'] = $product->getSku();
$result['name'] = $product->getName();
$result['price'] = $product->getPrice();
$result['special_price'] = $product->getSpecialPrice();
$result['special_from_date'] = $product->getSpecialFromDate();
$result['special_to_date'] = $product->getSpecialToDate();
$result['cost'] = $product->getCost();
$result['description'] = $product->getDescription();
$result['short_description'] = $product->getShortDescription();
$result['weight'] = $product->getWeight();
if ($product->isVisibleInSiteVisibility()) {
$result['url_path'] = $this->_getProductUrlWithCache($product);
}
$parentProduct = $this->_getParentProduct($product);
if ($parentProduct != null) {
$result['parent_id'] = $parentProduct->getEntityId();
$result['parent_sku'] = $parentProduct->getSku();
if (!$product->isVisibleInSiteVisibility()) {
$result['name'] = $parentProduct->getName();
if ($parentProduct->isVisibleInSiteVisibility()) {
$result['url_path'] = $this->_getProductUrlWithCache($parentProduct);
}
}
if ($includeExtras && $this->_isConfigurableProduct($parentProduct)) {
$result['purchasable'] = $this->_isPurchasable($product, $parentProduct);
/* @var Mage_Catalog_Model_Product_Type_Configurable $typeInst */
$typeInst = $parentProduct->getTypeInstance(true);
$attributes = $typeInst->getUsedProductAttributes($parentProduct);
/* @var Mage_Eav_Model_Entity_Attribute_Abstract $attribute */
foreach ($attributes as $attribute) {
if (!array_key_exists('configurable_attributes', $result)) {
$result['configurable_attributes'] = array();
}
$result['configurable_attributes'][] = array('attribute_name' => $attribute->getAttributeCode());
}
}
}
if (!isset($result['purchasable'])) {
$result['purchasable'] = $this->_isPurchasable($product);
}
$images = $this->_getProductImages($product);
if (isset($images['image'])) {
$result['image'] = $images['image'];
}
if (isset($images['small_image'])) {
$result['small_image'] = $images['small_image'];
}
if (isset($images['thumbnail'])) {
$result['thumbnail'] = $images['thumbnail'];
}
if ($includeExtras) {
$metas = $this->_getMetas($storeId, $product, $parentProduct);
if ($metas != null) {
/*if (isset($metas['meta3'])) {
$result['meta3'] = $metas['meta3'];
}*/
if (isset($metas['meta4'])) {
$result['meta4'] = $metas['meta4'];
}
if (isset($metas['meta5'])) {
$result['meta5'] = $metas['meta5'];
}
}
//Custom for Sportys
$stores = array();
foreach ($product->getStoreIds() as $storeID) {
$store = Mage::getModel('core/store')->load($storeID);
$stores[] = $store->getCode();
}
$result["meta3"] = implode(',', $stores);
// Brand and Category
$brandCatProduct = $product;
if ($parentProduct && !$product->isVisibleInSiteVisibility()) {
$brandCatProduct = $parentProduct;
}
$setSettings = $this->_getProductAttributeSetSettings($brandCatProduct);
if ($setSettings['brandAttribute'] != null) {
$result['brand'] = $this->_getProductAttribute($brandCatProduct, $setSettings['brandAttribute']);
}
if ($setSettings['catFromMagento']) {
$cats = $this->_getCategoryInformation($storeId, $brandCatProduct);
if (isset($cats['category'])) {
$result['category'] = $cats['category'];
}
if (isset($cats['sub_category'])) {
$result['sub_category'] = $cats['sub_category'];
}
//.........这里部分代码省略.........
示例7: _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;
}
示例8: _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;
}
示例9: __construct
public function __construct(Mage_Catalog_Model_Product $product)
{
$this->id = $product->getId();
$this->sku = $product->getSku();
$this->name = $product->getName();
$statuses = Mage::getModel('catalog/product_status')->getOptionArray();
$this->status = $statuses[$product->getStatus()];
$options = Mage::getModel('catalog/product_visibility')->getOptionArray();
$this->visibility = $options[$product->getVisibility()];
$this->price = (double) number_format($product->getPrice(), 2, '.', '');
$this->specialPrice = (double) number_format($product->getSpecialPrice(), 2, '.', '');
$this->url = $product->getProductUrl();
$this->imagePath = Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getSmallImage());
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
$this->stock = (double) number_format($stock->getQty(), 2, '.', '');
$short_description = $product->getShortDescription();
//limit short description
if (strlen($short_description) > 250) {
$short_description = substr($short_description, 0, 250);
}
$this->short_description = $short_description;
//category data
$count = 0;
$categoryCollection = $product->getCategoryCollection()->addNameToResult();
foreach ($categoryCollection as $cat) {
$this->categories[$count]['Id'] = $cat->getId();
$this->categories[$count]['Name'] = $cat->getName();
$count++;
}
//website data
$count = 0;
$websiteIds = $product->getWebsiteIds();
foreach ($websiteIds as $websiteId) {
$website = Mage::app()->getWebsite($websiteId);
$this->websites[$count]['Id'] = $website->getId();
$this->websites[$count]['Name'] = $website->getName();
$count++;
}
//bundle product options
if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
$optionCollection = $product->getTypeInstance()->getOptionsCollection();
$selectionCollection = $product->getTypeInstance()->getSelectionsCollection($product->getTypeInstance()->getOptionsIds());
$options = $optionCollection->appendSelections($selectionCollection);
foreach ($options as $option) {
$count = 0;
$title = str_replace(' ', '', $option->getDefaultTitle());
$selections = $option->getSelections();
$sOptions = array();
foreach ($selections as $selection) {
$sOptions[$count]['name'] = $selection->getName();
$sOptions[$count]['sku'] = $selection->getSku();
$sOptions[$count]['id'] = $selection->getProductId();
$sOptions[$count]['price'] = (double) number_format($selection->getPrice(), 2, '.', '');
$count++;
}
$this->{$title} = $sOptions;
}
}
//configurable product options
if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
$productAttributeOptions = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
foreach ($productAttributeOptions as $productAttribute) {
$count = 0;
$label = strtolower(str_replace(' ', '', $productAttribute['label']));
$options = array();
foreach ($productAttribute['values'] as $attribute) {
$options[$count]['option'] = $attribute['default_label'];
$options[$count]['price'] = (double) number_format($attribute['pricing_value'], 2, '.', '');
$count++;
}
$this->{$label} = $options;
}
}
}
示例10: _getValidSpecialPrice
/**
* Checks if the special price has expired
*
* @param Mage_Catalog_Model_Product $product
* @param int | null $store
* @return string | null special price or null if the special price has expired
*/
protected function _getValidSpecialPrice(Mage_Catalog_Model_Product $product, $store = null)
{
$price = null;
$fromDate = $product->getSpecialFromDate();
$toDate = $product->getSpecialToDate();
if (Mage::app()->getLocale()->isStoreDateInInterval($store, $fromDate, $toDate)) {
$price = $product->getSpecialPrice();
}
return $price;
}
示例11: getChildFinalPrice
/**
* Returns final price of a child product
*
* @param Mage_Catalog_Model_Product $product
* @param float $productQty
* @param Mage_Catalog_Model_Product $childProduct
* @param float $childProductQty
* @return decimal
*/
public function getChildFinalPrice($product, $productQty, $childProduct, $childProductQty, $totalChildPrice, $itemCount)
{
static $mYcount = 0;
static $counter = 0;
Mage::log($itemCount, null, 'mri.log');
$counter = $counter + 1;
//==================================================================================================
if ($product->getPriceType() == self::PRICE_TYPE_DYNAMIC) {
$bundleSplPrice = $product->getSpecialPrice();
$selectPrice = $childProduct->getSpecialPrice();
$myFinalPrice = $bundleSplPrice * $selectPrice / $totalChildPrice;
$myFinalPrice = round($myFinalPrice, 2);
if ($itemCount == $counter) {
$lastPrice = $bundleSplPrice - $mYcount;
$mYcount = 0;
$counter = 0;
return $lastPrice;
} else {
$mYcount = $mYcount + $myFinalPrice;
return $myFinalPrice;
}
} else {
return $this->getSelectionFinalTotalPrice($product, $childProduct, $productQty, $childProductQty, false);
}
//==================================================================================================
//return $this->getSelectionFinalTotalPrice($product, $childProduct, $productQty, $childProductQty, false);
}
示例12: getProductEntity
public function getProductEntity(Mage_Catalog_Model_Product $product, $storeId, $includeExtras = true)
{
$result = array();
$result['entity_id'] = $product->getEntityId();
$result['sku'] = $product->getSku();
$result['name'] = $product->getName();
$result['price'] = $product->getPrice();
$result['special_price'] = $product->getSpecialPrice();
$result['special_from_date'] = $product->getSpecialFromDate();
$result['special_to_date'] = $product->getSpecialToDate();
$result['cost'] = $product->getCost();
$result['description'] = $product->getDescription();
$result['short_description'] = $product->getShortDescription();
$result['weight'] = $product->getWeight();
if ($product->isVisibleInSiteVisibility()) {
$prodUrlStr = $product->getProductUrl();
$prodUrl = Mage::getSingleton('core/url')->parseUrl($prodUrlStr);
$result['url_path'] = substr($prodUrl->getPath(), 1);
}
$parentProduct = $this->_getParentProduct($product);
if ($parentProduct != null) {
$result['parent_id'] = $parentProduct->getEntityId();
$result['parent_sku'] = $parentProduct->getSku();
if (!$product->isVisibleInSiteVisibility()) {
$result['name'] = $parentProduct->getName();
if ($parentProduct->isVisibleInSiteVisibility()) {
$prodUrlStr = $parentProduct->getProductUrl();
$prodUrl = Mage::getSingleton('core/url')->parseUrl($prodUrlStr);
$result['url_path'] = substr($prodUrl->getPath(), 1);
}
}
if ($includeExtras && Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId()) {
$result['purchasable'] = $this->_isPurchasable($product, $parentProduct);
$attributes = $parentProduct->getTypeInstance(true)->getUsedProductAttributes($parentProduct);
foreach ($attributes as $attribute) {
if (!array_key_exists('configurable_attributes', $result)) {
$result['configurable_attributes'] = array();
}
$attr = array();
$attr['attribute_name'] = $attribute->getFrontend()->getLabel();
$attr['value'] = $product->getAttributeText($attribute->getAttributeCode());
$result['configurable_attributes'][] = $attr;
}
}
}
if (!isset($result['purchasable'])) {
$result['purchasable'] = $this->_isPurchasable($product);
}
$images = $this->_getProductImages($product);
if (isset($images['image'])) {
$result['image'] = $images['image'];
}
if (isset($images['small_image'])) {
$result['small_image'] = $images['small_image'];
}
if (isset($images['thumbnail'])) {
$result['thumbnail'] = $images['thumbnail'];
}
if ($includeExtras) {
// Metas
$metas = $this->_getMetas($storeId, $product, $parentProduct);
if ($metas != null) {
//if(isset($metas['meta1'])) $result['meta1'] = $metas['meta1'];
//if(isset($metas['meta2'])) $result['meta2'] = $metas['meta2'];
if (isset($metas['meta3'])) {
$result['meta3'] = $metas['meta3'];
}
if (isset($metas['meta4'])) {
$result['meta4'] = $metas['meta4'];
}
if (isset($metas['meta5'])) {
$result['meta5'] = $metas['meta5'];
}
}
// Brand and Category
$brandAndCategoryProduct = !$parentProduct || $product->isVisibleInSiteVisibility() ? $product : $parentProduct;
$setSettings = $this->_getProductAttributeSetSettings($brandAndCategoryProduct);
if ($setSettings['brandAttribute'] != null) {
$result['brand'] = $brandAndCategoryProduct->getAttributeText($setSettings['brandAttribute']);
}
if ($setSettings['catFromMagento']) {
$cats = $this->_getCategoryInformation($storeId, $brandAndCategoryProduct);
if (isset($cats['category'])) {
$result['category'] = $cats['category'];
}
if (isset($cats['sub_category'])) {
$result['sub_category'] = $cats['sub_category'];
}
} else {
if ($setSettings['catFromAttributes']) {
if ($setSettings['categoryAttribute'] != null) {
$result['category'] = $brandAndCategoryProduct->getAttributeText($setSettings['categoryAttribute']);
}
if ($setSettings['subcategoryAttribute'] != null) {
$result['sub_category'] = $brandAndCategoryProduct->getAttributeText($setSettings['subcategoryAttribute']);
}
}
}
// Inventory
$result['in_stock'] = $product->isAvailable() ? "true" : "false";
//.........这里部分代码省略.........
示例13: isActualPriceSpecial
/**
* @param Mage_Catalog_Model_Product $product
* @return bool
*/
public function isActualPriceSpecial(Mage_Catalog_Model_Product $product)
{
return $product->getSpecialPrice() && Mage::app()->getLocale()->isStoreDateInInterval(Mage::app()->getStore(), $product->getSpecialFromDate(), $product->getSpecialToDate());
}
示例14: _hasSpecialPrice
/**
* check if product has special price
* @param Mage_Catalog_Model_Product $product
* @return bool
*/
protected function _hasSpecialPrice(Mage_Catalog_Model_Product $product)
{
return (double) $product->getSpecialPrice() > 0;
}