oc-shopaholic / oc-orders-shopaholic-plugin

🛒 Orders (cart) extension for Shopaholic plugin
https://octobercms.com/plugin/lovata-ordersshopaholic
GNU General Public License v3.0
27 stars 18 forks source link

Multiple selectable properties + update order price #183

Open kevin-invato opened 1 year ago

kevin-invato commented 1 year ago

Hello,

We are currently building a webshop for a local office furniture company, but we are running into some challenges with certain products:

They have certain office chairs and desks that have multiple properties, and we want the visitors to be able to choose which properties they want to add to the cart/order, ie.:

Page/product: Office desk

Color: brown, sand, or white Height: 70-150cm, 80-160cm or 90-170cm Corner: Yes / No

Right now, we would have to add a **** ton of trade offers, which is not ideal since there are hundreds of products with a lot of variations. Is there a way we can achieve the above, without having to add hundreds of variations? Also, some of these options have an additional price (+ 10 euro, +15 euro, etc.)

We came up with a solution, but only half of it works:

Right now, we’ve extended/altered the properties/property value models with new fields:

That way, we can add a price to the property values, because some properties are more expensive. This works and when I add a product to the cart, the selected product and property are in the cart. But we haven’t been able to change the order price of the product. So when the visitor wants to order and pay, they only get the original price.

Is it possible -and if so, how- to update the price based on the selected properties?

If not, is there another way to achieve this?

Thanks in advance!

kevin-invato commented 1 year ago

Any ideas about my question?

kharanenka commented 1 year ago

Hello! You can try next solution:

  1. Add custon promo mechanis to increase/decrease price of cart positions with using shopaholic.order.promo_mechanism.cart.add_class event.
  2. Save addition data to order (properties and prices) with using shopaholic.order.update_data event.
  3. Create order promo mechanosm and attach it to order with using shopaholic.order.after_create event
  4. Apply increase/decrease logic for price of order positions with using shopaholic.order.promo_mechanism.order.add_check_callback_method event