News:

Looking for documentation? Take a look on our wiki

Main Menu

Update 4.2.4 to 4.2.12 error 0 editing shop

Started by RobertG, June 25, 2024, 09:59:54 AM

Previous topic - Next topic

RobertG

Hi,

I tried to update a 4.2.4 version of VM to 4.2.12 (Joomla! 4.4.5, PHP 8.1): the frontent seems to work fine, but in the administration, when I click to edit the shop, I get an error 0:
Quotecount(): Argument #1 ($value) must be of type Countable|array, null given
The file is
QuoteJROOT/administrator/components/com_virtuemart/views/user/view.html.php:135
So I think the $userFieldsBT value is null on the previous line:
$virtuemart_userinfo_id_BT = $model->getBTuserinfo_id($userId);
$userFieldsArray = $model->getUserInfoInUserFields($layoutName,'BT',$virtuemart_userinfo_id_BT, false, false, $userId);
$userFieldsBT = $userFieldsArray[$virtuemart_userinfo_id_BT];�

I tried on another website (same versions) and got the same error.
How could I resolve that error?
Thanks for your help!

Jumbo!

Here is the solution.

Open - administrator/components/com_virtuemart/views/user/view.html.php

Find the following codes between lines 134 to 145:

// Load the required scripts
if (count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHtml::script($_script, $_path);
}
}
// Load the required stylesheets
if (count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
vmJsApi::css($_link, $_path);
}
}

Replace the above by:

// Load the required scripts
if (isset($userFieldsBT['scripts']) && count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHtml::script($_script, $_path);
}
}
// Load the required stylesheets
if (isset($userFieldsBT['links']) && count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
vmJsApi::css($_link, $_path);
}
}


Now, open - administrator/components/com_virtuemart/views/user/tmpl/edit_shopper.php

Find the following codes between lines 110 to 114:

if (count($this->userFieldsBT['functions']) > 0) {
echo '<script language="javascript">'."\n";
echo join("\n", $this->userFieldsBT['functions']);
echo '</script>'."\n";
}

Replace the above by:

if (isset($this->userFieldsBT['functions']) && count($this->userFieldsBT['functions']) > 0) {
echo '<script language="javascript">'."\n";
echo join("\n", $this->userFieldsBT['functions']);
echo '</script>'."\n";
}


Lastly, open - administrator/components/com_virtuemart/views/user/tmpl/edit_shipto.php

Find the following codes between lines 34 to 38:

if (count($this->shipToFields['functions']) > 0) {
echo '<script language="javascript">'."\n";
echo join("\n", $this->shipToFields['functions']);
echo '</script>'."\n";
}

Replace the above by:

if (isset($this->shipToFields['functions']) && count($this->shipToFields['functions']) > 0) {
echo '<script language="javascript">'."\n";
echo join("\n", $this->shipToFields['functions']);
echo '</script>'."\n";
}

Zegenrijk

Hello Jumbo,

Tryed this solution, but still the error when opening a customer in VM

VirtueMart 4.2.12 11014, Joomla 5.1.1, PHP 8.1

How to solve?

Regards Michel

Jumbo!

#3
Quote from: Zegenrijk on July 04, 2024, 09:57:24 AMHello Jumbo,

Tryed this solution, but still the error when opening a customer in VM

VirtueMart 4.2.12 11014, Joomla 5.1.1, PHP 8.1

How to solve?

Regards Michel

Those additional errors must be generated in the "vmadmin" template. Therefore, also make the following changes along with the changes I posted earlier.

Open - administrator/templates/vmadmin/html/com_virtuemart/user/edit_shopper.php

Find the following codes between lines 102 to 106:

if (count($this->userFieldsBT['functions']) > 0) {
echo '<script language="javascript">' . "\n";
echo join("\n", $this->userFieldsBT['functions']);
echo '</script>' . "\n";
}

Replace the above by:

if (!empty($this->userFieldsBT['functions'])) {
echo '<script language="javascript">' . "\n";
echo join("\n", $this->userFieldsBT['functions']);
echo '</script>' . "\n";
}

Lastly, open - administrator/templates/vmadmin/html/com_virtuemart/user/edit_shipto.php

Find the following codes between lines 39 to 43:

if (count($this->shipToFields['functions']) > 0) {
echo '<script language="javascript">' . "\n";
echo join("\n", $this->shipToFields['functions']);
echo '</script>' . "\n";
}

Replace the above by:

if (!empty($this->shipToFields['functions'])) {
echo '<script language="javascript">' . "\n";
echo join("\n", $this->shipToFields['functions']);
echo '</script>' . "\n";
}

Zegenrijk

Thanx, solved!

Are these changes also in the next release?

Regards Michel

Margriet

This is crazy! Why should one change core files in a clean install?

Jumbo!

Quote from: Margriet on July 16, 2024, 08:17:17 AMThis is crazy! Why should one change core files in a clean install?

We do not expect to encounter these bugs in a stable release. Unfortunately, there are some bugs that need to be fixed. Max, the lead developer of VirtueMart, is on summer holiday. As a result, I have shared a solution so that the shops can continue running until the next update is available.

sohopros

#7
We see an update in the Extensions:Update screen on our dev site, which is currently running 4.2.6, to updated to v.4.2.16. Are the fixes in there?

But looking more closely, the file path seems to indicate it is 4.2.12. Now I'm confused, maybe it's the same 4.2.12 update.

sohopros

Hi Jumbo!,
We made the first 3 modifications you suggested and it fixed our reported problem related to viewing individual Shopper records (https://forum.virtuemart.net/index.php?topic=152040.msg543096#msg543096).

But you subsequently posted two more recommended changes to @Zegenrijk. Do you recommend we also make the two additional mods?

Jumbo!

Quote from: sohopros on July 26, 2024, 23:18:16 PMHi Jumbo!,
We made the first 3 modifications you suggested and it fixed our reported problem related to viewing individual Shopper records (https://forum.virtuemart.net/index.php?topic=152040.msg543096#msg543096).

But you subsequently posted two more recommended changes to @Zegenrijk. Do you recommend we also make the two additional mods?

Yes, if you use the new admin template.

Milbo

Quote from: Jumbo! on June 25, 2024, 19:38:05 PMHere is the solution.

Open - administrator/components/com_virtuemart/views/user/view.html.php

Find the following codes between lines 134 to 145:

// Load the required scripts
if (count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHtml::script($_script, $_path);
}
}
// Load the required stylesheets
if (count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
vmJsApi::css($_link, $_path);
}
}

Replace the above by:

// Load the required scripts
if (isset($userFieldsBT['scripts']) && count($userFieldsBT['scripts']) > 0) {
foreach ($userFieldsBT['scripts'] as $_script => $_path) {
JHtml::script($_script, $_path);
}
}
// Load the required stylesheets
if (isset($userFieldsBT['links']) && count($userFieldsBT['links']) > 0) {
foreach ($userFieldsBT['links'] as $_link => $_path) {
vmJsApi::css($_link, $_path);
}
}



no, just remove all of that, 
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

Quote from: Margriet on July 16, 2024, 08:17:17 AMThis is crazy! Why should one change core files in a clean install?

that was fixed in my local core one day later afte report and of course fixed in vm4.2.14, which was released a week after the release of vm4.2.12. So the whole thing is fixed a month before you guys started this thread.

So members had this problem just a week and most members did not notice it, actually.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

Quote from: Jumbo! on July 17, 2024, 16:59:39 PM
Quote from: Margriet on July 16, 2024, 08:17:17 AMThis is crazy! Why should one change core files in a clean install?

We do not expect to encounter these bugs in a stable release. Unfortunately, there are some bugs that need to be fixed. Max, the lead developer of VirtueMart, is on summer holiday. As a result, I have shared a solution so that the shops can continue running until the next update is available.

No, I was not in holidays at that time and it was fixed within one week. But the fix is in the membership update. There will be soon a release with the new template for members and then I can set the 4.2.16 for free. But of course, there are also bugs.

Even NASA software has bugs, guys.

We had an hard time the last two years, Update to j4, to php 8.x then php8.2, then j5, BS5 and so on. We should have peacefull times for the next 5 years, no updates in sight.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

seabass

Hi
I have this error - how can i access 4.2.14? Is the fix only available to members?