Version Notes
First stable release
Download this release
Release Info
| Developer | Wiseboost |
| Extension | Wiseboost_WishlistCounter |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/community/Wiseboost/General/Helper/Data.php +21 -0
- app/code/community/Wiseboost/General/Model/Feed.php +129 -0
- app/code/community/Wiseboost/General/etc/adminhtml.xml +41 -0
- app/code/community/Wiseboost/General/etc/config.xml +68 -0
- app/code/community/Wiseboost/General/etc/system.xml +42 -0
- app/code/community/Wiseboost/WishlistCounter/Helper/Data.php +21 -0
- app/code/community/Wiseboost/WishlistCounter/Model/Observer.php +54 -0
- app/code/community/Wiseboost/WishlistCounter/etc/adminhtml.xml +42 -0
- app/code/community/Wiseboost/WishlistCounter/etc/config.xml +59 -0
- app/code/community/Wiseboost/WishlistCounter/etc/system.xml +53 -0
- app/etc/modules/Wiseboost_General.xml +9 -0
- app/etc/modules/Wiseboost_WishlistCounter.xml +9 -0
- package.xml +18 -0
app/code/community/Wiseboost/General/Helper/Data.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Wiseboost
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Wiseboost
|
| 13 |
+
* @package Wiseboost_General
|
| 14 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Wiseboost_General_Helper_Data extends Mage_Core_Helper_Abstract
|
| 19 |
+
{
|
| 20 |
+
|
| 21 |
+
}
|
app/code/community/Wiseboost/General/Model/Feed.php
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Wiseboost
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Wiseboost
|
| 13 |
+
* @package Wiseboost_General
|
| 14 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Wiseboost_General_Model_Feed extends Mage_AdminNotification_Model_Feed
|
| 19 |
+
{
|
| 20 |
+
const XML_USE_HTTPS_PATH = 'wiseboostgeneral/feed/use_https';
|
| 21 |
+
const XML_FEED_URL_PATH = 'wiseboostgeneral/feed/url';
|
| 22 |
+
const XML_FREQUENCY_PATH = 'wiseboostgeneral/feed/frequency';
|
| 23 |
+
const XML_FREQUENCY_ENABLE = 'wiseboostgeneral/feed/enable';
|
| 24 |
+
const XML_LAST_UPDATE_PATH = 'wiseboostgeneral/feed/last_update';
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Retrieve feed url
|
| 28 |
+
*
|
| 29 |
+
* @return string
|
| 30 |
+
*/
|
| 31 |
+
public function getFeedUrl()
|
| 32 |
+
{
|
| 33 |
+
if (is_null($this->_feedUrl)) {
|
| 34 |
+
$this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://')
|
| 35 |
+
. Mage::getStoreConfig(self::XML_FEED_URL_PATH);
|
| 36 |
+
}
|
| 37 |
+
return $this->_feedUrl;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Check feed for modification
|
| 42 |
+
*
|
| 43 |
+
* @return Mage_AdminNotification_Model_Feed
|
| 44 |
+
*/
|
| 45 |
+
public function checkUpdate()
|
| 46 |
+
{
|
| 47 |
+
|
| 48 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
| 49 |
+
return $this;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$feedData = array();
|
| 53 |
+
|
| 54 |
+
$feedXml = $this->getFeedData();
|
| 55 |
+
|
| 56 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
| 57 |
+
foreach ($feedXml->channel->item as $item) {
|
| 58 |
+
if ($this->isValidItem($item)) {
|
| 59 |
+
$feedData[] = array(
|
| 60 |
+
'severity' => (int)$item->severity ? (int)$item->severity : 3,
|
| 61 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
| 62 |
+
'title' => (string)$item->title,
|
| 63 |
+
'description' => (string)$item->description,
|
| 64 |
+
'url' => (string)$item->link,
|
| 65 |
+
);
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
if ($feedData) {
|
| 70 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
}
|
| 74 |
+
$this->setLastUpdate();
|
| 75 |
+
|
| 76 |
+
return $this;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Retrieve Update Frequency
|
| 81 |
+
*
|
| 82 |
+
* @return int
|
| 83 |
+
*/
|
| 84 |
+
public function getFrequency()
|
| 85 |
+
{
|
| 86 |
+
return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Retrieve Last update time
|
| 91 |
+
*
|
| 92 |
+
* @return int
|
| 93 |
+
*/
|
| 94 |
+
public function getLastUpdate()
|
| 95 |
+
{
|
| 96 |
+
return Mage::app()->loadCache('wiseboostgeneral_notifications_lastcheck');
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Set last update time (now)
|
| 101 |
+
*
|
| 102 |
+
* @return Mage_AdminNotification_Model_Feed
|
| 103 |
+
*/
|
| 104 |
+
public function setLastUpdate()
|
| 105 |
+
{
|
| 106 |
+
Mage::app()->saveCache(time(), 'wiseboostgeneral_notifications_lastcheck');
|
| 107 |
+
return $this;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
public static function check(){
|
| 111 |
+
if (!Mage::getStoreConfig(self::XML_FREQUENCY_ENABLE)) {
|
| 112 |
+
return;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
return Mage::getModel('wiseboostgeneral/feed')->checkUpdate();
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/* Valid the feed item */
|
| 119 |
+
private function isValidItem($item) {
|
| 120 |
+
$bValid = false;
|
| 121 |
+
|
| 122 |
+
if ( (strtotime($this->getDate((string)$item->pubDate))) >=
|
| 123 |
+
(strtotime("7 May 2013")) ) {
|
| 124 |
+
$bValid = true;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
return $bValid;
|
| 128 |
+
}
|
| 129 |
+
}
|
app/code/community/Wiseboost/General/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Magento
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Wiseboost
|
| 14 |
+
* @package Wiseboost_General
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
-->
|
| 18 |
+
<config>
|
| 19 |
+
<acl>
|
| 20 |
+
<resources>
|
| 21 |
+
<all>
|
| 22 |
+
<title>Allow Everything</title>
|
| 23 |
+
</all>
|
| 24 |
+
<admin>
|
| 25 |
+
<children>
|
| 26 |
+
<system>
|
| 27 |
+
<children>
|
| 28 |
+
<config>
|
| 29 |
+
<children>
|
| 30 |
+
<wiseboostgeneral>
|
| 31 |
+
<title>Wiseboost - General</title>
|
| 32 |
+
</wiseboostgeneral>
|
| 33 |
+
</children>
|
| 34 |
+
</config>
|
| 35 |
+
</children>
|
| 36 |
+
</system>
|
| 37 |
+
</children>
|
| 38 |
+
</admin>
|
| 39 |
+
</resources>
|
| 40 |
+
</acl>
|
| 41 |
+
</config>
|
app/code/community/Wiseboost/General/etc/config.xml
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Wiseboost_General>
|
| 5 |
+
<version>2.0</version>
|
| 6 |
+
</Wiseboost_General>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<blocks>
|
| 10 |
+
<wiseboostgeneral>
|
| 11 |
+
<class>Wiseboost_General_Block</class>
|
| 12 |
+
</wiseboostgeneral>
|
| 13 |
+
</blocks>
|
| 14 |
+
<resources>
|
| 15 |
+
<wiseboostgeneral_setup>
|
| 16 |
+
<setup>
|
| 17 |
+
<module>Wiseboost_General</module>
|
| 18 |
+
</setup>
|
| 19 |
+
<connection>
|
| 20 |
+
<use>core_setup</use>
|
| 21 |
+
</connection>
|
| 22 |
+
</wiseboostgeneral_setup>
|
| 23 |
+
<wiseboostgeneral_write>
|
| 24 |
+
<connection>
|
| 25 |
+
<use>core_write</use>
|
| 26 |
+
</connection>
|
| 27 |
+
</wiseboostgeneral_write>
|
| 28 |
+
<wiseboostgeneral_read>
|
| 29 |
+
<connection>
|
| 30 |
+
<use>core_read</use>
|
| 31 |
+
</connection>
|
| 32 |
+
</wiseboostgeneral_read>
|
| 33 |
+
</resources>
|
| 34 |
+
<models>
|
| 35 |
+
<wiseboostgeneral>
|
| 36 |
+
<class>Wiseboost_General_Model</class>
|
| 37 |
+
</wiseboostgeneral>
|
| 38 |
+
</models>
|
| 39 |
+
<helpers>
|
| 40 |
+
<wiseboostgeneral>
|
| 41 |
+
<class>Wiseboost_General_Helper</class>
|
| 42 |
+
</wiseboostgeneral>
|
| 43 |
+
</helpers>
|
| 44 |
+
</global>
|
| 45 |
+
<adminhtml>
|
| 46 |
+
<events>
|
| 47 |
+
<controller_action_predispatch>
|
| 48 |
+
<observers>
|
| 49 |
+
<wiseboostgeneral>
|
| 50 |
+
<type>singleton</type>
|
| 51 |
+
<class>wiseboostgeneral/feed</class>
|
| 52 |
+
<method>check</method>
|
| 53 |
+
</wiseboostgeneral>
|
| 54 |
+
</observers>
|
| 55 |
+
</controller_action_predispatch>
|
| 56 |
+
</events>
|
| 57 |
+
</adminhtml>
|
| 58 |
+
<default>
|
| 59 |
+
<wiseboostgeneral>
|
| 60 |
+
<feed>
|
| 61 |
+
<url>www.wiseboost.com/?feed=rss2&cat=12</url>
|
| 62 |
+
<use_https>0</use_https>
|
| 63 |
+
<frequency>24</frequency>
|
| 64 |
+
<enable>1</enable>
|
| 65 |
+
</feed>
|
| 66 |
+
</wiseboostgeneral>
|
| 67 |
+
</default>
|
| 68 |
+
</config>
|
app/code/community/Wiseboost/General/etc/system.xml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<wiseboostgeneral translate="label" module="wiseboostgeneral">
|
| 5 |
+
<label>Wiseboost</label>
|
| 6 |
+
<sort_order>99999</sort_order>
|
| 7 |
+
</wiseboostgeneral>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<wiseboostgeneral translate="label" module="wiseboostgeneral">
|
| 11 |
+
<label>Notifications</label>
|
| 12 |
+
<tab>wiseboostgeneral</tab>
|
| 13 |
+
<frontend_type>text</frontend_type>
|
| 14 |
+
<sort_order>99999</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
<groups>
|
| 19 |
+
<feed>
|
| 20 |
+
<label>Notifications</label>
|
| 21 |
+
<frontend_type>text</frontend_type>
|
| 22 |
+
<sort_order>70</sort_order>
|
| 23 |
+
<show_in_default>1</show_in_default>
|
| 24 |
+
<show_in_website>1</show_in_website>
|
| 25 |
+
<show_in_store>1</show_in_store>
|
| 26 |
+
<fields>
|
| 27 |
+
<enable translate="label">
|
| 28 |
+
<label>Enabled</label>
|
| 29 |
+
<comment>Enable notifications from Wiseboost</comment>
|
| 30 |
+
<frontend_type>select</frontend_type>
|
| 31 |
+
<sort_order>100</sort_order>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 36 |
+
</enable>
|
| 37 |
+
</fields>
|
| 38 |
+
</feed>
|
| 39 |
+
</groups>
|
| 40 |
+
</wiseboostgeneral>
|
| 41 |
+
</sections>
|
| 42 |
+
</config>
|
app/code/community/Wiseboost/WishlistCounter/Helper/Data.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Wiseboost
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Wiseboost
|
| 13 |
+
* @package Wiseboost_WishlistCounter
|
| 14 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Wiseboost_WishlistCounter_Helper_Data extends Mage_Core_Helper_Abstract
|
| 19 |
+
{
|
| 20 |
+
|
| 21 |
+
}
|
app/code/community/Wiseboost/WishlistCounter/Model/Observer.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Wiseboost
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Wiseboost
|
| 13 |
+
* @package Wiseboost_WishlistCounter
|
| 14 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class Wiseboost_WishlistCounter_Model_Observer
|
| 18 |
+
{
|
| 19 |
+
|
| 20 |
+
const ENABLED = 'wiseboost_wishlistcounter/settings/enabled';
|
| 21 |
+
|
| 22 |
+
public function catalogProductLoadAfter(Varien_Event_Observer $observer)
|
| 23 |
+
{
|
| 24 |
+
if (Mage::getStoreConfigFlag(self::ENABLED)) {
|
| 25 |
+
$productId = $observer->getProduct()->getId();
|
| 26 |
+
$wishlist = Mage::getModel('wishlist/item')->getCollection();
|
| 27 |
+
$wishlist->getSelect()
|
| 28 |
+
->join(array('t2' => 'wishlist'),
|
| 29 |
+
'main_table.wishlist_id = t2.wishlist_id',
|
| 30 |
+
array('wishlist_id','customer_id'))
|
| 31 |
+
->where('main_table.product_id = '. $productId);
|
| 32 |
+
$count = $wishlist->getSize();
|
| 33 |
+
$observer->getProduct()->setWishlistCount($count);
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function catalogProductCollectionLoadAfter(Varien_Event_Observer $observer)
|
| 38 |
+
{
|
| 39 |
+
if (Mage::getStoreConfigFlag(self::ENABLED)) {
|
| 40 |
+
$productCollection = $observer->getCollection();
|
| 41 |
+
foreach ($productCollection as $product) {
|
| 42 |
+
$productId = $product->getId();
|
| 43 |
+
$wishlist = Mage::getModel('wishlist/item')->getCollection();
|
| 44 |
+
$wishlist->getSelect()
|
| 45 |
+
->join(array('t2' => 'wishlist'),
|
| 46 |
+
'main_table.wishlist_id = t2.wishlist_id',
|
| 47 |
+
array('wishlist_id','customer_id'))
|
| 48 |
+
->where('main_table.product_id = '. $productId);
|
| 49 |
+
$count = $wishlist->getSize();
|
| 50 |
+
$product->setWishlistCount($count);
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
}
|
app/code/community/Wiseboost/WishlistCounter/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Wiseboost
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Wiseboost
|
| 14 |
+
* @package Wiseboost_WishlistCounter
|
| 15 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<acl>
|
| 21 |
+
<resources>
|
| 22 |
+
<all>
|
| 23 |
+
<title>Allow Everything</title>
|
| 24 |
+
</all>
|
| 25 |
+
<admin>
|
| 26 |
+
<children>
|
| 27 |
+
<system>
|
| 28 |
+
<children>
|
| 29 |
+
<config>
|
| 30 |
+
<children>
|
| 31 |
+
<wiseboost_wishlistcounter>
|
| 32 |
+
<title>Wiseboost - Wishlist Counter</title>
|
| 33 |
+
</wiseboost_wishlistcounter>
|
| 34 |
+
</children>
|
| 35 |
+
</config>
|
| 36 |
+
</children>
|
| 37 |
+
</system>
|
| 38 |
+
</children>
|
| 39 |
+
</admin>
|
| 40 |
+
</resources>
|
| 41 |
+
</acl>
|
| 42 |
+
</config>
|
app/code/community/Wiseboost/WishlistCounter/etc/config.xml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Wiseboost
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Wiseboost
|
| 14 |
+
* @package Wiseboost_WishlistCounter
|
| 15 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<modules>
|
| 21 |
+
<Wiseboost_WishlistCounter>
|
| 22 |
+
<version>0.1.0</version>
|
| 23 |
+
</Wiseboost_WishlistCounter>
|
| 24 |
+
</modules>
|
| 25 |
+
<global>
|
| 26 |
+
<helpers>
|
| 27 |
+
<wiseboost_wishlistcounter>
|
| 28 |
+
<class>Wiseboost_WishlistCounter_Helper</class>
|
| 29 |
+
</wiseboost_wishlistcounter>
|
| 30 |
+
</helpers>
|
| 31 |
+
<models>
|
| 32 |
+
<wiseboost_wishlistcounter>
|
| 33 |
+
<class>Wiseboost_WishlistCounter_Model</class>
|
| 34 |
+
</wiseboost_wishlistcounter>
|
| 35 |
+
</models>
|
| 36 |
+
</global>
|
| 37 |
+
<frontend>
|
| 38 |
+
<events>
|
| 39 |
+
<catalog_product_load_after>
|
| 40 |
+
<observers>
|
| 41 |
+
<wiseboost_wishlistcounter>
|
| 42 |
+
<type>singleton</type>
|
| 43 |
+
<class>Wiseboost_WishlistCounter_Model_Observer</class>
|
| 44 |
+
<method>catalogProductLoadAfter</method>
|
| 45 |
+
</wiseboost_wishlistcounter>
|
| 46 |
+
</observers>
|
| 47 |
+
</catalog_product_load_after>
|
| 48 |
+
<catalog_product_collection_load_after>
|
| 49 |
+
<observers>
|
| 50 |
+
<wiseboost_wishlistcounter>
|
| 51 |
+
<type>singleton</type>
|
| 52 |
+
<class>Wiseboost_WishlistCounter_Model_Observer</class>
|
| 53 |
+
<method>catalogProductCollectionLoadAfter</method>
|
| 54 |
+
</wiseboost_wishlistcounter>
|
| 55 |
+
</observers>
|
| 56 |
+
</catalog_product_collection_load_after>
|
| 57 |
+
</events>
|
| 58 |
+
</frontend>
|
| 59 |
+
</config>
|
app/code/community/Wiseboost/WishlistCounter/etc/system.xml
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Wiseboost
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Wiseboost
|
| 14 |
+
* @package Wiseboost_WishlistCounter
|
| 15 |
+
* @copyright Copyright (c) 2013 Wiseboost. (http://www.wiseboost.com)
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<sections>
|
| 21 |
+
<wiseboost_wishlistcounter module="wiseboost_wishlistcounter" label="label">
|
| 22 |
+
<class>separator-top</class>
|
| 23 |
+
<label>Wishlist Counter</label>
|
| 24 |
+
<tab>wiseboostgeneral</tab>
|
| 25 |
+
<frontend_type>text</frontend_type>
|
| 26 |
+
<sort_order>45</sort_order>
|
| 27 |
+
<show_in_default>1</show_in_default>
|
| 28 |
+
<show_in_website>1</show_in_website>
|
| 29 |
+
<show_in_store>1</show_in_store>
|
| 30 |
+
<groups>
|
| 31 |
+
<settings translate="label">
|
| 32 |
+
<label>Wishlist Counter Settings</label>
|
| 33 |
+
<frontend_type>text</frontend_type>
|
| 34 |
+
<sort_order>900</sort_order>
|
| 35 |
+
<show_in_default>1</show_in_default>
|
| 36 |
+
<show_in_website>1</show_in_website>
|
| 37 |
+
<show_in_store>1</show_in_store>
|
| 38 |
+
<fields>
|
| 39 |
+
<enabled translate="label">
|
| 40 |
+
<label>Enable Wishlist Counter</label>
|
| 41 |
+
<frontend_type>select</frontend_type>
|
| 42 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 43 |
+
<sort_order>50</sort_order>
|
| 44 |
+
<show_in_default>1</show_in_default>
|
| 45 |
+
<show_in_website>1</show_in_website>
|
| 46 |
+
<show_in_store>1</show_in_store>
|
| 47 |
+
</enabled>
|
| 48 |
+
</fields>
|
| 49 |
+
</settings>
|
| 50 |
+
</groups>
|
| 51 |
+
</wiseboost_wishlistcounter>
|
| 52 |
+
</sections>
|
| 53 |
+
</config>
|
app/etc/modules/Wiseboost_General.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Wiseboost_General>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Wiseboost_General>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
app/etc/modules/Wiseboost_WishlistCounter.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Wiseboost_WishlistCounter>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Wiseboost_WishlistCounter>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Wiseboost_WishlistCounter</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>WISHLIST COUNTER is an extension that will count the number of persons who have an item in their wishlist and displays it on the product page (or in category listing). </summary>
|
| 10 |
+
<description>WISHLIST COUNTER is an extension that will count the number of persons who have an item in their wishlist and displays it on the product page (or in category listing). </description>
|
| 11 |
+
<notes>First stable release</notes>
|
| 12 |
+
<authors><author><name>Wiseboost</name><user>Wiseboost</user><email>raceface89@hotmail.com</email></author></authors>
|
| 13 |
+
<date>2013-11-28</date>
|
| 14 |
+
<time>05:00:00</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Wiseboost"><dir name="General"><dir name="Helper"><file name="Data.php" hash="4fa9a117fd0fbcd2d3f60ee7059366d0"/></dir><dir name="Model"><file name="Feed.php" hash="ec3d2e01280846544278f16d692a8b9a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a3e6d62888357576b7f9f17d3a4bc26d"/><file name="config.xml" hash="92099631f9f3dd0b50f9f04c60e9b6a6"/><file name="system.xml" hash="15c1ba086cf5ee75d3f479ffeb934110"/></dir></dir><dir name="WishlistCounter"><dir name="Helper"><file name="Data.php" hash="4accb80bb4624522f64f5c19c6ef9a34"/></dir><dir name="Model"><file name="Observer.php" hash="7a7706dfcff1b14c7ea5dba031d00bc8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a60f8e1a2d2a0381beab199b8c06bbef"/><file name="config.xml" hash="c2bed1b4eca7d10b85b7d19d1a5ddc30"/><file name="system.xml" hash="e1b4ef1c349eb56e918cf628666fd686"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wiseboost_WishlistCounter.xml" hash="a65ef2f9961fd5f0f0a0cf251aa3c734"/><file name="Wiseboost_General.xml" hash="8373b0af51b16d30b3f43af037076706"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
