News:

Looking for documentation? Take a look on our wiki

Main Menu

Use manually added basePrice and salesPrice and plugins too

Started by sandomatyas, October 16, 2018, 10:01:28 AM

Previous topic - Next topic

sandomatyas

There is a site where the site owner wants to set basePrice and salesPrice manually for every single product. He can't use a calculation rule, because there is no exact formula (even with custom calculation plugin) to calculate the salesPrice based on the basePrice, because this depends on several things (suppliers, stock limit, seasonal sales, they own will etc) and also they like prices with .99 or .49 cent ending, etc.
Like there are 3 products, the basePrice is €10.99 and he needs €8.99 as salesPrice for the first product, €6.99 for the second and €6.49 for the second one, because why not :)
Also the shop uses daily discount for different products for every day, so there is a date-related price, too.
Because this situation can't be easily handled with any calculation rules they use override price for every product.
It works well until you need to use something more, like assign discount for a shopper group or add a price variant custom field. VM handles the custom fee but the override price overrides this, so the the fee is handled as discount. Like the basePrice is €10 and the salesPrice is €8, I get €2 discount. If I add something for €1 via a customfield, the product price in the cart is still €8 but the discount is €3.
I know - of course - override prices is for overriding prices, but could you suggest any solution which we could use in this situation?

AH

1. Stop using override
2. Calculate the base price from the required sales price in a spreadsheet (or something similar)
3. Import the base prices into the system
4. Use whatever discount rules you like (but note that this will result in those non "nice" sales prices"

Regards
A

Joomla 4.4.5
php 8.1

sandomatyas

Quote from: AH on October 16, 2018, 10:43:39 AM
1. Stop using override
2. Calculate the base price from the required sales price in a spreadsheet (or something similar)
3. Import the base prices into the system
4. Use whatever discount rules you like (but note that this will result in those non "nice" sales prices"

baseprices should based on another logic so they need to be also added manually

AH

Dont bother adding manually in VM

Create a base pricing spreadsheet and the export price data for products

Then adjust as required using whatever logic you decide - even set the price in the sheet manually

Then use a tool to import prices

Of course you need the export and import capabilities - but a search in the forums will show that.

Then maybe you do not need logic other than discounts for products/shoppergroups/categories etc
Regards
A

Joomla 4.4.5
php 8.1

sandomatyas

I modified the getProductPrices method in calculationHelper class and added a new plugin method trigger where I can override the prices which the core method calculated.
Not a perferct method and I need to re-add after every VM update, but this is a special case, there are a lot of custom modifications.
As far as I can see it works well