Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Thanks for the great module! For the most part it works great, except it will sometimes add two zeros to price table when I edit a product. So a price of $45.00 will randomly change to $4500.00. I can go in and edit a product to change the price back to $45.00, but it will not always stick. This is not an issue with checkout or cart, as this happens before a product is even added to a cart. Possibly related to the stock module?
Comments
Comment #1
Bestpoint CreditAttribution: Bestpoint commentedSubscribe! Iv got the same problem.
I also installed the stockmodule..
Comment #2
pompetardo CreditAttribution: pompetardo commentedI have the same problem, but it multiplies x1000. I think its 10^{# of decimals of the currency}. And happens with the products selected in an order after placing it. Weird shit. I also have the stock module but I don't remember it happened before last update (june 17th).
Comment #3
pompetardo CreditAttribution: pompetardo commentedAparently this problem is because commerce_price_table_field_presave() which is thought for correcting the value when you save it, is also executed when you place an order. Probably is called when the stock is updated but I'm not sure.
When you place an order "Convert the price amount to an integer based on the currency."* is no longer needed. In fact if you see it doesn't make any sense because "commerce_currency_decimal_to_amount()" converts decimal to amount and the input choosen is an amount so it get multiplied by 10^{# of decimals of the currency}.
So the solution maybe is to put a conditional to avoid it but I don't have a clue how to detect if it has been an order placed. Or somehow avoid calling commerce_price_table_field_presave() when placing an order.
I commented the part of the code that is making the problem but it generates another: if you try to save a product through the gui interface it will save all table prices as 0. But in my case I can live with it because I add and modify all my product programatically so in fact this is not a solution, just a workaround that works for me.
In commerce_price_table.module:
Comment #4
pcambraPlease use the -dev version #1322714: Odd Pricing Table Issue
I should add a new release, I'll do it asap.
Comment #5
cehfisher CreditAttribution: cehfisher commentedThanks for the follow-up. I'll try installing the dev version and report back.