Version Notes
Related Products by Category
Download this release
Release Info
Developer | Magebuzz |
Extension | related_products_by_categories |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- app/code/community/Magebuzz/Info/Block/System/Config/Extensions (2).php +75 -0
- app/code/community/Magebuzz/Info/Block/System/Config/Extensions.php +75 -0
- app/code/community/Magebuzz/Info/Block/System/Config/General.php +21 -0
- app/code/community/Magebuzz/Info/Helper/Data.php +4 -0
- app/code/community/Magebuzz/Info/Model/Feed.php +45 -0
- app/code/community/Magebuzz/Info/etc/adminhtml.xml +25 -0
- app/code/community/Magebuzz/Info/etc/config.xml +85 -0
- app/code/community/Magebuzz/Info/etc/system.xml +61 -0
- app/code/community/Magebuzz/Relatedcategory/Block/Catalog/Product/List/Related.php +38 -0
- app/code/community/Magebuzz/Relatedcategory/Block/Productrelated.php +117 -0
- app/code/community/Magebuzz/Relatedcategory/Helper/Data.php +7 -0
- app/code/community/Magebuzz/Relatedcategory/Model/Relatedcategory.php +23 -0
- app/code/community/Magebuzz/Relatedcategory/controllers/IndexController.php +20 -0
- app/code/community/Magebuzz/Relatedcategory/etc/adminhtml.xml +26 -0
- app/code/community/Magebuzz/Relatedcategory/etc/config.xml +119 -0
- app/design/frontend/base/default/layout/relatedcategory.xml +25 -0
- app/design/frontend/base/default/template/relatedcategory/product/list/related.phtml +63 -0
- app/design/frontend/base/default/template/relatedcategory/product/list/relatedproduct.phtml +81 -0
- app/etc/modules/Magebuzz_Info.xml +9 -0
- app/etc/modules/Magebuzz_Relatedcategory.xml +9 -0
- app/locale/en_US/Magebuzz_Relatedcategory.csv +0 -0
- package.xml +27 -0
- skin/adminhtml/default/default/images/magebuzz/facebook.png +0 -0
- skin/adminhtml/default/default/images/magebuzz/ok.gif +0 -0
- skin/adminhtml/default/default/images/magebuzz/twitter.png +0 -0
- skin/adminhtml/default/default/images/magebuzz/update.gif +0 -0
app/code/community/Magebuzz/Info/Block/System/Config/Extensions (2).php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Block_System_Config_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
3 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
4 |
+
$html = $this->_getHeaderHtml($element);
|
5 |
+
|
6 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
7 |
+
sort($modules);
|
8 |
+
|
9 |
+
foreach ($modules as $moduleName) {
|
10 |
+
if (strstr($moduleName, 'Magebuzz_') === false) {
|
11 |
+
continue;
|
12 |
+
}
|
13 |
+
if ($moduleName == 'Magebuzz_Info') {
|
14 |
+
continue;
|
15 |
+
}
|
16 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
17 |
+
}
|
18 |
+
|
19 |
+
$html .= $this->_getFooterHtml($element);
|
20 |
+
return $html;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _getFieldHtml($fieldset, $moduleCode) {
|
24 |
+
$currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
|
25 |
+
|
26 |
+
if (!$currentVer) {
|
27 |
+
return '';
|
28 |
+
}
|
29 |
+
$moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
|
30 |
+
$allExtensions = unserialize(Mage::app()->loadCache('mb_extensions'));
|
31 |
+
$status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
|
32 |
+
|
33 |
+
if ($allExtensions && isset($allExtensions[$moduleCode])){
|
34 |
+
$ext = $allExtensions[$moduleCode];
|
35 |
+
$url = $ext['url'];
|
36 |
+
$name = $ext['name'];
|
37 |
+
$lastVer = $ext['version'];
|
38 |
+
|
39 |
+
$moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
|
40 |
+
if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)) {
|
41 |
+
$status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$moduleName = $status . ' ' . $moduleName;
|
46 |
+
|
47 |
+
$field = $fieldset->addField($moduleCode, 'label', array(
|
48 |
+
'name' => 'dummy',
|
49 |
+
'label' => $moduleName,
|
50 |
+
'value' => $currentVer,
|
51 |
+
))->setRenderer($this->_getFieldRenderer());
|
52 |
+
|
53 |
+
return $field->toHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function _getFieldRenderer() {
|
57 |
+
if (empty($this->_fieldRenderer)) {
|
58 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
59 |
+
}
|
60 |
+
return $this->_fieldRenderer;
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function _convertVersion($v) {
|
64 |
+
$digits = @explode(".", $v);
|
65 |
+
$version = 0;
|
66 |
+
if (is_array($digits)){
|
67 |
+
foreach ($digits as $k=>$v){
|
68 |
+
$version += ($v * pow(10, max(0, (3-$k))));
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
return $version;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/community/Magebuzz/Info/Block/System/Config/Extensions.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Block_System_Config_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
3 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
4 |
+
$html = $this->_getHeaderHtml($element);
|
5 |
+
|
6 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
7 |
+
sort($modules);
|
8 |
+
|
9 |
+
foreach ($modules as $moduleName) {
|
10 |
+
if (strstr($moduleName, 'Magebuzz_') === false) {
|
11 |
+
continue;
|
12 |
+
}
|
13 |
+
if ($moduleName == 'Magebuzz_Info') {
|
14 |
+
continue;
|
15 |
+
}
|
16 |
+
$html.= $this->_getFieldHtml($element, $moduleName);
|
17 |
+
}
|
18 |
+
|
19 |
+
$html .= $this->_getFooterHtml($element);
|
20 |
+
return $html;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _getFieldHtml($fieldset, $moduleCode) {
|
24 |
+
$currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
|
25 |
+
|
26 |
+
if (!$currentVer) {
|
27 |
+
return '';
|
28 |
+
}
|
29 |
+
$moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
|
30 |
+
$allExtensions = unserialize(Mage::app()->loadCache('mb_extensions'));
|
31 |
+
$status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
|
32 |
+
|
33 |
+
if ($allExtensions && isset($allExtensions[$moduleCode])){
|
34 |
+
$ext = $allExtensions[$moduleCode];
|
35 |
+
$url = $ext['url'];
|
36 |
+
$name = $ext['name'];
|
37 |
+
$lastVer = $ext['version'];
|
38 |
+
|
39 |
+
$moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
|
40 |
+
if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)) {
|
41 |
+
$status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$moduleName = $status . ' ' . $moduleName;
|
46 |
+
|
47 |
+
$field = $fieldset->addField($moduleCode, 'label', array(
|
48 |
+
'name' => 'dummy',
|
49 |
+
'label' => $moduleName,
|
50 |
+
'value' => $currentVer,
|
51 |
+
))->setRenderer($this->_getFieldRenderer());
|
52 |
+
|
53 |
+
return $field->toHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function _getFieldRenderer() {
|
57 |
+
if (empty($this->_fieldRenderer)) {
|
58 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
59 |
+
}
|
60 |
+
return $this->_fieldRenderer;
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function _convertVersion($v) {
|
64 |
+
$digits = @explode(".", $v);
|
65 |
+
$version = 0;
|
66 |
+
if (is_array($digits)){
|
67 |
+
foreach ($digits as $k=>$v){
|
68 |
+
$version += ($v * pow(10, max(0, (3-$k))));
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
return $version;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/community/Magebuzz/Info/Block/System/Config/General.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Block_System_Config_General extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
|
3 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
4 |
+
$html = $this->_getHeaderHtml($element);
|
5 |
+
|
6 |
+
$html .= $this->_getInfo();
|
7 |
+
|
8 |
+
$html .= $this->_getFooterHtml($element);
|
9 |
+
return $html;
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _getInfo() {
|
13 |
+
$html = '<div class="support-info">';
|
14 |
+
$html .= '<h3>Support Policy</h3>';
|
15 |
+
$html .= '<p>We provide 6 months free support for all of our extensions and templates. We are not responsible for any bug or issue caused of your changes to our products. To report a bug, you can easily go to <a href="http://www.magebuzz.com/support/" title="Magebuzz Support" target="_blank">our Support Page</a>, email, call or submit a ticket.</p>';
|
16 |
+
$html .= '<h3>Read the blog</h3><p>The <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> is updated regularly with Magento tutorials, Magebuzz new products, updates, promotions... Visit <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> recently to be kept updated.</p>';
|
17 |
+
$html .= '<h3>Follow Us</h3><div class="magebuzz-follow"><ul><li style="float:left" class="facebook"><a href="http://www.facebook.com/MageBuzz" title="Facebook" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/facebook.png') . '" alt="Facebook"/></a></li><li style="float:left" class="twitter"><a href="https://twitter.com/MageBuzz" title="Twitter" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/twitter.png') . '" alt="Twitter"/></a></li></ul></div>';
|
18 |
+
$html .= '</div>';
|
19 |
+
return $html;
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Magebuzz/Info/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
}
|
app/code/community/Magebuzz/Info/Model/Feed.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Magebuzz_Info_Model_Feed extends Mage_AdminNotification_Model_Feed {
|
3 |
+
const URL_NEWS = 'http://www.magebuzz.com/feed_news.xml';
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('info/feed');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function checkUpdate() {
|
11 |
+
if (!extension_loaded('curl')) {
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
if (!Mage::getStoreConfig('info/notification/enable')) {
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
$feedData = array();
|
18 |
+
$feedXml = $this->getFeedData();
|
19 |
+
|
20 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
21 |
+
foreach ($feedXml->channel->item as $item) {
|
22 |
+
$date = $this->getDate((string)$item->pubDate);
|
23 |
+
$feedData[] = array(
|
24 |
+
'severity' => 3,
|
25 |
+
'date_added' => $this->getDate($date),
|
26 |
+
'title' => (string)$item->title,
|
27 |
+
'description' => (string)$item->description,
|
28 |
+
'url' => (string)$item->link,
|
29 |
+
);
|
30 |
+
}
|
31 |
+
if ($feedData) {
|
32 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
33 |
+
}
|
34 |
+
}
|
35 |
+
$this->setLastUpdate();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getFeedUrl() {
|
39 |
+
if (is_null($this->_feedUrl)) {
|
40 |
+
$this->_feedUrl = self::URL_NEWS;
|
41 |
+
}
|
42 |
+
//$query = '?s=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
|
43 |
+
return $this->_feedUrl;
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Magebuzz/Info/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<info>
|
15 |
+
<title>Magebuzz Info</title>
|
16 |
+
</info>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/community/Magebuzz/Info/etc/config.xml
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Info>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Magebuzz_Info>
|
7 |
+
</modules>
|
8 |
+
<admin>
|
9 |
+
<routers>
|
10 |
+
<info>
|
11 |
+
<use>admin</use>
|
12 |
+
<args>
|
13 |
+
<module>Magebuzz_Info</module>
|
14 |
+
<frontName>info</frontName>
|
15 |
+
</args>
|
16 |
+
</info>
|
17 |
+
</routers>
|
18 |
+
</admin>
|
19 |
+
<adminhtml>
|
20 |
+
<events>
|
21 |
+
<controller_action_predispatch>
|
22 |
+
<observers>
|
23 |
+
<magebuzz_info_feed>
|
24 |
+
<type>singleton</type>
|
25 |
+
<class>info/feed</class>
|
26 |
+
<method>checkUpdate</method>
|
27 |
+
</magebuzz_info_feed>
|
28 |
+
</observers>
|
29 |
+
</controller_action_predispatch>
|
30 |
+
</events>
|
31 |
+
</adminhtml>
|
32 |
+
<global>
|
33 |
+
<models>
|
34 |
+
<info>
|
35 |
+
<class>Magebuzz_Info_Model</class>
|
36 |
+
<resourceModel>info_mysql4</resourceModel>
|
37 |
+
</info>
|
38 |
+
<info_mysql4>
|
39 |
+
<class>Magebuzz_Info_Model_Mysql4</class>
|
40 |
+
<entities>
|
41 |
+
<info>
|
42 |
+
<table>info</table>
|
43 |
+
</info>
|
44 |
+
</entities>
|
45 |
+
</info_mysql4>
|
46 |
+
</models>
|
47 |
+
<resources>
|
48 |
+
<info_setup>
|
49 |
+
<setup>
|
50 |
+
<module>Magebuzz_Info</module>
|
51 |
+
</setup>
|
52 |
+
<connection>
|
53 |
+
<use>core_setup</use>
|
54 |
+
</connection>
|
55 |
+
</info_setup>
|
56 |
+
<info_write>
|
57 |
+
<connection>
|
58 |
+
<use>core_write</use>
|
59 |
+
</connection>
|
60 |
+
</info_write>
|
61 |
+
<info_read>
|
62 |
+
<connection>
|
63 |
+
<use>core_read</use>
|
64 |
+
</connection>
|
65 |
+
</info_read>
|
66 |
+
</resources>
|
67 |
+
<blocks>
|
68 |
+
<info>
|
69 |
+
<class>Magebuzz_Info_Block</class>
|
70 |
+
</info>
|
71 |
+
</blocks>
|
72 |
+
<helpers>
|
73 |
+
<info>
|
74 |
+
<class>Magebuzz_Info_Helper</class>
|
75 |
+
</info>
|
76 |
+
</helpers>
|
77 |
+
</global>
|
78 |
+
<default>
|
79 |
+
<info>
|
80 |
+
<notification>
|
81 |
+
<enable>1</enable>
|
82 |
+
</notification>
|
83 |
+
</info>
|
84 |
+
</default>
|
85 |
+
</config>
|
app/code/community/Magebuzz/Info/etc/system.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<magebuzz translate="label">
|
5 |
+
<label>MageBuzz Add-ons</label>
|
6 |
+
<sort_order>400</sort_order>
|
7 |
+
</magebuzz>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<info translate="label" module="info">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Info</label>
|
13 |
+
<tab>magebuzz</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>999</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>0</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<general translate="label">
|
21 |
+
<label>Info</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<frontend_model>info/system_config_general</frontend_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>0</show_in_store>
|
28 |
+
</general>
|
29 |
+
<installed_extensions translate="label">
|
30 |
+
<label>Installed Magebuzz Extensions</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<frontend_model>info/system_config_extensions</frontend_model>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
</installed_extensions>
|
38 |
+
<notification translate="label">
|
39 |
+
<label>Notification</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<comment><![CDATA[<p style="color:#EA7601">Select Yes to receive notification about new extensions, templates, updates or promotions and discounts from Magebuzz Store.</p>]]></comment>
|
42 |
+
<sort_order>3</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<enable>
|
48 |
+
<label>Receive Notification about new product, update and promotions</label>
|
49 |
+
<sort_order>1</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>0</show_in_store>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
55 |
+
</enable>
|
56 |
+
</fields>
|
57 |
+
</notification>
|
58 |
+
</groups>
|
59 |
+
</info>
|
60 |
+
</sections>
|
61 |
+
</config>
|
app/code/community/Magebuzz/Relatedcategory/Block/Catalog/Product/List/Related.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* @copyright Copyright ( c ) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Relatedcategory_Block_Catalog_Product_List_Related extends Mage_Catalog_Block_Product_List_Related
|
6 |
+
{
|
7 |
+
protected $_mapRenderer = 'msrp_noform';
|
8 |
+
|
9 |
+
protected $_itemCollection;
|
10 |
+
|
11 |
+
protected function _prepareData()
|
12 |
+
{
|
13 |
+
$productIds = array();
|
14 |
+
parent::_prepareData();
|
15 |
+
if($this->_itemCollection->getData()) {
|
16 |
+
foreach($this->_itemCollection as $product){
|
17 |
+
$productIds[] = $product->getId();
|
18 |
+
}
|
19 |
+
$catalogModel = Mage::getModel('relatedcategory/relatedcategory')->getAllCategoryRelatedByProductId($productIds);
|
20 |
+
$categoryModel = Mage::getModel('catalog/category')->getCollection()
|
21 |
+
->addAttributeToSelect('name')
|
22 |
+
->addFieldToFilter('entity_id',array('in'=>$catalogModel));
|
23 |
+
$this->_itemCollection = $categoryModel;
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _beforeToHtml()
|
29 |
+
{
|
30 |
+
$this->_prepareData();
|
31 |
+
return parent::_beforeToHtml();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getItems()
|
35 |
+
{
|
36 |
+
return $this->_itemCollection;
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Magebuzz/Relatedcategory/Block/Productrelated.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* @copyright Copyright ( c ) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Relatedcategory_Block_Productrelated extends Mage_Catalog_Block_Product_Abstract
|
6 |
+
{
|
7 |
+
protected $_productCollection;
|
8 |
+
protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
|
9 |
+
|
10 |
+
public function _getProductCollection(){
|
11 |
+
$productId = $this->getRequest()->getParam('pid');
|
12 |
+
$categoryId = $this->getRequest()->getParam('cid');
|
13 |
+
$product = Mage::getModel('catalog/product')->load($productId) ;
|
14 |
+
$productCollection = $product->getRelatedProductCollection();
|
15 |
+
$productCollection ->addCategoryFilter(Mage::getModel('catalog/category')->load($categoryId));
|
16 |
+
return $productCollection;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getLoadedProductCollection()
|
20 |
+
{
|
21 |
+
return $this->_getProductCollection();
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getMode()
|
25 |
+
{
|
26 |
+
return $this->getChild('toolbar')->getCurrentMode();
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _beforeToHtml()
|
30 |
+
{
|
31 |
+
$toolbar = $this->getToolbarBlock();
|
32 |
+
$collection = $this->_getProductCollection();
|
33 |
+
|
34 |
+
if ($orders = $this->getAvailableOrders()) {
|
35 |
+
$toolbar->setAvailableOrders($orders);
|
36 |
+
}
|
37 |
+
if ($sort = $this->getSortBy()) {
|
38 |
+
$toolbar->setDefaultOrder($sort);
|
39 |
+
}
|
40 |
+
if ($dir = $this->getDefaultDirection()) {
|
41 |
+
$toolbar->setDefaultDirection($dir);
|
42 |
+
}
|
43 |
+
if ($modes = $this->getModes()) {
|
44 |
+
$toolbar->setModes($modes);
|
45 |
+
}
|
46 |
+
|
47 |
+
$toolbar->setCollection($collection);
|
48 |
+
$this->setChild('toolbar', $toolbar);
|
49 |
+
Mage::dispatchEvent('catalog_block_product_list_collection', array(
|
50 |
+
'collection' => $this->_getProductCollection()
|
51 |
+
));
|
52 |
+
$this->_getProductCollection()->load();
|
53 |
+
return parent::_beforeToHtml();
|
54 |
+
}
|
55 |
+
|
56 |
+
public function getToolbarBlock()
|
57 |
+
{
|
58 |
+
if ($blockName = $this->getToolbarBlockName()) {
|
59 |
+
if ($block = $this->getLayout()->getBlock($blockName)) {
|
60 |
+
return $block;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
$block = $this->getLayout()->createBlock($this->_defaultToolbarBlock, microtime());
|
64 |
+
return $block;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getAdditionalHtml()
|
68 |
+
{
|
69 |
+
return $this->getChildHtml('additional');
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getToolbarHtml()
|
73 |
+
{
|
74 |
+
return $this->getChildHtml('toolbar');
|
75 |
+
}
|
76 |
+
|
77 |
+
public function setCollection($collection)
|
78 |
+
{
|
79 |
+
$this->_productCollection = $collection;
|
80 |
+
return $this;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function addAttribute($code)
|
84 |
+
{
|
85 |
+
$this->_getProductCollection()->addAttributeToSelect($code);
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getPriceBlockTemplate()
|
90 |
+
{
|
91 |
+
return $this->_getData('price_block_template');
|
92 |
+
}
|
93 |
+
|
94 |
+
protected function _getConfig()
|
95 |
+
{
|
96 |
+
return Mage::getSingleton('catalog/config');
|
97 |
+
}
|
98 |
+
|
99 |
+
public function prepareSortableFieldsByCategory($category) {
|
100 |
+
if (!$this->getAvailableOrders()) {
|
101 |
+
$this->setAvailableOrders($category->getAvailableSortByOptions());
|
102 |
+
}
|
103 |
+
$availableOrders = $this->getAvailableOrders();
|
104 |
+
if (!$this->getSortBy()) {
|
105 |
+
if ($categorySortBy = $category->getDefaultSortBy()) {
|
106 |
+
if (!$availableOrders) {
|
107 |
+
$availableOrders = $this->_getConfig()->getAttributeUsedForSortByArray();
|
108 |
+
}
|
109 |
+
if (isset($availableOrders[$categorySortBy])) {
|
110 |
+
$this->setSortBy($categorySortBy);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
}
|
app/code/community/Magebuzz/Relatedcategory/Helper/Data.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* @copyright Copyright ( c ) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Relatedcategory_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
+
{
|
7 |
+
}
|
app/code/community/Magebuzz/Relatedcategory/Model/Relatedcategory.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* @copyright Copyright ( c ) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Relatedcategory_Model_Relatedcategory extends Mage_Core_Model_Abstract
|
6 |
+
{
|
7 |
+
public function getAllCategoryRelatedByProductId($productIds){
|
8 |
+
$productList = implode(',',$productIds) ;
|
9 |
+
$categoryIds = array();
|
10 |
+
$connection = Mage::getSingleton('core/resource')
|
11 |
+
->getConnection('core_read');
|
12 |
+
$tableName = $connection->getTableName('catalog_category_product');
|
13 |
+
$select = $connection->select()
|
14 |
+
->from($tableName, array('*'))
|
15 |
+
->where('product_id in('.$productList.')')
|
16 |
+
->group('category_id');
|
17 |
+
$categorySelect = $connection->fetchAll($select);
|
18 |
+
foreach($categorySelect as $category){
|
19 |
+
$categoryIds[] = $category['category_id'];
|
20 |
+
}
|
21 |
+
return $categoryIds;
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Magebuzz/Relatedcategory/controllers/IndexController.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* @copyright Copyright ( c ) 2013 www.magebuzz.com
|
4 |
+
*/
|
5 |
+
class Magebuzz_Relatedcategory_IndexController extends Mage_Core_Controller_Front_Action
|
6 |
+
{
|
7 |
+
public function getlistproductAction() {
|
8 |
+
|
9 |
+
$pid = $this->getRequest()->getParam('pid');
|
10 |
+
$product = Mage::getModel('catalog/product')->load($pid);
|
11 |
+
Mage::registry('product',$product);
|
12 |
+
$layout = $this->getLayout();
|
13 |
+
$update = $layout->getUpdate();
|
14 |
+
$update->load('relatedcategory_index_getlistproduct');
|
15 |
+
$layout->generateXml();
|
16 |
+
$layout->generateBlocks();
|
17 |
+
$output = $layout->getOutput();
|
18 |
+
die($output);
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Magebuzz/Relatedcategory/etc/adminhtml.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<relatedcategory translate="title">
|
15 |
+
<title>Relatedcategory Permission Setting</title>
|
16 |
+
<sort_order>50</sort_order>
|
17 |
+
</relatedcategory>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/community/Magebuzz/Relatedcategory/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Relatedcategory>
|
5 |
+
<version>0.1.1</version>
|
6 |
+
</Magebuzz_Relatedcategory>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<secure_url>
|
10 |
+
<relatedcategory>/relatedcategory/</relatedcategory>
|
11 |
+
</secure_url>
|
12 |
+
<routers>
|
13 |
+
<relatedcategory>
|
14 |
+
<use>standard</use>
|
15 |
+
<args>
|
16 |
+
<module>Magebuzz_Relatedcategory</module>
|
17 |
+
<frontName>relatedcategory</frontName>
|
18 |
+
</args>
|
19 |
+
</relatedcategory>
|
20 |
+
</routers>
|
21 |
+
<layout>
|
22 |
+
<updates>
|
23 |
+
<relatedcategory>
|
24 |
+
<file>relatedcategory.xml</file>
|
25 |
+
</relatedcategory>
|
26 |
+
</updates>
|
27 |
+
</layout>
|
28 |
+
</frontend>
|
29 |
+
<admin>
|
30 |
+
<routers>
|
31 |
+
<relatedcategory>
|
32 |
+
<use>admin</use>
|
33 |
+
<args>
|
34 |
+
<module>Magebuzz_Relatedcategory</module>
|
35 |
+
<frontName>relatedcategory</frontName>
|
36 |
+
</args>
|
37 |
+
</relatedcategory>
|
38 |
+
</routers>
|
39 |
+
</admin>
|
40 |
+
<adminhtml>
|
41 |
+
<layout>
|
42 |
+
<updates>
|
43 |
+
<relatedcategory>
|
44 |
+
<file>relatedcategory.xml</file>
|
45 |
+
</relatedcategory>
|
46 |
+
</updates>
|
47 |
+
</layout>
|
48 |
+
</adminhtml>
|
49 |
+
<global>
|
50 |
+
<models>
|
51 |
+
<relatedcategory>
|
52 |
+
<class>Magebuzz_Relatedcategory_Model</class>
|
53 |
+
<resourceModel>relatedcategory_mysql4</resourceModel>
|
54 |
+
</relatedcategory>
|
55 |
+
<relatedcategory_mysql4>
|
56 |
+
<class>Magebuzz_Relatedcategory_Model_Mysql4</class>
|
57 |
+
<entities>
|
58 |
+
<relatedcategory>
|
59 |
+
<table>relatedcategory</table>
|
60 |
+
</relatedcategory>
|
61 |
+
</entities>
|
62 |
+
</relatedcategory_mysql4>
|
63 |
+
</models>
|
64 |
+
<resources>
|
65 |
+
<relatedcategory_setup>
|
66 |
+
<setup>
|
67 |
+
<module>Magebuzz_Relatedcategory</module>
|
68 |
+
</setup>
|
69 |
+
<connection>
|
70 |
+
<use>core_setup</use>
|
71 |
+
</connection>
|
72 |
+
</relatedcategory_setup>
|
73 |
+
<relatedcategory_write>
|
74 |
+
<connection>
|
75 |
+
<use>core_write</use>
|
76 |
+
</connection>
|
77 |
+
</relatedcategory_write>
|
78 |
+
<relatedcategory_read>
|
79 |
+
<connection>
|
80 |
+
<use>core_read</use>
|
81 |
+
</connection>
|
82 |
+
</relatedcategory_read>
|
83 |
+
</resources>
|
84 |
+
<blocks>
|
85 |
+
<relatedcategory>
|
86 |
+
<class>Magebuzz_Relatedcategory_Block</class>
|
87 |
+
</relatedcategory>
|
88 |
+
<catalog>
|
89 |
+
<rewrite>
|
90 |
+
<product_list_related>Magebuzz_Relatedcategory_Block_Catalog_Product_List_Related</product_list_related>
|
91 |
+
</rewrite>
|
92 |
+
</catalog>
|
93 |
+
</blocks>
|
94 |
+
<helpers>
|
95 |
+
<relatedcategory>
|
96 |
+
<class>Magebuzz_Relatedcategory_Helper</class>
|
97 |
+
</relatedcategory>
|
98 |
+
</helpers>
|
99 |
+
<template>
|
100 |
+
<email>
|
101 |
+
<relatedcategory_general_email_template>
|
102 |
+
<label>Title Email</label>
|
103 |
+
<file>relatedcategory_example.html</file>
|
104 |
+
<type>html</type>
|
105 |
+
</relatedcategory_general_email_template>
|
106 |
+
</email>
|
107 |
+
</template>
|
108 |
+
</global>
|
109 |
+
<!--Set Default Value For Setting Options-->
|
110 |
+
<translate>
|
111 |
+
<modules>
|
112 |
+
<Magebuzz_Relatedcategory>
|
113 |
+
<files>
|
114 |
+
<default>Magebuzz_Relatedcategory.csv</default>
|
115 |
+
</files>
|
116 |
+
</Magebuzz_Relatedcategory>
|
117 |
+
</modules>
|
118 |
+
</translate>
|
119 |
+
</config>
|
app/design/frontend/base/default/layout/relatedcategory.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<relatedcategory_index_getlistproduct>
|
4 |
+
<remove name="right"/>
|
5 |
+
<remove name="left"/>
|
6 |
+
<block type="relatedcategory/productrelated" name="root" output="toHtml" template="relatedcategory/product/list/relatedproduct.phtml">
|
7 |
+
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
|
8 |
+
<block type="page/html_pager" name="product_list_toolbar_pager"/>
|
9 |
+
</block>
|
10 |
+
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
|
11 |
+
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
|
12 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
|
13 |
+
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
|
14 |
+
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
|
15 |
+
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
|
16 |
+
</block>
|
17 |
+
</relatedcategory_index_getlistproduct>
|
18 |
+
<catalog_product_view>
|
19 |
+
<reference name="catalog.product.related">
|
20 |
+
<action method="setTemplate">
|
21 |
+
<template>relatedcategory/product/list/related.phtml</template>
|
22 |
+
</action>
|
23 |
+
</reference>
|
24 |
+
</catalog_product_view>
|
25 |
+
</layout>
|
app/design/frontend/base/default/template/relatedcategory/product/list/related.phtml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
$current_product = Mage::registry('current_product');
|
27 |
+
?>
|
28 |
+
|
29 |
+
<?php if(count($this->_itemCollection->getData())>0): ?>
|
30 |
+
<div class="block block-related">
|
31 |
+
<div class="block-title">
|
32 |
+
<strong><span><?php echo $this->__('Related Category') ?></span></strong>
|
33 |
+
</div>
|
34 |
+
<div class="block-content">
|
35 |
+
<ol class="mini-products-list" id="block-related">
|
36 |
+
<?php foreach($this->_itemCollection as $_item): ?>
|
37 |
+
<li class="item">
|
38 |
+
<a style="cursor: pointer;" onclick="getListProduct('<?php echo $current_product->getId();?>','<?php echo $_item->getId();?>')" title=""><?php echo $_item->getName();?></a>
|
39 |
+
<span style="margin-left: 5px; display:none;" id='ajax_loading_page_<?php echo $_item->getId();?>'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span>
|
40 |
+
</li>
|
41 |
+
<?php endforeach ?>
|
42 |
+
</ol>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<script>
|
46 |
+
function backForm(){
|
47 |
+
window.location.reload();
|
48 |
+
}
|
49 |
+
$('product_addtocart_form').up(2).setAttribute('id', 'product_view');
|
50 |
+
function getListProduct(pid,cid){
|
51 |
+
$('ajax_loading_page_'+cid).show();
|
52 |
+
|
53 |
+
var ajaxurl = "<?php echo Mage::getBaseUrl() . 'relatedcategory/index/getlistproduct?pid='?>"+pid+'&cid='+cid;
|
54 |
+
new Ajax.Request(ajaxurl, {
|
55 |
+
method: 'post',
|
56 |
+
onSuccess: function(html_success_give) {
|
57 |
+
$('product_view').innerHTML= html_success_give.responseText;
|
58 |
+
$('ajax_loading_page_'+cid).hide();
|
59 |
+
}
|
60 |
+
});
|
61 |
+
}
|
62 |
+
</script>
|
63 |
+
<?php endif ?>
|
app/design/frontend/base/default/template/relatedcategory/product/list/relatedproduct.phtml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Product list template
|
30 |
+
*
|
31 |
+
* @see Mage_Catalog_Block_Product_List
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php
|
35 |
+
$_productCollection=$this->getLoadedProductCollection()->addAttributeToSelect('*');
|
36 |
+
$_helper = $this->helper('catalog/output');
|
37 |
+
?>
|
38 |
+
<div id="messages_product_view"></div>
|
39 |
+
<?php if(!$_productCollection->count()): ?>
|
40 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
41 |
+
<?php else: ?>
|
42 |
+
<div class="category-products">
|
43 |
+
|
44 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
45 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
46 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
47 |
+
<?php if ($i++%$_columnCount==0): ?>
|
48 |
+
<ul class="products-grid">
|
49 |
+
<?php endif ?>
|
50 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
51 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
52 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
|
53 |
+
<?php if($_product->getRatingSummary()): ?>
|
54 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
55 |
+
<?php endif; ?>
|
56 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
57 |
+
<div class="actions">
|
58 |
+
<?php if($_product->isSaleable()): ?>
|
59 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
60 |
+
<?php else: ?>
|
61 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
62 |
+
<?php endif; ?>
|
63 |
+
<ul class="add-to-links">
|
64 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
65 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
66 |
+
<?php endif; ?>
|
67 |
+
<?php $_compareUrl= Mage::getBaseUrl().'catalog/product_compare/add?product='.$_product->getId();?>
|
68 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
69 |
+
</ul>
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
73 |
+
</ul>
|
74 |
+
<?php endif ?>
|
75 |
+
<?php endforeach ?>
|
76 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
77 |
+
</div>
|
78 |
+
<?php endif; ?>
|
79 |
+
<div>
|
80 |
+
<a style="cursor: pointer;" onclick="return backForm();"><?php echo $this->__('Back');?></a>
|
81 |
+
</div>
|
app/etc/modules/Magebuzz_Info.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Info>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Magebuzz_Info>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/Magebuzz_Relatedcategory.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magebuzz_Relatedcategory>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Magebuzz_Relatedcategory>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/Magebuzz_Relatedcategory.csv
ADDED
File without changes
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>related_products_by_categories</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Navigate related products by category so easily</summary>
|
10 |
+
<description><p>If you have a big catalog and you want to set many related products for a product, Magento has a problem to display related products in product detail page. Related Products by Category extension will be very helpful in this case.</p>
|
11 |
+

|
12 |
+
<p>In product detail page, the module displays related categories which have related products of that product. Then customers can click on any category to view related products which belong to that category. The detail page will load related products using Ajax and customers can easily come back to product detail page by clicking on "Back" button.</p>
|
13 |
+

|
14 |
+
<strong> Features </strong> 
|
15 |
+

|
16 |
+
<p>- Display categories which have related products in product detail page</p>
|
17 |
+
<p>- Using Ajax to display related products belonging to selected category</p>
|
18 |
+
<p>- Customers can easily come back to product detail page by Back button</p>
|
19 |
+
</description>
|
20 |
+
<notes>Related Products by Category</notes>
|
21 |
+
<authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
|
22 |
+
<date>2014-07-11</date>
|
23 |
+
<time>02:34:25</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Magebuzz"><dir name="Relatedcategory"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="List"><file name="Related.php" hash="909ecc2f10cc6cdb3dd89dfac775b561"/></dir></dir></dir><file name="Productrelated.php" hash="cef0cfd05465b4f74caa75fe1ce06a38"/></dir><dir name="Helper"><file name="Data.php" hash="c029826bbb7f5bd420954d715406fc89"/></dir><dir name="Model"><file name="Relatedcategory.php" hash="f1a19e871e0d1ad54327bfb10023f85d"/></dir><dir name="controllers"><file name="IndexController.php" hash="a5aee83100e8146fe49d2786ca234ded"/></dir><dir name="etc"><file name="adminhtml.xml" hash="85c50b6ef18f44a7bd7745776cebe046"/><file name="config.xml" hash="71effa51cfa6aa7228943d344f05c5b0"/></dir></dir><dir name="Info"><dir name="Block"><dir name="System"><dir name="Config"><file name="Extensions (2).php" hash="aa5773e8b5dc6a33b9d4cc1154fbb69d"/><file name="Extensions.php" hash="aa5773e8b5dc6a33b9d4cc1154fbb69d"/><file name="General.php" hash="2cbe45ec38e2fc090141d0df421bed6e"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7582d16054340a767e7ed5190e71b0ad"/></dir><dir name="Model"><file name="Feed.php" hash="aa72a9d25541f123978c8598af191274"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4f60efb5ce51a052113a0e895c925fbc"/><file name="config.xml" hash="bc04f45fa0580e0f26a611e14fc2ca74"/><file name="system.xml" hash="ea315b0f9ca775ce9d11e373ba50d6d2"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="relatedcategory.xml" hash="a1bec80f313a69213461262eb06856dc"/></dir><dir name="template"><dir name="relatedcategory"><dir name="product"><dir name="list"><file name="related.phtml" hash="803d1f256a2eba9c0db7f9b222a5fc0e"/><file name="relatedproduct.phtml" hash="d621ca0b474b440d2b952b04f67fde85"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Relatedcategory.xml" hash="fc95f660bbf62844a4c16aa0c0f084f1"/><file name="Magebuzz_Info.xml" hash="81abb2ad3ff3428ae5b3b7c5aa04b937"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Magebuzz_Relatedcategory.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="magebuzz"><file name="facebook.png" hash="d6b1bea3a11c7cf5374e2937d731e315"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="twitter.png" hash="9b6278124eaa0b2c19a2253bd844bbb4"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir></dir></dir></dir></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
+
</package>
|
skin/adminhtml/default/default/images/magebuzz/facebook.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/magebuzz/ok.gif
ADDED
Binary file
|
skin/adminhtml/default/default/images/magebuzz/twitter.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/magebuzz/update.gif
ADDED
Binary file
|