Jump to content

Combination pricing displayed wrong when added a specific price for parent product


Smijn2

Recommended Posts

Hello,

 

I am using PS 1.6.1.4. Since I have upgraded to this version, something goes wrong whit the combination pricing display in FO after adding a specific price to the 'parent' product.

 

Example:

 

Product A costs € 5,- and has 3 combinations:

Combination 1 has the default price, so no influence set, so the price will be € 5,-

Combination 2 has an influence of € 1,-, so the price will be € 6,-

Combination 3 has an influence of € 2,-, so the price will be € 7,-

 

These prices are shown correctly in the FO, no problems there.

 

Then I have added a specific price to the parent product A of - € 0,50

In FO the product pricing should be:

Combination 1: € 4,50

Combination 2: € 5,50

Combination 3: € 6,50

 

But in this case PS suddenly shows the pricing for combination 1 for all combinations:

Combination 1: € 4,50

Combination 2: € 4,50

Combination 3: € 4,50

 

If for example combination 3 is added to the cart, the correct (higher) price is displayed in the cart.

So for the customers it feels like they're being fooled into buying something more expensive. 

 

Does anyone know how to solve this issue, without me having to change the influences per combination when having a product for sale (i do have a lot of combinations in my shop)?

 

Thanks in advance for your help!

 

Kind regards

Link to comment
Share on other sites

  • 2 weeks later...

Thank you very much, I need to do some more testing, just to be sure, but at first sight it looks like it works like a charm :)

 

 

I have changed this part in /classes/product.php from this:

        // convert only if the specific price is in the default currency (id_currency = 0)
        if (!$specific_price || !($specific_price['price'] >= 0 && $specific_price['id_currency'])) {
            $price = Tools::convertPrice($price, $id_currency);
            if (isset($specific_price['price'])) {
                $specific_price['price'] = $price;
            }
        }

to this:

        // convert only if the specific price is in the default currency (id_currency = 0)
        if (!$specific_price || !($specific_price['price'] >= 0 && $specific_price['id_currency'])) {
            $price = Tools::convertPrice($price, $id_currency);
            if (isset($specific_price['price']) && $specific_price['price'] >= 0) { 
                $specific_price['price'] = $price;
            }
        }

(found this on the github url's that erouvier mentioned)

Link to comment
Share on other sites

  • 9 months later...

Hi,

 

I'm reopening this theme because I have a similar bug but after modify the product.php code it doesn't work....

 

I've switched to default theme and it still happens so it seems to be a prestashop bug.

 

The shop is using prestashop 1.6.0.9

 

In my case the bug happens when I assign a specific price that will apply to all combinations from a same product. At that moment the customer is unable to see stock quantity or specific prices when switching between the different combinations of a product...

 

If I delete the specific price to all combinations, then the customer is able to see different stock or prices when switching different combinations...

 

Reading similar issues they mention a possible bug of productcontroller.php or product.js however I still haven't found a solution... :(

Link to comment
Share on other sites

I have found the fix!

 

http://forge.prestashop.com/browse/PSCSX-8036

 

In summary.. at mytheme/js/product.js there is a line which looks like this:

	// If a specific price redefine the combination base price
	if (combination.specific_price && combination.specific_price.price > 0)
		basePriceWithoutTax = combination.specific_price.price;

So I've replaced the avobe code by this one:

	// If a specific price redefine the combination base price
	if (combination.specific_price && combination.specific_price.price > 0)
		{ basePriceWithoutTax = +combination.specific_price.price; basePriceWithTax = +combination.specific_price.price * (taxRate/100 + 1); } 

Now the issue is fixed... so when the user selects between the different combinations of the product, the prices and the stock quantities are updated and shown on real time...

 

On the first attempt I have an error message indicating that It was not possible to add the product to the cart, so I have cleaned cache and now it seems to work :)

 

I will do some test but I think it is definetly solved...

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...
On 24/2/2017 at 18:15, Antakarana said:

¡He encontrado la solución!

 

http://forge.prestashop.com/browse/PSCSX-8036

 

En resumen ... en mytheme / js / product.js hay una línea que se ve así:


	
	  

Así que he reemplazado el código avobe por este:


	
	  
		       

Ahora el problema está solucionado ... así que cuando el usuario selecciona entre las diferentes combinaciones del producto, los precios y las cantidades de stock se actualizan y se muestran en tiempo real ...

 

En el primer intento, tengo un mensaje de error que indica que no fue posible agregar el producto al carrito, así que limpié el caché y ahora parece funcionar :)

 

Haré algunas pruebas, pero creo que está definitivamente resuelto ...

hola, tengo la versión 1.7.6 y no logor encontrar dicho archivo. cual es la ruta especifica

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...