OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce Price list rules

This topic contains 6 replies, has 4 voices, and was last updated by  Summa Solutions 4 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #31494

    tjurczak
    Participant

    Hi,

    I know that price list in Oro have very useful functions like:
    – Product Assignment
    – Price Calculation Rules

    The only problem is that there are no documentation or I couldn’t find it.
    1) I need to know how to use product assignemnt and prices caluclations rules?
    2) How should example expressions look like? (what entities/fields can be used in expressions)
    3) Can I use product assigment for fileter price list by category?
    4) What about performance if complex expressions were used?

    I will be grateful for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #31495

    sparlea
    Participant

    Hello,

    When adding or editing a price list you have the options to add new product assignment rules or price calculations for products that belong to this price list.

    Let’s say we want to add a new price list and assign to it all products from a category. For example if we want all products from category with id 2 then we add this condition to product assignment rule: product.category==2. In this expressions you can use attributes from other price lists, you can refer to a price list using: pricelist[1].prices.currency where 1 is the id of the price list that you refer to. Also you can use product attributes like product.id . You can combine this rules using operands like or, and.

    In price calculations you can add the quantity for a product unit and the price for the specified quantity. Here you can also use expressions but also you can specify exact values. You can switch to expression and for each field you can write something like: Qty: pricelist[1].prices.quantity, Unit: pricelist[1].prices.unit, Currency: pricelist[1].prices.currency . And in the calculate as field pricelist[1].prices.value+10 if we want to add 10$ to the prices set in the price list with id 1.

    You can use the product assignment to select only products from a category like in the example above.

    This expressions will generate a new sql query and it will run in one go, so depending on how many price lists you will use it will make additional joins.

    Hope this helps.

    #31496

    tjurczak
    Participant

    First of all I would like to thanks for previous answer!

    I have a problem with generate auto prices. I will describe what have I done:

    1) I created price list A with:
    rule: product.sku==”1GS46″
    Price for quantity: 1 each $
    Calculate as: 100
    2) I assigned price list A to product P1 group or even customer C1.
    3) I know (because tested) that normal price list working OK (when I add price to product). Price is changing on frontend.
    4) I executed “Recalculate” on price list A
    5) I executed “app/console oro:price-lists:recalculate –all”

    Price doesn’t change on frontend. Price is always taking from default price list. There isn’t price for product P1 on price list details on backend. I saw that there is column “Type”. I suppose that generated prices will have type “Auto”.

    What am I doing wrong?

    #31497

    Hello,

    Prices are generated by queue message processors. To run queue messages processing execute

    Also note, that prices generation is limited to price list enabled currencies and to product units,
    so no prices will be generated if USD is not enabled for price list or in case when “each” is not supported unit for product with SKU ”1GS46″

    #31498

    tjurczak
    Participant

    Hi Dimitry,

    You are right! “Each” was not supported unit for my product. I didin’t notice.

    However Would be nice to have some logs or something. Where can i find some logs about price generation? Should I up verbosity somewhere?

    Thanks!

    #31499

    Prices are generated with single Database query that is constructed per each rule.
    There are no individual restrictions or per entity generation information.

    #40023

    Summa Solutions
    Participant

    Hi Dmitry,
    We have a similar problem with the deadlock in the price recalculation. This happened after the client modifed and created new Prices List from the Admin. (We have 4 main lists and approximately 210 dynamic prices lists)

    When we execute the command “oro:price-lists:recalculate –disable-triggers –all”; we get the same deadlock exception.

    – Should we execute this command? or this calculation should be made by via queue?

    Oro Commerce Version: 1.6.29
    Error:
    [Doctrine\DBAL\Driver\PDOException]
    SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

Viewing 6 replies - 1 through 6 (of 6 total)

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top