Jump to content

Problem with beforeDelete on 1.5.6.2 ?


Mao ZEDONG

Recommended Posts

Hi guys,

 

I'm currently working on an automatic promotion module, I created a new admin tab and a new controller everything is fine here :

 

I also created the model wich works fine too, but my database is linked with foreign key on xx_specific_price_rule to delete every promotion linked with an automatic promotion, and the problem is there,

I can't delete my automatic promotion 'cause it's linked with specific price rule, so I decided to take a look on the current methods and I found beforeDelete, wich in my sense should occur as its name say "before the deleting request", then I started to make all required requests and nothing happened even with a die or anything, moreover the afterAdd is working fine and not the beforeDelete...

 

Is there something to do to activate beforeDelete ?

 

Thank you for your future answers.

Link to comment
Share on other sites

Now I have a problem with an override I put a class SpecificPriceRule.php in override/classes/SpecificPriceRule.php in my module wich is this class :

class SpecificPriceRule extends SpecificPriceRuleCore {

    public $name;
    public $id_shop;
    public $id_currency;
    public $id_country;
    public $id_group;
    public $from_quantity;
    public $price;
    public $reduction;
    public $reduction_type;
    public $from;
    public $to;
    public $id_promotion = NULL;

    public static $definition = array(
        'table' => 'specific_price_rule',
        'primary' => 'id_specific_price_rule',
        'fields' => array(
            'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
            'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
            'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
            'id_currency' => array('type' => self::TYPE_INT, 'required' => true),
            'id_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
            'from_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
            'price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'required' => true),
            'reduction' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
            'reduction_type' => array('type' => self::TYPE_STRING, 'validate' => 'isReductionType', 'required' => true),
            'from' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'required' => false),
            'to' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'required' => false),
            'id_promotion' => array('type' => self::TYPE_INT, 'required' => false),
        ),
    );
}

public function __construct() {
    parent::__construct();
}

I want add a variable called id_promotion and currently it's not working...

 

The beforeDelete is still not working.

Edited by Mao ZEDONG (see edit history)
Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...