News:

Looking for documentation? Take a look on our wiki

Main Menu

discount inheritance - bug

Started by hazael, August 29, 2023, 10:17:41 AM

Previous topic - Next topic

hazael

If I set a discount (15%) for one product in the cart, this discount is also transferred to the price for products added to the cart in a quantity greater than 1.
If I give a discount for more than 1 products, these discounts are not counted at all

This is a bug - this cart counts everything wrong for me.
The problem is not related to the PHP function, because the result is correct. This is the fault of badly written Javascript from the frontend

This is the only important thing that has never worked well in this component.

hazael

#1
Now I know what causes the bug with these prices. The problem is the Virtuemart - Multi Variant plugin. If this plugin is in the field with the add to cart button, the script does not refresh the prices correctly

I made an example in this video:

https://piekielko.com/images/prices.mp4

6621 zł - this is the wrong price after page load. This is the price for a single product in the cart.
By default, the price for 2 products in the cart should be loaded: 6290 zł

if i press the minus button then the correct price will appear. If the product does not use the "Multi Variant" custom field, this problem does not occur

I want to correct it after page reload. Which javascript is responsible for refreshing these prices in the cart?

hazael

#2
my simple solution - Automatic click on the quantity-minus button - and after the problem  :)

Quote<button aria-label="minus" id="rem" type="button" class="quantity-controls cc btn btn-default">
               <span class="fa fa-minus"></span>
            </button>

Quote<stript>
window.onload = function(){
  document.getElementById('rem').click();
}</script>

Milbo

The discount is per variant. Any variant is an own product. If you want to combine them, you need a more advanced tool https://extensions.virtuemart.net/quantity-related-price-calculation-detail
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hazael

Good to know - I'll check it out.
I also care about the quick export of such prices. Does this plugin work with the RO CSVI component?