Mage_Catalog_Helper_Product Class Reference

Inheritance diagram for Mage_Catalog_Helper_Product:

Mage_Core_Helper_Url Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 getProductUrl ($product)
 getPrice ($product)
 getFinalPrice ($product)
 getImageUrl ($product)
 getSmallImageUrl ($product)
 getThumbnailUrl ($product)
 getEmailToFriendUrl ($product)
 getStatuses ()
 canShow ($product, $where= 'catalog')
 getProductUrlSuffix ($storeId=null)

Public Attributes

const XML_PATH_PRODUCT_URL_SUFFIX = 'catalog/seo/product_url_suffix'

Protected Attributes

 $_productUrlSuffix = array()
 $_statuses
 $_priceBlock


Detailed Description

Catalog category helper

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Product.php.


Member Function Documentation

canShow ( product,
where = 'catalog' 
)

Check if a product can be shown

Parameters:
Mage_Catalog_Model_Product|int $product
Returns:
boolean

Definition at line 157 of file Product.php.

00158     {
00159         if (is_int($product)) {
00160             $product = Mage::getModel('catalog/product')->load($product);
00161         }
00162 
00163         /* @var $product Mage_Catalog_Model_Product */
00164 
00165         if (!$product->getId()) {
00166             return false;
00167         }
00168 
00169         return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();
00170     }

getEmailToFriendUrl ( product  ) 

Definition at line 130 of file Product.php.

00131     {
00132         $categoryId = null;
00133         if ($category = Mage::registry('current_category')) {
00134             $categoryId = $category->getId();
00135         }
00136         return $this->_getUrl('sendfriend/product/send', array(
00137             'id' => $product->getId(),
00138             'cat_id' => $categoryId
00139         ));
00140     }

getFinalPrice ( product  ) 

Retrieve product final price

Parameters:
Mage_Catalog_Model_Product $product
Returns:
float

Definition at line 81 of file Product.php.

00082     {
00083         return $product->getFinalPrice();
00084     }

getImageUrl ( product  ) 

Retrieve base image url

Returns:
string

Definition at line 91 of file Product.php.

00092     {
00093         $url = false;
00094         if (!$product->getImage()) {
00095             $url = Mage::getDesign()->getSkinUrl('images/no_image.jpg');
00096         }
00097         elseif ($attribute = $product->getResource()->getAttribute('image')) {
00098             $url = $attribute->getFrontend()->getUrl($product);
00099         }
00100         return $url;
00101     }

getPrice ( product  ) 

Retrieve product price

Parameters:
Mage_Catalog_Model_Product $product
Returns:
float

Definition at line 70 of file Product.php.

00071     {
00072         return $product->getPrice();
00073     }

getProductUrl ( product  ) 

Retrieve product view page url

Parameters:
mixed $product
Returns:
string

Definition at line 53 of file Product.php.

00054     {
00055         if ($product instanceof Mage_Catalog_Model_Product) {
00056             return $product->getProductUrl();
00057         }
00058         elseif (is_numeric($product)) {
00059             return Mage::getModel('catalog/product')->load($product)->getProductUrl();
00060         }
00061         return false;
00062     }

getProductUrlSuffix ( storeId = null  ) 

Retrieve product rewrite sufix for store

Parameters:
int $storeId
Returns:
string

Definition at line 178 of file Product.php.

00179     {
00180         if (is_null($storeId)) {
00181             $storeId = Mage::app()->getStore()->getId();
00182         }
00183 
00184         if (!isset($this->_productUrlSuffix[$storeId])) {
00185             $this->_productUrlSuffix[$storeId] = Mage::getStoreConfig(self::XML_PATH_PRODUCT_URL_SUFFIX, $storeId);
00186         }
00187         return $this->_productUrlSuffix[$storeId];
00188     }

getSmallImageUrl ( product  ) 

Retrieve small image url

Returns:
unknown

Definition at line 108 of file Product.php.

00109     {
00110         $url = false;
00111         if (!$product->getSmallImage()) {
00112             $url = Mage::getDesign()->getSkinUrl('images/no_image.jpg');
00113         }
00114         elseif ($attribute = $product->getResource()->getAttribute('small_image')) {
00115             $url = $attribute->getFrontend()->getUrl($product);
00116         }
00117         return $url;
00118     }

getStatuses (  ) 

Definition at line 142 of file Product.php.

00143     {
00144         if(is_null($this->_statuses)) {
00145             $this->_statuses = array();//Mage::getModel('catalog/product_status')->getResourceCollection()->load();
00146         }
00147 
00148         return $this->_statuses;
00149     }

getThumbnailUrl ( product  ) 

Retrieve thumbnail image url

Returns:
unknown

Definition at line 125 of file Product.php.

00126     {
00127         return '';
00128     }


Member Data Documentation

$_priceBlock [protected]

Definition at line 45 of file Product.php.

$_productUrlSuffix = array() [protected]

Definition at line 41 of file Product.php.

$_statuses [protected]

Definition at line 43 of file Product.php.

const XML_PATH_PRODUCT_URL_SUFFIX = 'catalog/seo/product_url_suffix'

Definition at line 34 of file Product.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:37 2009 for Magento by  doxygen 1.5.8