Show promotions dynamically on the Magento product page

How can I get a collection of promotions tied to a specific product.

+6
source share
3 answers

What you are looking for is one of these two methods. Choose the one that suits you:

  • Mage_CatalogRule_Model_Resource_Rule::getRulesFromProduct()
  • Mage_CatalogRule_Model_Resource_Rule::getRulesForProduct()
+3
source

You can use the Magentos related products block for this. You attach related products to a specific product in the admin panel. Then they will appear in the corresponding section of the product, which is by default located on the right sidebar.

If it does not appear, you can simply add it to the left sidebar, content, or right sidebar by adding the following xml:

 <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/> 
+1
source

It is impossible to find Sales rules that can be applied to any specific product until this product is added to the basket, because the sales rules depend on the current state of the shopping basket, for example, any sales rule applies only if subtul> Xxxx.

But you can get the catalog price rule using

 Mage_CatalogRule_Model_Resource_Rule::getRulesForProduct($date, $wId, $pId) $date :- Current date $wid :- Website Id $pid :- Product Id 
+1
source

Source: https://habr.com/ru/post/959443/


All Articles