fresh install returns Call to a member function getPrefix() on null

Started by dandamnimze, May 19, 2023, 13:22:56 PM

Previous topic - Next topic

dandamnimze

Hi peepz, first of all: when creating a login on this forum, the activation link that is sent doesn't work, seems like an encoding issue in the hyperlink (links to https://forum.virtuemart.net/index.php?action=activate%3Bu%3Dxxxx%3Bcode%3Dxxxxxxxx, and not the correct https://forum.virtuemart.net/index.php?action=activate;u=xxxx;code=xxxxxxxx).

The reason I created the account was that I am trying to install virtuemart on a new server. After joomla is installed I click the link **Install VirtueMart with sample data**. This returns:
QuoteCall to a member function getPrefix() on null
    /public_html/administrator/components/com_virtuemart/install/script.virtuemart.php:98

Call stack
#    Function    Location
1    ()    JROOT/administrator/components/com_virtuemart/install/script.virtuemart.php:98
2    com_virtuemartInstallerScript->checkIfUpdate()    JROOT/administrator/components/com_virtuemart/install/script.virtuemart.php:161
3    com_virtuemartInstallerScript->install()    JROOT/administrator/components/com_virtuemart/controllers/updatesmigration.php:495
4    VirtuemartControllerUpdatesMigration->installComplete()    JROOT/administrator/components/com_virtuemart/controllers/updatesmigration.php:486
5    VirtuemartControllerUpdatesMigration->installCompleteSamples()    JROOT/libraries/src/MVC/Controller/BaseController.php:702
6    Joomla\CMS\MVC\Controller\BaseController->execute()    JROOT/administrator/components/com_virtuemart/virtuemart.php:77
7    require_once()    JROOT/libraries/src/Component/ComponentHelper.php:402
8    Joomla\CMS\Component\ComponentHelper::executeComponent()    JROOT/libraries/src/Component/ComponentHelper.php:377
9    Joomla\CMS\Component\ComponentHelper::renderComponent()    JROOT/libraries/src/Application/AdministratorApplication.php:101
10    Joomla\CMS\Application\AdministratorApplication->dispatch()    JROOT/libraries/src/Application/AdministratorApplication.php:159
11    Joomla\CMS\Application\AdministratorApplication->doExecute()    JROOT/libraries/src/Application/CMSApplication.php:225
12    Joomla\CMS\Application\CMSApplication->execute()    JROOT/administrator/index.php:51

How to solve?

jenkinhill

Which Joomla and Vituemart versions are you trying to install?  A package?
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

dandamnimze

hi, I downloaded and installed the VirtueMart4.0.20_Joomla_3.10.11_stable_full_package

jenkinhill

I believe there is an issue with script.virtuemart.php in that package which prevents a new installation of VM4.0.20 although it works as an update package. I would uninstall your current Joomla & install an earlier package version. Then wait for up update for 4.0.20 - I have 4.0.21 which still shows the same issue.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Antidote

Quote from: dandamnimze on May 19, 2023, 13:22:56 PM
Hi peepz, first of all: when creating a login on this forum, the activation link that is sent doesn't work, seems like an encoding issue in the hyperlink (links to https://forum.virtuemart.net/index.php?action=activate%3Bu%3Dxxxx%3Bcode%3Dxxxxxxxx, and not the correct https://forum.virtuemart.net/index.php?action=activate;u=xxxx;code=xxxxxxxx).

The reason I created the account was that I am trying to install virtuemart on a new server. After joomla is installed I click the link **Install VirtueMart with sample data**. This returns:
QuoteCall to a member function getPrefix() on null
    /public_html/administrator/components/com_virtuemart/install/script.virtuemart.php:98

Call stack
#    Function    Location
1    ()    JROOT/administrator/components/com_virtuemart/install/script.virtuemart.php:98
2    com_virtuemartInstallerScript->checkIfUpdate()    JROOT/administrator/components/com_virtuemart/install/script.virtuemart.php:161
3    com_virtuemartInstallerScript->install()    JROOT/administrator/components/com_virtuemart/controllers/updatesmigration.php:495
4    VirtuemartControllerUpdatesMigration->installComplete()    JROOT/administrator/components/com_virtuemart/controllers/updatesmigration.php:486
5    VirtuemartControllerUpdatesMigration->installCompleteSamples()    JROOT/libraries/src/MVC/Controller/BaseController.php:702
6    Joomla\CMS\MVC\Controller\BaseController->execute()    JROOT/administrator/components/com_virtuemart/virtuemart.php:77
7    require_once()    JROOT/libraries/src/Component/ComponentHelper.php:402
8    Joomla\CMS\Component\ComponentHelper::executeComponent()    JROOT/libraries/src/Component/ComponentHelper.php:377
9    Joomla\CMS\Component\ComponentHelper::renderComponent()    JROOT/libraries/src/Application/AdministratorApplication.php:101
10    Joomla\CMS\Application\AdministratorApplication->dispatch()    JROOT/libraries/src/Application/AdministratorApplication.php:159
11    Joomla\CMS\Application\AdministratorApplication->doExecute()    JROOT/libraries/src/Application/CMSApplication.php:225
12    Joomla\CMS\Application\CMSApplication->execute()    JROOT/administrator/index.php:51

How to solve?
I had the same issue in version 4.0.22.10864 when I ran the script "Install or if necessary update tables". Solved this issue by adding the line $this->_db = JFactory::getDBO(); before the line $q = 'SHOW TABLES LIKE "'.$this->_db->getPrefix().'virtuemart_adminmenuentries"'; //=>jos_virtuemart_shipment_plg_weight_countries to the file "administrator\components\com_virtuemart\install\script.virtuemart.php ". This line was in the previous version 4.0.12.10777.

UPD: I think that the developer removed  $this->_db = JFactory::getDBO(); in the current version as it is deprecated in PHP8.2. I found on another site that for Joomla 4.0+ this line can be replaced with  $this->_db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');

Margriet

public function checkIfUpdate(){
$this->_db = \Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');

I am still on PHP 7.4 because I am updating from Joomla 3 which is on the same server. But adding this line solved the issue for me as well. Thx!

melix

Without having a membership number :

here : administrator/components/com_virtuemart/install/
==> REPLACE the 'script.virtuemart.php' (from the 4.0.20) with the 'scrip.virtuemart.php' (from the 4.0.14)

I don't know if it's sustainable. Let us know if it works for you ?

Virtuemart is sick.

Margriet

Would be great if this would be fixed in next release. Updated to 4.0.22 and still not fixed, so after update I had to fix it again.