Author Topic: Use manually added basePrice and salesPrice and plugins too  (Read 209 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 232
Use manually added basePrice and salesPrice and plugins too
« on: October 16, 2018, 10:01:28 am »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2811
  • VirtueMart Version: 3.4
Re: Use manually added basePrice and salesPrice and plugins too
« Reply #1 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"

regards
A

Joomla 3.8.13
php 7.1

sandomatyas

  • Jr. Member
  • **
  • Posts: 232
Re: Use manually added basePrice and salesPrice and plugins too
« Reply #2 on: October 16, 2018, 10:48:36 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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2811
  • VirtueMart Version: 3.4
Re: Use manually added basePrice and salesPrice and plugins too
« Reply #3 on: October 16, 2018, 16:27:18 pm »
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 3.8.13
php 7.1

sandomatyas

  • Jr. Member
  • **
  • Posts: 232
Re: Use manually added basePrice and salesPrice and plugins too
« Reply #4 on: October 17, 2018, 16:44:06 pm »
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