Magento catalog price rule disappears at night

前端 未结 5 1209
谎友^
谎友^ 2020-12-14 04:45

I have developed the online store on magento platform. Everything works fine except the Catalog price rule for sale. I have created the simple rule that applies 15% discount

5条回答
  •  囚心锁ツ
    2020-12-14 05:07

    I used a shell script instead of the (huge) AOE page @Lakshin Karunaratne suggested.

    require_once 'abstract.php';
    
    class X043_Shell_PriceRuleSetter extends Mage_Shell_Abstract
    {
        public function run()
        {
            // stuff and thingies
            umask(0);
            Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
            setlocale(LC_ALL, 'en_US.UTF-8'); 
    
            try {
                Mage::getModel('catalogrule/rule')->applyAll();
                Mage::getModel('catalogrule/flag')->loadSelf()
                    ->setState(0)
                    ->save();
            } catch (Mage_Core_Exception $e) {
                Mage::logException($e);
            } catch (Exception $e) {
                Mage::logException($e);
            }
    
            return $this;
        }
    }
    
    $shell = new X043_Shell_PriceRuleSetter();
    $shell->run();
    

提交回复
热议问题