News:

Support the VirtueMart project and become a member

Main Menu

Update 4.2.4 to 4.2.12 error 0 editing shop

Started by RobertG, Yesterday at 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";
}