Search This Blog

Wednesday, January 30, 2013

Really apply Magento Catalog rules

One of the things the regular cron jobs to is to reapply the catalog rules.
A symptom of the catalog rules not working is when the price of an item in a shopping cart doesn't have a sale price applied to it - was it does when viewing/searching for them from the catalog.

The cron entry in the config.xml file for the catalog in the rules should have:
    <crontab>
        <jobs>
            <catalog_product_index_price_reindex_all>
                <schedule><cron_expr>0 2 * * *</cron_expr></schedule>
                <run><model>catalog/product_indexer_price::reindexAll</model></run>
            </catalog_product_index_price_reindex_all>
        </jobs>
    </crontab>
</config>

This shows the catalog reindexAll method in product_indexer_price being called every hour.
If cron is working correctly this should be getting called.
I had an experience with a v.1.5.1.0 store where this wasn't happening and every so often the rules would not be applied.
The code below - which I added to a custom cron script applies the rules directly.


    /**
     * Apply all active catalog price rules
     */
try {
    Mage::getModel('catalogrule/rule')->applyAll();
    Mage::app()->removeCache('catalog_rules_dirty');
    echo  'The rules have been applied.';
    // added JMR 08-01-2013
    Mage::log("Cron apply rules run");
} catch (Exception $e) {
    echo 'Unable to apply rules.';
    Mage::log("Cron Unable to apply rules");
    Mage::printException($e);
}



16 comments:

  1. I am not certain the place you are getting your information, however great topic. I must spend some time learning more or working out more. Thanks for magnificent info I used to be looking for this information for my mission. https://www.facebook.com/hiremagentodeveloper

    ReplyDelete
    Replies
    1. Nice code html.
      Ketika Anda berada di tempat Anda baru menyadari bahwa tidak ada yang gratis togel totojitu online. Praktek ini bertujuan untuk menarik pengunjung ke lokasi bisnis yang akan menawarkan banyak insentif togel totojitu online. Tentu saja tidak ada jaminan apakah penawaran itu benar. Kami selalu diingatkan bahwa dunia adalah tempat yang 8togel indah dan masih ada banyak orang baik di luar sana. Hanya pepatah ini yang tidak selalu bisa dipercaya terutama di king4d online tempattempat curang seperti Las Vegas. Anda harus lebih pintar dalam mengambil keputusan. Lengkapi diri Anda dengan pengetahuan togel lotus4d yang cukup sehingga Anda dapat melindungi diri dari manipulator dan tindakan penipuan mereka. Apa pun itu memiliki sisi baik dan sisi buruknya togel singapore. Aturan yang sama berlaku untuk permainan judi yang ingin kita lakukan. Perjudian tentu saja memiliki efek baik togel king4d dan buruk pada pemain. Tentu saja kita akrab dengan keluhan publik bahwa judi membuat bangkrut atau penjudi menghancurkan lxtoto online hubungan sosial seseorang. Dan pada tingkat ekstrem perjudian membuat orang terlibat dalam kasus Eyang Togel kriminal dan ditangani sesuai dengan hukum. Padahal dampak Toto Singapore negatif dari perjudian tidak hanya finansial dan sosial.

      Delete
  2. I think this is among the such a lot important info for me. And i am satisfied reading your article. However want to observation on some common issues, The web site style is perfect, the articles is really great

    Triple glazed wood windows

    ReplyDelete
  3. I believe that is among the most significant info for me. And i'm glad studying your article. However should remark on few common issues, The web site taste is wonderful, the articles is actually excellent : D. Just right job, cheers
    web design orlando

    ReplyDelete
  4. I'm extremely impressed along with your writing skills as smartly as with the structure for your blog. Is this a paid theme or did you modify it yourself? Anyway stay up the nice high quality writing, it is rare to see a nice weblog like this one today..web design dubai

    ReplyDelete
  5. I am not certain the place you are getting your information, however great topic. I must spend some time learning more or working out more. Thanks for magnificent info I used to be looking for this information for my mission. website design dubai

    ReplyDelete
  6. The post shared is worth to read and interesting for the newbies by all means for more knowledge - I was in search of such blog who explore my knowledge in the industry.for more knowledge-
    Jogging track

    ReplyDelete
  7. Hello There. I found your blog using msn. This is an extremely well written article. I'll be sure to bookmark it and come back to read extra of your useful information. Thank you for the post. I'll certainly comeback. link seo in philippines

    ReplyDelete
  8. Generally I do not read post on blogs, however I would like to say that this write-up very compelled me to take a look at and do so! Your writing taste has been surprised me. coaching classes in vadodara

    ReplyDelete
  9. Superb, what a weblog it is! This blog gives helpful information to us, keep it up.send sms from pc

    ReplyDelete
  10. Thanks for sharing as it is an excellent post would love to read your future post for more knowledge- I was in search of such blog who explore my knowledge in the industry.for more knowledge- Engineering colleges in vadodara

    ReplyDelete
  11. I am not certain the place you are getting your information, however great topic. I must spend some time learning more or working out more. Web Design Dubai

    ReplyDelete
  12. The post is really useful. Thanks for posting it.
    SEO Abu Dhabi

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Your blog is incredible. Thanks for sharing the useful information.
    PR Dubai

    ReplyDelete