Error PHP 8 ?

  • Posts: 18
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
1 year 9 months ago #349352

-- HikaShop version -- : 4.7.1
-- Joomla version -- : 4.2.8
-- PHP version -- : 8.0
-- Error-message(debug-mod must be tuned on) -- : ATTEMPT TO ASSIGN PROPERTY
"SYNCHED_CART_QUANTITY" ON NULL

Hello,
when switching from PHP 7.4.x to 8.0 i get the error as shown in the screenshot.
I am using the "Storefront - eCommerce Joomla! template" storefront.demo.gavick.com/

When i switch back to PHP 7.4. and activate show php errors, i get:

Notice: Undefined property: ProductViewProduct::$row in .../components/com_hikashop/views/product/tmpl/show_quantity.php on line 60

Notice: Trying to get property 'product_id' of non-object in .../com_hikashop/views/product/tmpl/show_quantity.php on line 60

Warning: Creating default object from empty value in .../com_hikashop/views/product/tmpl/show_quantity.php on line 61

Best regards
Maurizio de Matteis

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
1 year 9 months ago #349355

Hello,

Can you process theses tests :
- Try php8 with a default template (Cassiopeia for J4)
=> No error ?, then there are good chance that your issue come from template (no php8 support?)
- Can you precise your test context, when you "switch back to PHP 7.4" in order to allow us to better understand in which context these errors appear, we need you to precise :
- Confirm that you Joomla debug is activated AND in the maximum level (or dev level)
=> Note that in production phase you have to switch off the debug (or at least use a lower level) because prevent notice error is almost impossible to prevent in many cases.
- Detail the step by step to reproduce your issue

Awaiting your returns to progress
Regards

Last edit: 1 year 9 months ago by Philip.

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
1 year 9 months ago #349370

Hallo Philip,
it seems to be a problem with the Storefront template. With Cassiopeia all works well.
II will ask for support.
Thank you and regards
Maurizio

The following user(s) said Thank You: Philip

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
1 year 9 months ago #349430

Hallo Philip,
This workaround helped.I posted it to the guys of gavick and they said, this is Hikashop Core Code.
Can you give me advice.
best regards
Maurizio


Hello,
I commented out code in /components/com_hikashop/views/product/tmpl/show_quantity.php at line 59
Everything works fine as far as i can see.
Shop is not yet in productive mode.
Regards

$extra_classes = '';
from here:
if($this->config->get('synchronized_add_to_cart', 0)) {
$cartClass = hikashop_get('class.cart');
$cartProductData = $cartClass->getCartProductData($this->row->product_id);
$this->row->synched_cart_quantity = (int)@$cartProductData->cart_product_quantity;
if($quantityLayout == 'show_default')
$quantityLayout = 'show_default_div';
if($this->row->synched_cart_quantity)
$current_quantity = $this->row->synched_cart_quantity;
if($min_quantity == 1)
$min_quantity = 0;
$cartClass->syncInit();
if(in_array($quantityLayout, array('show_select','show_select_price')))
$extra_classes = 'no-chzn';
to here

?>
<input id="<?php echo $id; ?>_synch" class="synchronized_add_to_cart" data-id="<?php echo $id; ?>" data-product-id="<?php echo $this->row->product_id; ?>" data-cart-product-id="<?php echo @$cartProductData->cart_product_id; ?>" type="hidden" name="synched_cart_quantity" value="<?php echo $this->row->synched_cart_quantity; ?>"/>
<?php
}

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 9 months ago #349433

Hi,

Change the line:

if($this->config->get('synchronized_add_to_cart', 0)) {
to:
if($this->config->get('synchronized_add_to_cart', 0) && isset($this->row)) {
in the file components/com_hikashop/views/product/tmpl/show_quantity.php and that should fix the problem.
Let us know the result on your end so that we can add the modification on our end too for others.

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
1 year 9 months ago #349516

Hello Nicolas,
works well!

Thanks and with best regards
Maurizio

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum