yii 2 ajax call

            url: Yii.createUrl('/site/save-session-notification'),
            type: 'POST',
            data: {
                notification_read_status: checkbox_val,
            success: function (data) {
              console.log("response here");
            error: function (error) {

public function actionSaveSessionNotification()

Additional hidden field with radio button set default value in yii2

additional hidden field with radio button set default value in yii2

you will see yii automatically adds hidden field with each radio button and checkbox , you can set its default value by following code

1<?= $form->field($model, 'session_frequency_id')->radio(['uncheck' => 1, 'label' => 'Daily', 'value' => 1, 'class' => 'icheck toggle-able sessionhost-session_frequency_id' ] ) ?>

in above code uncheck => 1 will set hidden field value .

magento 1 create admin user programmatically


    $mageFilename = 'app/Mage.php';

    if (!file_exists($mageFilename)) {

        echo $mageFilename." was not found";



    require_once $mageFilename;


    try {

        //create new user by providing details below

        $user = Mage::getModel('admin/user')


                'username' => 'admin1',

                'firstname' => 'John',

                'lastname' => 'Doe',

                'email' => 'john@example.com',

                'password' => 'welcome123',

                'is_active' => 1


    } catch (Exception $e) {

        echo $e->getMessage();



    try {

        //create new role

        $role = Mage::getModel("admin/roles")




        //give "all" privileges to role





    } catch (Mage_Core_Exception $e) {

        echo $e->getMessage();


    } catch (Exception $e) {

        echo 'Error while saving role.';



    try {

        //assign user to role




    } catch (Exception $e) {

        echo $e->getMessage();



    echo 'Admin User sucessfully created!';



Executing cron tasks manually in Magento

For example, we have this cron task on a config.xml file of a specific module:

1<catgento_sap_sync_nonimages><schedule><cron_expr>*/15 * * * *</cron_expr></schedule><run><model>sap/cron_sync_nonimages::run</model></run></catgento_sap_sync_nonimages>

we can create a new script that loads and executes that cron task like this (create a script.php file and put something like this inside):

1234567<?php//Load Magento APIrequire_once'app/Mage.php';Mage::app();//First we load the model$model= Mage::getModel('sap/cron_sync_nonimage');//Then execute the task$model->run();

The last step would be running this script manually (php script.php).

magento 1 clear cache command line

I have resolved the issue by myself with the following solution:

Login to your server and run the below command from your Magento root directory:

 php -r 'require "app/Mage.php"; Mage::app()->getCacheInstance()->flush();' 

Above command flush your Magento 1 cache. I suggest when changing Magento project folder then run the above command