Total : 24.00 €

Before contacting us, please make sure to check our F.A.Q

Please, login or register to our website in order to be able to post a presale question in the forum.

× WooPrice Calculator PRO

# [SOLVED]Currency symbol in output field, currency conversion

1 year 1 week ago #2085 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field, currency conversion
Dear Bill,

This looks golden, looking forward to test it. Many thanks for the input!

1 year 1 week ago #2084 by bill
bill replied the topic: Currency symbol in output field, currency conversion
Hello Kristijan,

in order to change the price after any changes by the user you should implement the hook provided in this documentation section :
altoswebsolutions.com/manual/woo-price-c...tor/change-the-price .
Specifically it will be something like :

function custom_awspc_filter_calculate_price_ajax_response(\$response, \$params){
\$response[/'price'] = \$params[/'price']." included taxes";
return \$response;
}

in '\$params' you can access almost everything from the formatted and the raw price also each individual field value at that point.

altoswebsolutions.com/manual/woo-price-c...tor/change-the-price
WooPrice Calculator allows you to manipulate the final price of WPC PRO by using our custom function.

Kind Regards,
Bill
AT1018

1 year 1 week ago - 1 year 1 week ago #2080 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field, currency conversion
Hello,

Would ask for a little help in regards this topic, I am still trying to find the best solution to have everything output as I imagined it:

- I discovered that conversion of the price via plugin like booster currency switcher works with wooprice calculator if we write the formula (not mapped from spreadsheet) in a way that we multiply the equation with \$price in the end. If regular price is set to 1 for an example, currency switcher alters this price (1 / 7.4 = 0.13513), so any output calculated via calculator is converted correctly. This is almost automatic and it works everywhere on the site, so I would like to persue this if possible.

Now, my question is, how to achieve this also for the calculators created via spreadsheet? I am trying to use Your API to modify price, but as soon as I try to multiply the \$price with anything else then the number, it calculates the correct price on the page load, but on field change it hangs, and returns error 500 (spinner spins forever). I tried fetching the raw regular price via \$product->get_price() and wc_price(), and if I echo it from function it shows the correct output, but as soon as I try to multiply this output like \$price * \$product->get_price(), it hangs. Any help maybe?

EDIT: OK, found a solution, please confirm if thats ok approach.

\$baseprice = \$params('product');
if (currency === EUR)
\$price = \$price * (\$baseprice('price'));
return \$price;

This way if currency is switched, currency switcher converts the base price of the product (in this case 1 to 0.13), and using code above, if currency is switched we multiply the calculated output with base price and get correct amount.

Also, one more thing while at it, how could one fetch also the output field mapped to show ex-VAT price, to try and convert this one along in the currency switch as well?
Last Edit: 1 year 1 week ago by Kristijan Cikor.

1 year 1 month ago #2035 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field, currency conversion
Dear Paul,

Yes, great timing! Looking forward to testing it, will get back to You guys when I sort and test everyting out. This plugin is on it's way to become a must addition to woocommerce!

1 year 1 month ago #2034 by Paul
Paul replied the topic: Currency symbol in output field, currency conversion
Hello

okay!
Take a look here: altoswebsolutions.com/manual/woo-price-c...spreadsheet-file-pro In particular the Tax Rate configuration at point 3.

Best Regards
Paul
AT1018

1 year 1 month ago - 1 year 1 month ago #2033 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field, currency conversion
Dear Paul, in my quest to try and solve this myself I have successfully torn my site in pieces, so I have to stitch it back up before I could grant You an access. A little disclaimer, Your 2.3.4 beta actually works with no issues, errors I was facing were strictly due to the local development site in xampp, which I learned a bit later than I would like to admit. Due to the last wordpress release, it's changes and my issues in trying to get currency switcher and wpc to work together, there was I lot issues I could not relate to any of those in particular, so I ended up going backwards until I undid months of work. So, now I am setting up a virtual host to be able to have a local site copy with working wpc, as I can't get anything above 2.2.0 to work in xampp localhost. I will send You FTP access as soon I am back up and running, I already thought about paid support and contacting You about it, as it's not an issue by any means, but I was trying to get better understanding of the inner functioning so I could maintain the whole thing myself later on. Only thing I would ask You, if possible, as it bugs me - would You be kind to write a word or two on how is tax rate output in beta intended to be configured in excel sheet? I tried with a multiplier and with the calculated price with tax cell, but none of those wants to be mapped, so I guess is something else I did not think of. I would like to test this before, so I could "draw" myself and to You how I would like to have things sorted...
Last Edit: 1 year 1 month ago by Kristijan Cikor.

1 year 1 month ago #2031 by Paul
Paul replied the topic: Currency symbol in output field, currency conversion
Hello

We understand, actually I think we can solve your issues. But It would be necessary to have access of your website (a test website would be better) and an FTP access. We will fix your issue and if you want we will explain to you how we did it.
You can send your access here

We will be waiting for your feedback.

Best Regards
Paul
AT1018

1 year 1 month ago - 1 year 1 month ago #2023 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field, currency conversion

EDIT (next day): Of course, I was unable to find any part of plugin documentation or thread with a sample of how could I get use of the jQuery to help me with two specific issues I am facing, and that I will now repeat for better readability and by doing so to maybe provide some help to people in similar quest:

1. Currency coverter module (in my case Booster switcher) is providing a dropdown to pick a currency, In my case I only need two, otherwise I would probably quit trying as it's too much trouble. The issue here is that wooprice calculator (which is a great plugin by almost all means) uses formula to construct and modify price of the simple type products. This formula remains the same as You switch currency, so in this case You do not get currency converted, You just get the currency symbol with a same amount, which is of course not good. So we need to try and modify prices outputed by wooprice calculator in a way they would only be modified or converted by formula triggered when currency is switched. Only way I found is by using provided wooprice calculator API to change price, which is simple and it works, but with some issues that it converts the price, but from some reason also the line subtotal in a cart, which is already converted by currency switcher (so it get's converted twice) and that's no good. So, the only way I found till now to solve this is b digging trough wooprice calc files, and I found a line in CartHelper file (line 57) that constructs the subtotal in the cart, and we can now maybe wrap this in some conditional and multiply it back by the same factor currency switcher does, so we could end up with all the same amounts in product price and proiduct line subtotal we can then convert manually with a price change API to match all the other prices in the shop. I tested this and it works, not finished so I will edit with definitive confirmation unless authors chime in with a smarter solution.

EDIT (later on): I can now confirm this works as intended, at least for now. There probably is a cleaner and smarter solution, but this works, so anyone who faces the similar issue can try. It would be nice to have some pointer on how to deal with this properly, as much as I can see, does not seem to be a great issue to deal with, as price change API can indeed be used on trigger of currency switcher module to do it's thing, and within the same function we can convert the price by the multiplier or divider to match needed pricing. Currency symbol is changed by switcher, at least in the main price outputed by the calculator. Of course, for now this remains an issue with second price output field if used for exVAT / VAT price, as I still have to find a way on how to catch that one.

2. Did not have the time to try and solve this, but wooprice calc needs a solution to have exVAT and VAT prce shown in the product listing, with a possibility to have different currency symbols in case of currency switching. Now it's a no go, there is a possibility to set another output field to play as a exVAT or VAT price, but there is no way to switch the currency symbol in a output field as it gets mapped from formatted excel cell. Probably would be possible in PHP if we would have a way to fetch this field from functions.php file and preg_replace the symbol. Beta version of the calculator can be downloaded which has this option to calculate the tax rate, but I treid three separate installs yesterday with no results as it's throwing a lot of errors. Will update on this as I go as well...
Last Edit: 1 year 1 month ago by Kristijan Cikor.

1 year 1 month ago #2020 by isuf
isuf replied the topic: Currency symbol in output field, currency conversion
Hello Kristijan,

Yes, it is possible by using jQuery. Here you can find documentation on how to use it:
altoswebsolutions.com/manual/woo-price-c...ator/jquery-triggers

You can write to our support team if you need more information.
altoswebsolutions.com/contact-us

Best regards
Isuf
AT1018

1 year 1 month ago - 1 year 1 month ago #2019 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field
As I am trying different solutions while waiting for some input, I found out that the issue with currency switcher can be solved by using Your price change API, but I would really need some help from You guys. Of course, price outputed by the calculator is same when currency switcher does it's thing as it's calculated in the same way, but in the cart there is a product price unaffected, and product line subtotal that is actually affected (product price -> qty -> product line subtotal).
This is stopping me from using a manual conversion for product calculator based prices with Your price change API, \$price = price / X, as it's affecting both the price in cart and it's line subtotal. Is there any way one could either copy product price in cart and multiply it with qty to get and substitute the correct line subtotal (so to be able to convert it both via price change API), or maybe to fetch only the product price in cart and affect it with price change API, but not also the product line subtotal?
Last Edit: 1 year 1 month ago by Kristijan Cikor.

1 year 1 month ago - 1 year 1 month ago #2012 by Kristijan Cikor
Kristijan Cikor replied the topic: Currency symbol in output field
Another one I just found, I need to have a multi currency solution, and as I could not find any good solutions on the forum, I tried using classic currency switcher where I can detect currency switch and I was going to use this with Your price change formula - it works on page load -> if user selected currency = EUR, \$price = \$price / x, but it stops working as soon there is a form change / dynamic price change based on the input. Any way I could check for the selected currency dropdown status on any calculator field change?

Upper one solved, I managed to detect the drop down currency switch and do a calculation if currency is set to X. However, now this happens also on add to cart, and price gets calculated again. Now fighting with that.

EDIT: managed to get the price in minicart right with if_ajax(), but now the cart totals are also affected by the price calculation. Seems that formula for price change is somehow being applied also on the totals if it's in a if statement. Any conditional rules one could use with price change formula so it would affect only the product price on load and on form change?

And hopfully the last one -> is there any way to move output field (in this case +VAT price) below the price? Maybe to echo it from the template if possible? Calculator theme allows to move it above the price, or in the bottom of the form, but I would need it bellow the price...
Last Edit: 1 year 1 month ago by Kristijan Cikor. Reason: Additional question(s)

1 year 1 month ago - 1 year 1 month ago #2005 by Kristijan Cikor
Kristijan Cikor created the topic: Currency symbol in output field, currency conversion
Hello, is there a way to output two prices (exVAT, VAT price) on a product listing, but with a dynamic currency symbol change? I have been using Excel format solution to get local currency shown in an output field that is being used as an second price field, but if we change shop default currency setting (as it will be shown when site is visited from abroad), the currency symbol stays the same for this output field. I have tried to use "get_woocommerce_currency_symbol" in a calculator template after the 'outputResults', but it gets loaded only on first site load, deleted after Ajax price refresh (any field change or price recalculation).
So, Is there maybe a solution on how to do this, or maybw there a way we can "echo" this output field raw value within a function maybe, while it would still refresh with a main price output?