VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: dmb on January 12, 2019, 13:03:56 PM

Title: "No shop currency defined" error
Post by: dmb on January 12, 2019, 13:03:56 PM
I've upgraded to VM 3.4.2 in advance of upgrading from J3.8.11 and in testing everything look OK so far, though on successful checkout I see an error

"No Shop Currency defined! Go to https://site_url/administrator/index.php?option=com_virtuemart&view=user&task=editshop


The site currency is defined, as "Currency: British pound" and "List of accepted currencies: British pound"

I've found quite a few ancient posts with this error, but the recommended fix is to ensure that a currency is set, and I've done this without effect.

A bit of digging shows that the error is generated in line 291 of administrator/components/com_virtuemart/models/vendor.php in the function getVendorCurrency ($_vendorId), and that the vendorId parameter is set to 52. This seems wrong: 52 is the value of the GBP currency, and the vendor for the site has ID=1.

Any ideas ?

Thanks,

David

Title: Re: "No shop currency defined" error
Post by: jenkinhill on January 12, 2019, 14:07:54 PM
Is the currency in the Payment Method also set to British Pound?
Title: Re: "No shop currency defined" error
Post by: dmb on January 12, 2019, 14:24:59 PM
Yes, I checked all payment methods, all show British pound.

Cheers,

David
Title: Re: "No shop currency defined" error
Post by: ElTrull on January 13, 2019, 21:28:16 PM
Hi there,

unfortunately i have to report the same Error. You can see it at:
https://teichpiraten.de/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=J2Y3022&pm=5&Itemid=113

I searched the whole day to fix this but no chance. Everything seems to be configured correct. It only appears if users pay via papal and are redirected to the shop.

I also activated the "automatic redirect" from paypal and linked it to a thank you page that a created. But even this redirect to the thank you (https://teichpiraten.de/kaufbestaetigung)page does not work. It still ends up here https://teichpiraten.de/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=J2Y3022&pm=5&Itemid=113 with the currency warning at the top.

BTW: Also this is (even without the warning) a no really professioinal design of a thank you page - in my opinion. So i tried to find the template to modify this. I found /components/com_virtuemart/views/cart/tmpl/oder_done.php but this seems not to be the page where the redirect ends? Where can i modify this page?

I really hope we find a solution soon.

Greetz

Title: Re: "No shop currency defined" error
Post by: GJC Web Design on January 13, 2019, 22:38:19 PM
@ElTrull - is this VM 3.4.2 ??  versions matter

is com_virtuemart/views/cart/tmpl/oderdone.php ... no underscore ... order_done is there for back compat
Title: Re: "No shop currency defined" error
Post by: ElTrull on January 14, 2019, 18:16:29 PM
Hi,

the VM version is 3.4.2, Joomla 3.9.1.

I hope this helps.

Greetz
Title: Re: "No shop currency defined" error
Post by: dmb on January 15, 2019, 09:18:39 AM
Just to note that I agree that it seems linked to Paypal payments.

I've commented out line 291 of administrator/components/com_virtuemart/models/vendor.php for the moment so that the message is not displayed, as I can't actually find any problematic effect - all the data looks OK on the database, and the payments are going through OK. I suspect that some record, somewhere has a blank currency value but it doesn't seem to matter.
Title: Re: "No shop currency defined" error
Post by: GJC Web Design on January 15, 2019, 11:23:24 AM
What about vendor settings?
If u have multi vendor or perhaps a misconfig ( 2 users marked as vendors  .- u should see a warning about this to fix) then the vendor comes into play with the payment methods
Title: Re: "No shop currency defined" error
Post by: ElTrull on January 17, 2019, 20:33:32 PM
Hi there,

i dont have Multivendor. There is 1 Joomla User (Super User), 1 VM Customer (marked as vendor)  :'(

If you want to take a look i can send you the access.

Greetz
Title: Re: "No shop currency defined" error
Post by: matevzp2 on February 25, 2019, 13:11:26 PM
Hello everyone!

I have the same problem,

Warning
No Shop Currency defined! Contact the administrator, if you are one go to http://www.polix.si/administrator/index.php?option=com_virtuemart&view=user&task=editshop

but when i change the currency to euro i can't save changes.. i have joomla 3.9.3 and VM 3.4.2

I have another problem with Synchronize media to VirtueMart.. there shows up an error: An error has occurred.
1267 Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '='


I dont know if errors are connected but i need to solve this problems.
Title: Re: "No shop currency defined" error
Post by: goudmahendra on May 22, 2019, 10:10:44 AM
I am using virtuemart 3.4.2 and joomla 3.9.6. I am also have the same issue.

any solution?

Thanks
Title: Re: "No shop currency defined" error
Post by: GJC Web Design on May 22, 2019, 10:40:05 AM
have you run the VM table updater?
Tried setting the currency manually in the DB as a test?
Title: Re: "No shop currency defined" error
Post by: Gopherit on July 25, 2019, 10:31:50 AM
I have the same problem

Updating VM tables did not help

I don't know how to set currency in the DB - can anyone help me with this - did it help?
Title: Re: "No shop currency defined" error
Post by: GJC Web Design on July 29, 2019, 09:58:48 AM
currency is set per vendor so check #__virtuemart_vendors  -> your vendor  -- assume u only have 1?
vendor_currency & vendor_accepted_currencies
Title: Re: "No shop currency defined" error
Post by: pinochico on August 23, 2019, 04:56:11 AM
I had the same problem until I turned off unused countries for transportation methods in the list of countries in the settings
Title: Re: "No shop currency defined" error
Post by: Twototango on August 30, 2019, 16:20:39 PM
Same problem here...

Updated to  J 3.9.11 and VM 3.6.0 10113

It's definitely not payment specific, I have 6 payment methods active, al have the same error message.
In the database all seems to correct. Also updated the tables with the inbuild tool.

VM 3.6 glitch I presume... going back to 3.4 as I'm experiencing other minor glitshes.
Like the first payment methode being preselected (very annoying in this shop) but that's for another tread  ;)

I think I'll just wait for 3.6.1  8)

Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 01, 2019, 22:35:32 PM
Updated from 3.4.2 to 3.6 (via Manage->Update AND also Installed the 3 zips on a different backup site).

I have the same issue for all installed (enabled or disabled) payment plugins.

It means there are no available payment options on the checkout page.

The above 2 installs were on backup sites, with my live site remaining on 3.4.2.

TIA
Title: Re: "No shop currency defined" error
Post by: Milbo on September 06, 2019, 15:26:49 PM
Maybe this bugfix version helps you http://forum.virtuemart.net/index.php?topic=143386.0

When this does not help, then read this thread http://forum.virtuemart.net/index.php?topic=143386.0
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 06, 2019, 15:35:52 PM
Yes, thanks.

I have been following the other thread.

Milbo> Maybe this bugfix version helps you http://forum.virtuemart.net/index.php?topic=143386.0

That is a link to the other thread not to the bugfix version.
Title: Re: "No shop currency defined" error
Post by: jenkinhill on September 06, 2019, 16:50:49 PM
http://dev.virtuemart.net/attachments/1177/com_virtuemart.3.6.1.10121_package_or_extract.zip
Title: Re: "No shop currency defined" error
Post by: Milbo on September 06, 2019, 20:02:19 PM
ahh wrong copypaste, thank you jenkinhill.
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 08, 2019, 18:47:24 PM
Having updated to latest version, the error message persists.

See screenshots

TIA
Title: Re: "No shop currency defined" error
Post by: jjk on September 08, 2019, 21:26:30 PM
I would try to select from the Joomla menu 'System' > 'Clear Cache' and click the 'Delete All' button and also clear your jchoptimize cache.
Then go to your shop settings: https://docs.virtuemart.net/faqs/92-how-to-change-the-shop-default-currency.html
Next go to your Shop [Edit] view > Vendor tab, make sure your 'Currency' field shows the British pound and save the setting again.
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 08, 2019, 22:48:03 PM
Thanks jjk

However, clearing the system cache includes the jchoptimize cache and was already done.

British Pound is already the store default currency

TIA
Title: Re: "No shop currency defined" error
Post by: jjk on September 09, 2019, 07:38:32 AM
My idea was to 'Save' the shop currency in the shop configuration again. Check your database table xxxxx_virtuemart_vendors, if the British pound (currency id 52) is set as the vendor_currenccy.
Title: Re: "No shop currency defined" error
Post by: GJC Web Design on September 09, 2019, 10:06:42 AM
the string is COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED

this is in 3 different files .. can u do a bit of investigation to find which file / function throws the error

the 3 files are

administrator\components\com_virtuemart\models\vendor.php line 316
administrator\components\com_virtuemart\models\currency.php line 107
administrator\components\com_virtuemart\helpers\currencydisplay.php line 113

just change the   vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED','<a href="'.$link.'">'.$link.'</a>')); to

vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINEDXX','<a href="'.$link.'">'.$link.'</a>'));
so u can identify the function that is reporting this
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 10:55:08 AM
Hello John

Re: "administrator\components\com_virtuemart\models\vendor.php line 316"

The line reads:

vmWarn('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED','<a href="'.$link.'">'.$link.'</a>');

NOT

vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED','<a href="'.$link.'">'.$link.'</a>'));


The other 2 files are as you suggested.

TIA

Ed
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 10:56:54 AM
I can also confirm that the vendor default currency is set correctly.......
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 11:14:38 AM
see screenshot
Title: Re: "No shop currency defined" error
Post by: GJC Web Design on September 09, 2019, 11:27:37 AM
try adding some debug to see if the vendor curr is being found

e.g. line 304

   static function getVendorCurrency ($_vendorId) {
print 'Debug Line '.__LINE__.' $_vendorCurrencies <pre>'; print_r (self::$_vendorCurrencies[$_vendorId]); print "</pre><br />\n";
      if(!isset(self::$_vendorCurrencies[$_vendorId])){
         $db = JFactory::getDBO ();
         if(VmConfig::get('anyInShopCurrency',true)){
            $q = 'SELECT *  FROM `#__virtuemart_currencies` AS c
         LEFT JOIN `#__virtuemart_vendors` AS v ON  c.virtuemart_currency_id = v.vendor_currency
         WHERE v.virtuemart_vendor_id = "' . (int)$_vendorId . '"';
            $db->setQuery ($q);
            self::$_vendorCurrencies[$_vendorId] = $db->loadObject ();
print 'Debug Line '.__LINE__.' $_vendorCurrencies <pre>'; print_r (self::$_vendorCurrencies[$_vendorId]); print "</pre><br />\n";
            if(!self::$_vendorCurrencies[$_vendorId]){
               $link = JURI::root(false).'administrator/index.php?option=com_virtuemart&view=user&task=editshop';
               vmWarn('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINEDXX','<a href="'.$link.'">'.$link.'</a>');
            }
         } else {
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 11:54:19 AM
result of debug
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 19:44:08 PM
So, I did a local install of the latest JM/VM combo and, no problem.

Not sure what that means, but a fresh installation for a Live site is hardly an option.
Title: Re: "No shop currency defined" error
Post by: jjk on September 09, 2019, 19:47:10 PM
Just a guess: It's not visible in your screenshots, but looking at your site it seems that you are using the third party 'PayPal Pro Plugin' which hasn't been updated since 30 April 2018. Do you get the same error if you use the original VirtueMart PayPal plugin?
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 20:01:06 PM
Hello jjk

Thanks but the plugin version is as current as Today. So, wherever you have seen April 2018 is not correct.

Also, the issue does apply to Every payment plugin, 'indigenous' and 3rd party

TIA
Title: Re: "No shop currency defined" error
Post by: jjk on September 09, 2019, 20:45:10 PM
Quote from: EsSa55 on September 09, 2019, 20:01:06 PM
Thanks but the plugin version is as current as Today. So, wherever you have seen April 2018 is not correct.
I did see that here: https://plugins.online-store.co.uk/paypal_payments_pro/changelog.html

And btw - my Firefox Inspector shows a javascript error and a parsing error on your site. Probably not related to your currency problem, but maybe you should look into those, too.
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 09, 2019, 20:51:24 PM
Yes, the changelog is rather out of date.

The current version is actually 1.3.25, dated within the last few days and for VM3.6

Thanks for the advice re the issue
Title: Re: "No shop currency defined" error
Post by: Milbo on September 10, 2019, 09:29:38 AM
What delivers this query?


$q = 'SELECT *  FROM `#__virtuemart_currencies` AS c
LEFT JOIN `#__virtuemart_vendors` AS v ON  c.virtuemart_currency_id = v.vendor_currency
WHERE v.virtuemart_vendor_id = "' . (int)$_vendorId . '"';


you may execute it per phpmyadmin, of course replace the #__ with your prefix.
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 10, 2019, 10:08:46 AM
1 errors were found during analysis.

Ending quote ' was expected. (near "" at position 219)

Position 219?

Anyway, added ' at end:

SELECT * FROM `u84uz_virtuemart_currencies` AS c LEFT JOIN `u84uz_virtuemart_vendors` AS v ON c.virtuemart_currency_id = v.vendor_currency WHERE v.virtuemart_vendor_id = "' . (int)$_vendorId . '"';'

Result:

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0008 seconds.)

Result is the same on any of my other databases where the same tables exist so was desired result achieved?
Title: Re: "No shop currency defined" error
Post by: Milbo on September 11, 2019, 12:45:55 PM
Then you must look in your tables. The query is correct and works. You must of course also replace this part ' . (int)$_vendorId . ' against your vendorId, usually 1.
lets debug the vendorId.

Do not use this nonsense here

print 'Debug Line '.__LINE__.' $_vendorCurrencies <pre>'; print_r (self::$_vendorCurrencies[$_vendorId]); print "</pre><br />\n";


just use instead

vmdebug('my vendor id and currencies',$_vendorId, self::$_vendorCurrencies);


and enable the vmdebug. Maybe your vendorId is zero, or some unexpected number.[/code]
Title: Re: "No shop currency defined" error
Post by: Milbo on September 11, 2019, 12:49:23 PM
or lets try that one


static function getVendorCurrency ($_vendorId) {
if(empty($_vendorId)){
vmTrace('getVendorCurrency vendor Id empty');
$_vendorId = 1;
}
......(rest of function)


So if an empty VendorId is the problem, we see where it is called and the vendorId is set to 1, so it should work (for singlevendor stores).
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 11, 2019, 14:49:00 PM
Sorry, I'm lost now.

I had not changed your original code to include vendorid=1

Kindly let me now have the complete correct code, with vendorid =1

TIA
Title: Re: "No shop currency defined" error
Post by: Milbo on September 12, 2019, 13:29:33 PM
I added it to the new test package
http://dev.virtuemart.net/attachments/1180/com_virtuemart.3.6.1.10137_package_or_extract.zip
Title: Re: "No shop currency defined" error
Post by: EsSa55 on September 15, 2019, 11:44:42 AM
Whether for this reason, or not, updating to:

http://dev.virtuemart.net/attachments/1181/com_virtuemart.3.6.1.10144_package_or_extract.zip

solved the issue for me, for all payment plugins.

Thanks
Title: Re: "No shop currency defined" error
Post by: Milbo on September 16, 2019, 15:05:22 PM
Please tell us the result of the vmTrace. You must enable the debug for that, maybe just for admin.

It works now, because there is a fallback to vendorId=1.
Title: Re: "No shop currency defined" error
Post by: stAn99 on September 18, 2019, 11:50:42 AM
hello, i get the same error:
COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED

i've traced mine down to:

if(empty($this->_cache->virtuemart_vendor_id)){
$this->_cache[$this->_id]->virtuemart_vendor_id = vmAccess::getVendorId('paymentmethod.edit');
}


which incorrectly returns FALSE instead of the single vendor which is being used.

so commenting this seems to fix the problem at
\administrator\components\com_virtuemart\models\paymentmethod.php


further debugging of vmaccess:
- when a 3rd party plugin loads VM at backend too early such as backtrace1 below
- virtuemart incorrect recognizes vmDefines::$_appId=='site' OR it's altered by 3rd party

i suggest to remake acl not to cache statically the state of the application, i.e. to replace all

if(self::$_site === null) {
//all occurances
}


with non-cached version:

$app = JFactory::getApplication();
self::$_site = $app->isSite();


especially in manager function which triggers this.


backtrace:
administrator/components/com_virtuemart/helpers/config.php 85
administrator/components/com_virtuemart/helpers/config.php 468
administrator/components/com_awocoupon/helper/estore/virtuemart/class-awocoupon-helper-estore-virtuemart-currency.php 22
administrator/components/com_awocoupon/awocoupon/library/class-awocoupon-library-helper.php 441
administrator/components/com_awocoupon/helper/awocoupon.php 88
plugins/system/awocoupon/awocoupon.php 32


stan
Title: Re: "No shop currency defined" error
Post by: stAn99 on September 18, 2019, 11:57:31 AM
just noticed another bug over here:

if(empty($this->_cache->virtuemart_vendor_id)){

should be after fixing other above ACL issues:            

if(empty($this->_cache[$this->_id]->virtuemart_vendor_id)){


stan
Title: Re: "No shop currency defined" error
Post by: Milbo on September 18, 2019, 22:34:28 PM
Quote from: stAn99 on September 18, 2019, 11:57:31 AM
just noticed another bug over here:

if(empty($this->_cache->virtuemart_vendor_id)){

should be after fixing other above ACL issues:            

if(empty($this->_cache[$this->_id]->virtuemart_vendor_id)){


stan

Thank you for finding that "typo". It directly solves the other problems