Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrank committed Mar 31, 2012
2 parents 2a65e8b + 13e15df commit ed75cd9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
62 changes: 62 additions & 0 deletions app/code/community/Hackathon/DiscountForATweet/Model/Observer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* License: GNU General Public License
*
* Copyright (c) 2012 Magento Hackathon. All rights reserved.
* Note: Original work copyright to respective authors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Hackathon
* @package Hackathon_DiscountForATweet
* @subpackage Model
* @copyright Copyright (c) 2012 Magento Hackathon
* @license http://www.gnu.org/licenses/gpl.html GPL, version 3
* @version 0.1.0
* @link http://magento-hackathon.de
* @since File available since Release 0.1.0
* @author Hackathon Core Team <core@hackathon>
*/

/**
* Implements observer functionality for module.
*
* @category Hackathon
* @package Hackathon_DiscountForATweet
* @subpackage Model
* @copyright Copyright (c) 2012 Magento Hackathon
* @license http://www.gnu.org/licenses/gpl.html GPL, version 3
* @version Release: 0.1.0
* @since Class available since Release 0.1.0
* @author Hackathon Core Team <core@hackathon>
*/

class Hackathon_DiscountForATweet_Model_Observer
{
/**
* Event: salesrule_rule_condition_combine
*
*/
function addConditionToSalesRule($observer)
{
$additional = $observer->getAdditional();
$conditions = (array) $additional->getConditions();
$conditions = array_merge_recursive($conditions, array(
array('label'=>Mage::helper('hackathon_discountforatweet')->__('Tweeted about'), 'value'=>'hackathon_discountforatweet/condition_tweet'),
));
$additional->setConditions($conditions);
$observer->setAdditional($additional);
return $observer;
}
}
10 changes: 10 additions & 0 deletions app/code/community/Hackathon/DiscountForATweet/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,15 @@
<class>Hackathon_DiscountForATweet_Helper</class>
</hackathon_discountforatweet>
</helpers>
<events>
<salesrule_rule_condition_combine>
<observers>
<add_condition_to_sales_rule>
<class>hackathon_discountforatweet/observer</class>
<method>addConditionToSalesRule</method>
</add_condition_to_sales_rule>
</observers>
</salesrule_rule_condition_combine>
</events>
</global>
</config>

0 comments on commit ed75cd9

Please sign in to comment.