Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mage_Catalog - DOC block update #783

Merged
merged 5 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Block/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getTitleSeparator($store = null)
/**
* Preparing layout
*
* @return $this
* @inheritDoc
*/
protected function _prepareLayout()
{
Expand Down
25 changes: 23 additions & 2 deletions app/code/core/Mage/Catalog/Block/Category/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
*/
class Mage_Catalog_Block_Category_View extends Mage_Core_Block_Template
{
/**
* @return $this|Mage_Core_Block_Template
* @throws Mage_Core_Model_Store_Exception
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
Expand All @@ -57,34 +61,48 @@ protected function _prepareLayout()
want to show rss feed in the url
*/
if ($this->IsRssCatalogEnable() && $this->IsTopCategory()) {
$title = $this->helper('rss')->__('%s RSS Feed',$this->getCurrentCategory()->getName());
$title = $this->helper('rss')->__('%s RSS Feed', $this->getCurrentCategory()->getName());
$headBlock->addItem('rss', $this->getRssLink(), 'title="'.$title.'"');
}
}

return $this;
}

/**
* @return string
*/
public function IsRssCatalogEnable()
{
return Mage::getStoreConfig('rss/catalog/category');
}

/**
* @return bool
*/
public function IsTopCategory()
{
return $this->getCurrentCategory()->getLevel()==2;
}

/**
* @return string
* @throws Mage_Core_Model_Store_Exception
*/
public function getRssLink()
{
return Mage::getUrl('rss/catalog/category',
return Mage::getUrl(
'rss/catalog/category',
array(
'cid' => $this->getCurrentCategory()->getId(),
'store_id' => Mage::app()->getStore()->getId()
)
);
}

/**
* @return string
*/
public function getProductListHtml()
{
return $this->getChildHtml('product_list');
Expand All @@ -103,6 +121,9 @@ public function getCurrentCategory()
return $this->getData('current_category');
}

/**
* @return string
*/
public function getCmsBlockHtml()
{
if (!$this->getData('cms_block_html')) {
Expand Down
4 changes: 1 addition & 3 deletions app/code/core/Mage/Catalog/Block/Category/Widget/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
* @package Mage_Catalog
* @author Magento Core Team <core@magentocommerce.com>
*/

class Mage_Catalog_Block_Category_Widget_Link
extends Mage_Catalog_Block_Widget_Link
class Mage_Catalog_Block_Category_Widget_Link extends Mage_Catalog_Block_Widget_Link
{
/**
* Initialize entity model
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* @category Mage
* @package Mage_Catalog
* @author Magento Core Team <core@magentocommerce.com>
*
* @method string getAttributeModel()
*/
abstract class Mage_Catalog_Block_Layer_Filter_Abstract extends Mage_Core_Block_Template
{
Expand Down
5 changes: 4 additions & 1 deletion app/code/core/Mage/Catalog/Block/Layer/Filter/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public function __construct()
parent::__construct();
$this->_filterModelName = 'catalog/layer_filter_attribute';
}


/**
* @return $this|Mage_Catalog_Block_Layer_Filter_Abstract
*/
protected function _prepareFilter()
{
$this->_filter->setAttributeModel($this->getAttributeModel());
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Catalog/Block/Layer/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* @category Mage
* @package Mage_Catalog
* @author Magento Core Team <core@magentocommerce.com>
*
* @method $this setLayer(Mage_Catalog_Model_Layer $value)
*/
class Mage_Catalog_Block_Layer_State extends Mage_Core_Block_Template
{
Expand Down
8 changes: 5 additions & 3 deletions app/code/core/Mage/Catalog/Block/Layer/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function _getAttributeFilterBlockName()
/**
* Prepare child blocks
*
* @return $this
* @inheritDoc
sreichel marked this conversation as resolved.
Show resolved Hide resolved
*/
protected function _prepareLayout()
{
Expand All @@ -129,11 +129,13 @@ protected function _prepareLayout()
$filterBlockName = $this->_attributeFilterBlockName;
}

$this->setChild($attribute->getAttributeCode() . '_filter',
$this->setChild(
$attribute->getAttributeCode() . '_filter',
$this->getLayout()->createBlock($filterBlockName)
->setLayer($this->getLayer())
->setAttributeModel($attribute)
->init());
->init()
);
}

$this->getLayer()->apply();
Expand Down
46 changes: 27 additions & 19 deletions app/code/core/Mage/Catalog/Block/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected function _getItemPosition($level)
}

$position = array();
for($i = 0; $i <= $level; $i++) {
for ($i = 0; $i <= $level; $i++) {
if (isset($this->_itemLevelPositions[$i])) {
$position[] = $this->_itemLevelPositions[$i];
}
Expand All @@ -226,18 +226,25 @@ protected function _getItemPosition($level)
* Render category to html
*
* @param Mage_Catalog_Model_Category $category
* @param int Nesting level number
* @param boolean Whether ot not this item is last, affects list item class
* @param boolean Whether ot not this item is first, affects list item class
* @param boolean Whether ot not this item is outermost, affects list item class
* @param string Extra class of outermost list items
* @param string If specified wraps children list in div with this class
* @param boolean Whether ot not to add on* attributes to list item
* @param int $level Nesting level number
* @param boolean $isLast Whether ot not this item is last, affects list item class
* @param boolean $isFirst Whether ot not this item is first, affects list item class
* @param boolean $isOutermost Whether ot not this item is outermost, affects list item class
* @param string $outermostItemClass Extra class of outermost list items
* @param string $childrenWrapClass If specified wraps children list in div with this class
* @param boolean $noEventAttributes Whether ot not to add on* attributes to list item
* @return string
*/
protected function _renderCategoryMenuItemHtml($category, $level = 0, $isLast = false, $isFirst = false,
$isOutermost = false, $outermostItemClass = '', $childrenWrapClass = '', $noEventAttributes = false)
{
protected function _renderCategoryMenuItemHtml(
$category,
$level = 0,
$isLast = false,
$isFirst = false,
$isOutermost = false,
$outermostItemClass = '',
$childrenWrapClass = '',
$noEventAttributes = false
) {
if (!$category->getIsActive()) {
return '';
}
Expand Down Expand Up @@ -348,8 +355,8 @@ protected function _renderCategoryMenuItemHtml($category, $level = 0, $isLast =
*
* @deprecated deprecated after 1.4
* @param Mage_Catalog_Model_Category $category
* @param int Nesting level number
* @param boolean Whether ot not this item is last, affects list item class
* @param int $level Nesting level number
* @param boolean $last Whether ot not this item is last, affects list item class
* @return string
*/
public function drawItem($category, $level = 0, $last = false)
Expand All @@ -360,7 +367,7 @@ public function drawItem($category, $level = 0, $last = false)
/**
* Enter description here...
*
* @return Mage_Catalog_Model_Category
* @return Mage_Catalog_Model_Category|false
*/
public function getCurrentCategory()
{
Expand All @@ -373,7 +380,7 @@ public function getCurrentCategory()
/**
* Enter description here...
*
* @return string
* @return array
*/
public function getCurrentCategoryPath()
{
Expand All @@ -389,7 +396,8 @@ public function getCurrentCategoryPath()
* @param Mage_Catalog_Model_Category $category
* @return string
*/
public function drawOpenCategoryItem($category) {
public function drawOpenCategoryItem($category)
{
$html = '';
if (!$category->getIsActive()) {
return $html;
Expand Down Expand Up @@ -428,9 +436,9 @@ public function drawOpenCategoryItem($category) {
/**
* Render categories menu in HTML
*
* @param int Level number for list item class to start from
* @param string Extra class of outermost list items
* @param string If specified wraps children list in div with this class
* @param int $level Level number for list item class to start from
* @param string $outermostItemClass Extra class of outermost list items
* @param string $childrenWrapClass If specified wraps children list in div with this class
* @return string
*/
public function renderCategoriesMenuHtml($level = 0, $outermostItemClass = '', $childrenWrapClass = '')
Expand Down
13 changes: 13 additions & 0 deletions app/code/core/Mage/Catalog/Block/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class Mage_Catalog_Block_Product extends Mage_Core_Block_Template
{
protected $_finalPrice = array();

/**
* @return mixed
*/
public function getProduct()
{
if (!$this->getData('product') instanceof Mage_Catalog_Model_Product) {
Expand All @@ -45,11 +48,17 @@ public function getProduct()
return $this->getData('product');
}

/**
* @return mixed
*/
public function getPrice()
{
return $this->getProduct()->getPrice();
}

/**
* @return mixed
*/
public function getFinalPrice()
{
if (!isset($this->_finalPrice[$this->getProduct()->getId()])) {
Expand All @@ -58,6 +67,10 @@ public function getFinalPrice()
return $this->_finalPrice[$this->getProduct()->getId()];
}

/**
* @param Mage_Catalog_Model_Product $product
* @return string
*/
public function getPriceHtml($product)
{
$this->setTemplate('catalog/product/price.phtml');
Expand Down
17 changes: 11 additions & 6 deletions app/code/core/Mage/Catalog/Block/Product/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ public function addPriceBlockType($type, $block = '', $template = '')
* @param bool $displayIfNoReviews
* @return string
*/
public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false,
$displayIfNoReviews = false)
{
public function getReviewsSummaryHtml(
Mage_Catalog_Model_Product $product,
$templateType = false,
$displayIfNoReviews = false
) {
if ($this->_initReviewsHelperBlock()) {
return $this->_reviewsHelperBlock->getSummaryHtml($product, $templateType, $displayIfNoReviews);
}
Expand Down Expand Up @@ -411,6 +413,9 @@ public function getTierPriceHtml($product = null, $parent = null)
*
* @return string
*/
/**
* @return string
*/
protected function callParentToHtml()
{
return $this->toHtml();
Expand Down Expand Up @@ -578,7 +583,7 @@ public function getColumnCount()
*
* @param string $pageLayout
* @param int $columnCount
* @return Mage_Catalog_Block_Product_List
* @return $this
*/
public function addColumnCountLayoutDepend($pageLayout, $columnCount)
{
Expand All @@ -590,7 +595,7 @@ public function addColumnCountLayoutDepend($pageLayout, $columnCount)
* Remove row size depends on page layout
*
* @param string $pageLayout
* @return Mage_Catalog_Block_Product_List
* @return $this
*/
public function removeColumnCountLayoutDepend($pageLayout)
{
Expand Down Expand Up @@ -658,7 +663,7 @@ protected function _prepareLayout()
{
parent::_prepareLayout();

/* @var $block Mage_Catalog_Block_Product_Price_Template */
/* @var Mage_Catalog_Block_Product_Price_Template $block */
$block = $this->getLayout()->getBlock('catalog_product_price_template');
if ($block) {
foreach ($block->getPriceBlockTypes() as $type => $priceBlock) {
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Catalog/Block/Product/Compare/List.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Mage_Catalog_Block_Product_Compare_List extends Mage_Catalog_Block_Product
/**
* Product Compare items collection
*
* @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection
* @var Mage_Catalog_Model_Resource_Product_Compare_Item_Collection
*/
protected $_items;

Expand Down Expand Up @@ -90,7 +90,7 @@ public function getAddToWishlistUrl($product)
/**
* Preparing layout
*
* @return $this
* @inheritDoc
*/
protected function _prepareLayout()
{
Expand All @@ -104,7 +104,7 @@ protected function _prepareLayout()
/**
* Retrieve Product Compare items collection
*
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection
* @return Mage_Catalog_Model_Resource_Product_Compare_Item_Collection
*/
public function getItems()
{
Expand Down
Loading