【问题标题】:The Magento catalog price rules disappear sometimes during the dayMagento 目录价格规则有时会在白天消失
【发布时间】:2014-09-06 13:34:03
【问题描述】:

我的商店在 magento 1.8.1 CE 上运行。

目录价格规则运行良好,并且每晚都使用 cron 进行设置。

但有时白天价格规则会消失......我可以通过按设置的目录规则再次解决它,但是我错过了很多转换这个问题。

有谁知道怎么回事?

【问题讨论】:

    标签: magento cron catalog


    【解决方案1】:

    我有同样的问题,但我没有做太多调查。我每天从根目录运行以下代码作为 cron 作业,现在运行良好。

    <?php
    
    require_once 'app/Mage.php';
    
    Mage::app('default');
    
    $catalogRule = Mage::getModel('catalogrule/rule');
     $catalogRule->applyAll();
    
    Mage::app()->removeCache('catalog_rules_dirty');
    
    ?>
    

    【讨论】:

    • 我们的代码有问题 - 仍未解决)...PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1412 Table definition has changed, please retry transaction 不知何故,另一个进程正在同时访问该表。不确定我们是否可以锁定表格
    • 我们需要为每个 Magento 安装设置一组 cronjobs,我在发布时并不知道。看起来设置这些 cronjobs 可以解决这个问题。您的案例必须与一些管理员设置有关,设置 Magento cronjobs 将解决此问题。这从我的脑海中浮现。未测试。
    【解决方案2】:

    这是我们的解决方案。在 M 1.9.3.8 上此处不存在默认商店。运行后重新索引也很重要。

    require_once $mageFilename;
    
    Mage::app('admin', 'store');
    
    try{
      $catalogPriceRule = Mage::getModel('catalogrule/rule');
      $catalogPriceRule->applyAll();
    } catch (Exception $e) {
      die($e);
    }
    
    Mage::app()->removeCache('catalog_rules_dirty');
    
    $indexProcess = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
    
    if ($indexProcess) { 
        $indexProcess->reindexAll(); 
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-18
      • 1970-01-01
      • 2014-06-26
      相关资源
      最近更新 更多