4

I'm trying to create a module which i'm hoping will extend the Catalog Price Rules feature to allow me to create pricing groups based on Cost plus a percentage (e.g. All products in a category are cost + 30% for specific customer group).

Firstly, how can I ensure that Magento uses this price even if it is higher than the base price??

Secondly, Which files do i need to override? So far, i've located:

  • vendor/magento/module-catalog-rule/Helper/Data.php - this contains the rule logic

  • vendor/magento/module-catalog-rule/Model/Rule.php - this contains the validation rules

  • vendor/magento/module-catalog-rule/Model/Rule/Action/Product.php - i think this contains the options for the rule logic

  • vendor/magento/module-catalog-rule/Model/Rule/Action/SimpleActionOptionsProvider.php - this also contains the options for the rule logic

  • vendor/magento/module-catalog-rule/Observer/ProcessAdminFinalPriceObserver.php & ProcessFrontFinalPriceObserver.php

Are there any others?

The last thing is that i will obviously need to parse the product cost into these functions, what would be the best way to do that?

Any and all help is greatly appreciated! :-)

1
  • Did you get this working? We are trying to accomplish the same thing
    – codestr
    Commented Jun 26, 2020 at 21:39

1 Answer 1

4

All good, i figured it all out.

  • vendor/magento/module-catalog-rule/Helper/Data.php
  • vendor/magento/module-catalog-rule/Model/Rule.php
  • vendor/magento/module-catalog-rule/Model/Rule/Action/Product.php
  • vendor/magento/module-catalog-rule/Model/Rule/Action/SimpleActionOptionsProvider.php
  • vendor/magento/module-catalog-rule/Observer/ProcessAdminFinalPriceObserver.php
  • vendor/magento/module-catalog-rule/Observer/ProcessFrontFinalPriceObserver.php
  • vendor/magento/module-catalog/Model/Product/Type/Price.php
  • vendor/magento/module-catalog-rule/Model/Indexer/IndexBuilder.php

were the files i needed in case anyone is interested

1
  • do you have any idea how can I add custom price rules instead of catalog price rules? I want to extend it with alot more features forexample: giving discount on the basis of custom attributes on products, giving discount on specific product, giving discount on the basis of my own attributes on products.
    – CodeGenius
    Commented Nov 7, 2018 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.