lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Exception throwed after add new currency and language

Open scramatte opened this issue 2 years ago • 5 comments

  • GetCandy version: 2.0 beta
  • Laravel Version: 8.75
  • PHP Version: 8.0.10
  • Database Driver & Version: Percona Server 5.7 (Mysql)

Expected Behaviour:

Browse the frontend normally

Actual Behaviour:

image

Steps To Reproduce:

Create a currency and set it as default

scramatte avatar Feb 25 '22 14:02 scramatte

Hi @scramatte, most likely this exception occurs because you have not created the product variant price for the new currency you have added.

nicolalazzaro avatar Mar 04 '22 13:03 nicolalazzaro

This is certainly something we need to handle. What the best approach is I'm not sure. I will discuss this tomorrow with the team.

glennjacobs avatar Mar 10 '22 21:03 glennjacobs

Having discussed this with @alecritson the only sensible approach here is to create the new prices based upon the currency conversion/exchange rate.

A single SQL query can insert over 50k prices in under 5 seconds in our tests, so should be fine. However, we would look to do this via the job queue.

Before a currency can be enabled, it will need all the prices set up. We'll do a simple database check and if the prices are not set up, we will not allow the currency to be enabled. A suitable validation message will be required.

glennjacobs avatar Mar 11 '22 12:03 glennjacobs

Hi @glennjacobs! This could be an option. Usually when we add new currencies to the system we do so long before the new shop becomes operational for a number of reasons of content organisation and other business arrangements, so another option to add the new currency to the system even without setting a price would be useful. For this reason, in the back-office the unset amount exception for the newly added currency could be handled differently by allowing it to be browsed and set later while it should remain active for the customer side.

nicolalazzaro avatar Mar 11 '22 12:03 nicolalazzaro

@nicolalazzaro Yeah, I thought about that approach. I guess we could make it optional for the system to generate the prices. If they're not generated, then they all need to be manually added before the currency can be enabled.

glennjacobs avatar Mar 11 '22 12:03 glennjacobs