根据目录价格规则获取产品列表

发布于 2024-11-08 07:11:31 字数 73 浏览 0 评论 0原文

假设我创建了一个价格规则,所有价格超过 1000 卢比的产品都将获得 30% 的折扣。现在我应该做什么来列出目录价格规则下的那些产品

suppose i have created a price rule that all product which have price more than Rs.1000 they will get 30% off. Now what i should do to make a list of those product which are under that catalog price rule

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红尘作伴 2024-11-15 07:11:31

很奇怪的是,确实没有简单的功能。我能想到的是以下方法来获取所选产品的所有 id 列表:

仅当规则已应用时才有效。

  • 找出规则的 id。当您处于规则编辑屏幕时,您可以从网址栏读取此内容。
  • 对数据库运行以下查询:SELECT DISTINCT Product_id FROM Catalogrule_product WHERE Rule_id=;,其中将替换为通过步骤 1 中找到的 id。

不过可能会有更简单的事情..

Quite odd that there is no simple functionality for that indeed. What I can think of is the following to get a list of all ids of the selected products:

This works only when the rules have been applied already.

  • Find out the id of the rule. You can read this from the url bar when you're in the rule edit screen.
  • Run the following query against the database: SELECT DISTINCT product_id FROM catalogrule_product WHERE rule_id=<id>; where you replace <id> by the id found in step 1.

There might be something easier though..

爱的十字路口 2024-11-15 07:11:31

我一直在寻找同样的东西,找到了以下代码,您可以将其粘贴到 list.phtml 中,它会向您显示特定目录价格规则下的产品:

$rule = Mage::getModel('catalogrule/rule')->load(12);  /* catalog price rule id */
$rule->setWebsiteIds("1"); 
$productIdsArray = $rule->getMatchingProductIds(); 
$productsCollection = Mage::getModel('catalog/product')
                ->getCollection() 
                ->addAttributeToSelect("*") 
                ->addAttributeToFilter('visibility', 4)
                ->addAttributeToFilter("entity_id", array("in", $productIdsArray));

请务必更改其余的价格规则 id 和 $productsCollection list.phtml 中的代码

如果您能够遵循所有规则,请告诉我,几天来一直在寻找解决方案。

I have been looking for the same thing, found the following piece of code you can paste in your list.phtml and it shows you the products under a particular catalog price rule:

$rule = Mage::getModel('catalogrule/rule')->load(12);  /* catalog price rule id */
$rule->setWebsiteIds("1"); 
$productIdsArray = $rule->getMatchingProductIds(); 
$productsCollection = Mage::getModel('catalog/product')
                ->getCollection() 
                ->addAttributeToSelect("*") 
                ->addAttributeToFilter('visibility', 4)
                ->addAttributeToFilter("entity_id", array("in", $productIdsArray));

Be sure to change the price rule id and $productsCollection in the rest of the code in list.phtml

Should you be able to pull all the rules please let me know, been looking for a solution for a couple of days now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文