I am trying to validate my configuration before save but it does not work on website scope.

It works if i choose default config scope.

Here is my code.

 <?xml version="1.0"?>
                        <showinfrontend translate="label">
                        <label>Enabled On Front-End</label>
                        <partpayment translate="label">
                        <label>Partpayment Method</label>

Model file is as below.

class Kgn_Bankpayment_Model_System_Config_Backend_Validatepayment extends Mage_Core_Model_Config_Data
    protected function _beforeSave()
         echo "<pre/>";print_r(Mage::app()->getRequest()->getPost());exit;

        $value = $this->getValue();
        $totalpartCollection = Mage::getModel('pdftemplate/totalpart')->getCollection()
        $resource = Mage::getSingleton('core/resource');
        $writeConnection = $resource->getConnection('core_write');
        $table = $resource->getTableName('pdftemplate/totalpart');
        foreach($totalpartCollection as $totalpart){
            $id = $totalpart->getId();
            if($value == $id){
                $query = "UPDATE {$table} SET status = 1,is_default=1 WHERE totalpartrule_id = "
             . (int)$id;
                $query = "UPDATE {$table} SET status = 2,is_default=0 WHERE totalpartrule_id = ". (int)$id;




Got the answer.

But it is strange when i choose website or store view scope and only one of checkbox checked near form field then it is not working if i uncheck all the checkbox and save then it is working. If anyone know how this is actually working please write note here for understand.

Here Is Screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.