Skip to content

Commit

Permalink
Merge pull request #27 from YotpoLtd/YES_30_Support_Star_Rating_on_ca…
Browse files Browse the repository at this point in the history
…tegory_page_out_of_the_box_magento1

Yes 30 support star rating on category page out of the box magento1
  • Loading branch information
sa3iedsabbah authored Jan 4, 2018
2 parents b12fa7b + 3846a80 commit 4ac8db1
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 1 deletion.
28 changes: 28 additions & 0 deletions app/code/community/Yotpo/Yotpo/Block/Catalog/Product/List.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

class Yotpo_Yotpo_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List {

const CATEGORY_BOTTOMLINE = 'yotpo/yotpo_general_group/enable_bottomline_category_page';
protected function _getProductCollection() {
$_productCollection = parent::_getProductCollection();
$enableBottomlineCategoryPage = Mage::getStoreConfig(self::CATEGORY_BOTTOMLINE);
if ($enableBottomlineCategoryPage) {

foreach ($_productCollection as $_product) {
$_product->setRatingSummary(true);
}
}
return $_productCollection;
}

public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false, $displayIfNoReviews = false) {

$enableBottomlineCategoryPage = Mage::getStoreConfig(self::CATEGORY_BOTTOMLINE);
if ($enableBottomlineCategoryPage) {
return $this->helper('yotpo')->showBottomline($this, $product);
} else {
return parent::getReviewsSummaryHtml($product, $templateType, $displayIfNoReviews);
}
}

}
5 changes: 5 additions & 0 deletions app/code/community/Yotpo/Yotpo/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<yotpo>
<class>Yotpo_Yotpo_Block</class>
</yotpo>
<catalog>
<rewrite>
<product_list>Yotpo_Yotpo_Block_Catalog_Product_List</product_list>
</rewrite>
</catalog>
</blocks>
<models>
<yotpo>
Expand Down
10 changes: 10 additions & 0 deletions app/code/community/Yotpo/Yotpo/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@
<show_in_website>0</show_in_website>
<show_in_store>1</show_in_store>
</disable_default_widget_position>
<enable_bottomline_category_page>
<label>Enable Star Ratings On Category Pages</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<enabled>1</enabled>
<sort_order>5</sort_order>
<show_in_default>0</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>1</show_in_store>
</enable_bottomline_category_page>
<orders_export translate="label">
<label>Send Mail After Purchase emails for orders created in the last 90 days</label>
<frontend_type>button</frontend_type>
Expand Down
5 changes: 4 additions & 1 deletion app/design/frontend/base/default/layout/yotpo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@

<default>
<reference name="head">
<action method="AddCSS">
<stylesheet>css/yotpo-bottomline.css</stylesheet>
</action>
<block type="yotpo/yotpo" as="yotpo-js" template="yotpo/app_key_js.phtml" name="yotpo.js">
</block>
</block>
</reference>

<reference name="content">
Expand Down
3 changes: 3 additions & 0 deletions app/etc/modules/Yotpo_Yotpo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<Yotpo_Yotpo>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Catalog/>
</depends>
</Yotpo_Yotpo>
</modules>
</config>
5 changes: 5 additions & 0 deletions skin/frontend/base/default/css/yotpo-bottomline.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.products-grid .item .standalone-bottomline{
display: flex;
justify-content: center;
padding:10px 0;
}

0 comments on commit 4ac8db1

Please sign in to comment.