1

I am creating an e-commerce website for a restaurant, there will be extra toppings available on pizzas. I have achieved this partially by using taxonomy to create the toppings and by giving this taxonomy term a field for price.

The rule then updates the price by adding the price of the topping on to the total price for that pizza. This is working when I view the cart page, but on the summary page it is not taking affect at all.

There is also an issue with the Ajax add to cart module in that if I add to cart a pizza of one kind with no extra toppings, and then add to cart the same pizza with an extra topping, the price in the cart for both pizzas is updated to be the price of the pizza WITH the additional topping.

However the total price is correct in this. I have checked the view for both the cart page and the summary page and they seem to be the same, which makes me think that the issue is with rules

This is my rule at present. I have used to commerce tutorial for a pizza shop using the customisable products module.

{ "rules_pizza_toppings" : {
    "LABEL" : "Pizza Toppings",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" :     "field_extra_toppings" } }
    ],
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-line-item:field-extra-toppings" ] },
          "ITEM" : { "pizza_topping" : "Pizza Topping" },
          "DO" : [
            { "commerce_line_item_unit_price_add" : {
                "commerce_line_item" : [ "commerce_line_item" ],
                "amount" : [ "pizza-topping:field-pizza-toppings-price:amount" ],
                "component_name" : "fee",
                "round_mode" : "1"
              }
            }
          ]
        }
      }
    ]
  }
}
0

It's best to use separate questions for separate issues here. The one from the title is almost certainly due to a regression introduced in Rules 2.8 and documented in the Commerce 7.x-1.11 release notes: https://www.drupal.org/node/2408705

You can downgrade to Rules 2.7 until a fix is put into Rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy