0

I don't want to apply the discount coupon on the products already discounted i.e on products having special price . So i created a event listen as :

<?xml version="1.0" ?>
<config>
<modules>
    <Tweett_Fashionn>
        <version>0.1.0</version>
    </Tweett_Fashionn>
</modules>
<global>
    <events>
        <salesrule_validator_process>
            <observers>
                <Tweett_Fashionn_Hook>
                    <type>singleton</type>
                    <class>Tweett_Fashionn_Model_Observer</class>
                    <method>specialpricediscount</method>
                </Tweett_Fashionn_Hook>
            </observers>
        </salesrule_validator_process>
    </events>
</global>

and the observer file as

<?php
 class Tweett_Fashionn_Model_Observer extends Varien_Event_Observer{
public function __construct(){
    echo "<p style='color:red'>Hello World .. </p>";
}
public function specialpricediscount($observer){
    $item=$observer['item'];
    $_product = Mage::getSingleton('catalog/product')->load($item->getProductId());           
    if($_product->getSpecialPrice()>0 ){
        $result = $observer['result'];
        $result->setDiscountAmount(0);                
    } 
   }
   }
 ?>

but it dont even print the hello world when i click on apply coupon button ..plz help

2 Answers2

0

You're missing the ending from your config.xml? You may have just not pasted it in. Have you made sure your module is enabled? Take a look at this free extension it can help you debug extensions - http://www.magentocommerce.com/magento-connect/magneto-debug-8676.html

Luke Collymore
  • 216
  • 1
  • 5
0

I had same issue.I think following is correct way :

 <salesrule_validator_process>
        <observers>
            <Namespace_Modulename> // your namespace_modulename
                <type>model</type> //change singleton to model
                <class>Tweett_Fashionn_Model_Observer</class>
                <method>specialpricediscount</method>
            </Namespace_Modulename>
        </observers>
    </salesrule_validator_process>

May this will help you.

Satish Sojitra
  • 622
  • 6
  • 18