News:

Support the VirtueMart project and become a member

Main Menu

Joomla 4 is stable with Virtuemart 4 ?

Started by tuaneric, October 28, 2022, 16:05:46 PM

Previous topic - Next topic

tuaneric

#15
Hello
It's the same template version but index.php page it shows error, if I activate PHP 8.  >:(

Call stack
# Function Location
1 () JROOT/templates/hera_j3_vm3/html/com_virtuemart/sublayouts/badges.php:9
2 include() JROOT/components/com_virtuemart/helpers/shopfunctionsf.php:567
3 shopFunctionsF::renderVmSubLayout() JROOT/templates/hera_j3_vm3/html/com_virtuemart/sublayouts/products.php:150
4 include() JROOT/components/com_virtuemart/helpers/vmview.php:129
5 VmView->renderVmSubLayout() JROOT/templates/hera_j3_vm3/html/com_virtuemart/virtuemart/default.php:42
6 include() JROOT/libraries/src/MVC/View/HtmlView.php:701
7 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/components/com_virtuemart/helpers/vmview.php:81
8 VmView->display() JROOT/components/com_virtuemart/views/virtuemart/view.html.php:210
9 VirtueMartViewVirtueMart->display() JROOT/components/com_virtuemart/controllers/virtuemart.php:48
10 VirtueMartControllerVirtuemart->display() JROOT/libraries/src/MVC/Controller/BaseController.php:702
11 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_virtuemart/virtuemart.php:128
12 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
13 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
14 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
15 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
16 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:225
17 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49


I tried to install the Hera version 3.12 which I bought from year 2019 but the same problem on PHP 8.0. If I will enable PHP 7.4 it works fine  ;) ;) ;)

Is it possible to share your template so that I can try on my hosting ?

Thank you
Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11

GJC Web Design

what is the error?

It clearly states it is on line 9 of /templates/hera_j3_vm3/html/com_virtuemart/sublayouts/badges.php

Just fix that error...
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

I just checked - I had removed sublayouts/badges.php, the client had requested some layout changes, so there were other edits as well. There are plenty of PHP warnings, but they are suppressed.
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

tuaneric

#18
Hi

File: templates/hera_j3_vm3/html/com_virtuemart/sublayouts/badges.php
Ligne 9: $ndate = strtotime ('now') - ($days * 86400); ?>

<?php defined('_JEXEC') or die('Restricted access');
$product $viewData['product'];
// Horme 3.5.0
$app JFactory::getApplication('site');
$template $app->getTemplate(true);
// Badge new
$days VmConfig::get('latest_products_days');
$cdate strtotime ($product->created_on) ;
$ndate strtotime ('now') - ($days 86400); ?>


  <div class="badges text-left clearfix">
  <?php if ($template->params->get('badges')) { ?>
    <?php if ($cdate $ndate): // Show Badge New ?>
      <span class="label label-success"><?php echo JText::_('TPL_VM_NEW'?></span>
    <?php endif; ?>

    <?php if ($product->product_special): // Show Badge Featured ?>
      <span class="label label-primary"><?php echo JText::_('TPL_VM_FEATURED'?></span>
    <?php endif; ?>

    <?php if ($product->prices['discountAmount'] != -&& !$template->params->get('percentage')): // Show Badge on Sale ?>
      <span class="label label-danger"><?php echo JText::_('TPL_VM_ONSALE'?></span>
    <?php endif; ?>
  <?php ?>
  </div>


When I deleted the badges.php file, the index.php page works.

I tried on the categories page, it shows error

Call stack
# Function Location
1 () JROOT/templates/hera_j3_vm3/html/com_content/category/default_articles.php:15
2 include() JROOT/libraries/src/MVC/View/HtmlView.php:701
3 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/layouts/joomla/content/category_default.php:79
4 include() JROOT/libraries/src/Layout/FileLayout.php:125
5 Joomla\CMS\Layout\FileLayout->render() JROOT/libraries/src/Layout/LayoutHelper.php:73
6 Joomla\CMS\Layout\LayoutHelper::render() JROOT/templates/hera_j3_vm3/html/com_content/category/default.php:20
7 include() JROOT/libraries/src/MVC/View/HtmlView.php:701
8 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:230
9 Joomla\CMS\MVC\View\HtmlView->display() JROOT/libraries/src/MVC/View/CategoryView.php:245
10 Joomla\CMS\MVC\View\CategoryView->display() JROOT/components/com_content/views/category/view.html.php:250
11 ContentViewCategory->display() JROOT/libraries/src/MVC/Controller/BaseController.php:664
12 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/components/com_content/controller.php:118
13 ContentController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:702
14 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_content/content.php:43
15 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
16 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
17 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
18 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
19 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:225
20 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49



File: /templates/hera_j3_vm3/html/com_content/category/default_articles.php
Ligne 15 :
$params = &$this->item->params;

<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT '/helpers/html');

// Create some shortcuts.
$params = &$this->item->params;
$n count($this->items);
$listOrder $this->escape($this->state->get('list.ordering'));
$listDirn $this->escape($this->state->get('list.direction'));

// Check for at least one editable article
$isEditable false;

if (!empty(
$this->items))
{
foreach ($this->items as $article)
{
if ($article->params->get('access-edit'))
{
$isEditable true;
break;
}
}
}
?>


I attach 2 files

Thank you

Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11

GJC Web Design

you show the call trace but not the errors!

we need BOTH to give u any advice...

as a guess for

File: /templates/hera_j3_vm3/html/com_content/category/default_articles.php
Ligne 15 :
Code: [Select]
$params      = &$this->item->params;

remove the &

$params      = $this->item->params;
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

tuaneric

Quote from: GJC Web Design on December 29, 2022, 18:43:38 PM
you show the call trace but not the errors!

we need BOTH to give u any advice...

as a guess for

File: /templates/hera_j3_vm3/html/com_content/category/default_articles.php
Ligne 15 :
Code: [Select]
$params      = &$this->item->params;

remove the &

$params      = $this->item->params;

Hi GJC Web Design

I deleted & on line 15 that it works.

For the badges.php page, I have to force delete it for my index.php page for it to work.

Can we modify badges.php to be compatible with PHP8 ?

Thank you
Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11

GJC Web Design

QuoteCan we modify badges.php to be compatible with PHP8 ?

you still don't say what the error is.....
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

tuaneric

#22
Quote from: GJC Web Design on December 29, 2022, 18:57:11 PM
QuoteCan we modify badges.php to be compatible with PHP8 ?

you still don't say what the error is.....

I have already detailed the problem

Hello
It's the same template version but index.php page it shows error, if I activate PHP 8.  >:(

Call stack
# Function Location
1 () JROOT/templates/hera_j3_vm3/html/com_virtuemart/sublayouts/badges.php:9
2 include() JROOT/components/com_virtuemart/helpers/shopfunctionsf.php:567
3 shopFunctionsF::renderVmSubLayout() JROOT/templates/hera_j3_vm3/html/com_virtuemart/sublayouts/products.php:150
4 include() JROOT/components/com_virtuemart/helpers/vmview.php:129
5 VmView->renderVmSubLayout() JROOT/templates/hera_j3_vm3/html/com_virtuemart/virtuemart/default.php:42
6 include() JROOT/libraries/src/MVC/View/HtmlView.php:701
7 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/components/com_virtuemart/helpers/vmview.php:81
8 VmView->display() JROOT/components/com_virtuemart/views/virtuemart/view.html.php:210
9 VirtueMartViewVirtueMart->display() JROOT/components/com_virtuemart/controllers/virtuemart.php:48
10 VirtueMartControllerVirtuemart->display() JROOT/libraries/src/MVC/Controller/BaseController.php:702
11 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_virtuemart/virtuemart.php:128
12 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
13 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
14 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
15 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
16 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:225
17 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49


File: templates/hera_j3_vm3/html/com_virtuemart/sublayouts/badges.php

<?php defined('_JEXEC') or die('Restricted access');
$product $viewData['product'];
// Horme 3.5.0
$app JFactory::getApplication('site');
$template $app->getTemplate(true);
// Badge new
$days VmConfig::get('latest_products_days');
$cdate strtotime ($product->created_on) ;
$ndate strtotime ('now') - ($days 86400); ?>


  <div class="badges text-left clearfix">
  <?php if ($template->params->get('badges')) { ?>
    <?php if ($cdate $ndate): // Show Badge New ?>
      <span class="label label-success"><?php echo JText::_('TPL_VM_NEW'?></span>
    <?php endif; ?>

    <?php if ($product->product_special): // Show Badge Featured ?>
      <span class="label label-primary"><?php echo JText::_('TPL_VM_FEATURED'?></span>
    <?php endif; ?>

    <?php if ($product->prices['discountAmount'] != -&& !$template->params->get('percentage')): // Show Badge on Sale ?>
      <span class="label label-danger"><?php echo JText::_('TPL_VM_ONSALE'?></span>
    <?php endif; ?>
  <?php ?>
  </div>


Ligne 9:

$ndate = strtotime ('now') - ($days * 86400); ?>


Thank
Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11

GJC Web Design

QuoteI have already detailed the problem

No u haven't!!!!

You have pasted the call stack and the code but not the ERROR!
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

tuaneric

Hi GJC Web Design

you told me, not error but the index.php page it shows line 9 on the badges.php page.

  it's this line: $ndate = strtotime('now') - ($days * 86400); ?>

The full page code

<?php defined('_JEXEC') or die('Restricted access');
$product $viewData['product'];
// Horme 3.5.0
$app JFactory::getApplication('site');
$template $app->getTemplate(true);
// Badge new
$days VmConfig::get('latest_products_days');
$cdate strtotime ($product->created_on) ;
$ndate strtotime ('now') - ($days 86400); ?>


  <div class="badges text-left clearfix">
  <?php if ($template->params->get('badges')) { ?>
    <?php if ($cdate $ndate): // Show Badge New ?>
      <span class="label label-success"><?php echo JText::_('TPL_VM_NEW'?></span>
    <?php endif; ?>

    <?php if ($product->product_special): // Show Badge Featured ?>
      <span class="label label-primary"><?php echo JText::_('TPL_VM_FEATURED'?></span>
    <?php endif; ?>

    <?php if ($product->prices['discountAmount'] != -&& !$template->params->get('percentage')): // Show Badge on Sale ?>
      <span class="label label-danger"><?php echo JText::_('TPL_VM_ONSALE'?></span>
    <?php endif; ?>
  <?php ?>
  </div>


Is it possible to modify the badges.php page so that it will be compatible with php 8 ?
Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11

Jörgen

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

GJC Web Design

my absolute LAST try --

QuoteIs it possible to modify the badges.php page so that it will be compatible with php 8 ?

Of course  - if you tell us what the ERROR is!

Not the code.
Not the call trace..

But the ERROR.....

I assume php8 doesn't like the values given in the calc...

does $days exist? 
Have u set the VmConfig::get('latest_products_days'); in the admin?

is $days an integer ?  if not use something like  $ndate = strtotime ('now') - ((int)$days * 86400);

if $days is empty then use

$days = VmConfig::get('latest_products_days');
if(empty($days)) { $days = 1;}





GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

tuaneric

Hi

QuoteHave u set the VmConfig::get('latest_products_days'); in the admin?

How to enable VmConfig in admin ?

I don't know how to code PHP, is it possible to give me the code to add to the badges.php page ?

Thank you
Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11

GJC Web Design

have already suggested code

// Badge new
$days = VmConfig::get('latest_products_days');
if(empty($days)) { $days = 1;}
$cdate = strtotime ($product->created_on) ;
$ndate = strtotime ('now') - ((int)$days * 86400); ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

tuaneric

#29
Hi GJC Web Design
I added your code on the badges.php page, the index.php page displays correctly.

For option: Last Products - Number of days to display: 7. I can't find it in Virtuemart version 4.0.12, Normally it is in menu Configuration -> FRONT STORE - List of products

  Which virtuemart version are you using ?

I put the photo (the photo in French, I can't change to English).

Thank you
Joomla 3.10.11 & Virtuemart 4.2.4.10922 - PHP 8.2 , Template Hera version 3.11