目录价格规则“应用规则"以编程方式 [英] Catalog Price Rules "Apply Rules" programmatically

查看:79
本文介绍了目录价格规则“应用规则"以编程方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以编程方式创建了一个目录价格规则,效果很好.

I have created one Catalog Price Rule Programmatically it works fine.

所以我的问题是,我需要以管理员身份登录,并且需要单击应用规则" 的按钮.我不知道该怎么办.

so my issue is, I need to do login with admin and need click button of "Apply Rules" other wise discount is not apply in magento store, so i need "Apply Rules" programmatically and i have no idea about it how to do.

任何帮助或建议将不胜感激.

推荐答案

您可以在新创建的Catalogrule ID

$rule = Mage::getModel('catalogrule/rule')->load($ruleId);
Mage::getResourceModel('catalogrule/rule')->updateRuleProductData($rule);
Mage::getResourceModel('catalogrule/rule')->applyAllRulesForDateRange();
Mage::getModel('catalogrule/rule')->_invalidateCache();
$indexProcess = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price');
if ($indexProcess) {
    $indexProcess->reindexAll();
}

这篇关于目录价格规则“应用规则"以编程方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆