Monday 27 November 2017

Magento 1.9 Catalog Price Rules Not Working [SOLVED]

We have find a two solution to solve this problem.

Solution One :

Setup a cron and check is working or not. if it is working check your Default Store Timezone is matching your server timezone.

 Default Store Timezone == Server Timezone

both are same the working fine.

Other solution :


Create a php page in root directory then past a below code.

'applyrules.php '

<?php
require_once 'app/Mage.php';
Mage::init();
ini_set('max_execution_time', 1800); //900 seconds = 15 minutes

        Mage::getModel('catalogrule/rule')->applyAll();
        Mage::getModel('catalogrule/flag')->loadSelf()
            ->setState(0)
            ->save();

?>


and set a cron 'applyrules.php' one time every day

then need a clear cash auto
Need one cron auto 'cleancash'

then create a php page 'autocleancash.php' with below code.

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
//echo 'Hello1';
require_once 'app/Mage.php';


Mage::init();
$types = Mage::app()->getCacheInstance()->getTypes();

try {
    echo "Cleaning data cache... \n";
    flush();
    foreach ($types as $type => $data) {
        echo "Removing $type ... ";
        echo Mage::app()->getCacheInstance()->clean($data["tags"]) ? "Cache cleared!" : "There is some error!";
        echo "\n";
    }
} catch (exception $e) {
    die("[ERROR:" . $e->getMessage() . "]");
}

echo "\n";

try {
    echo "Cleaning stored cache... ";
    flush();
    echo Mage::app()->getCacheInstance()->clean() ? "Cache cleared!" : "There is some error!";
    echo "\n\n";
} catch (exception $e) {
    die("[ERROR:" . $e->getMessage() . "]");
}             

?>



 if any issues please email me.

Thanks,
Kuldeep singh

 

No comments:

Post a Comment