- Posts: 18
- Thank you received: 2
Error PHP 8 ?
- maurizio.dematteis@gmail.com
-
Topic Author
- Offline
Less
More
3 years 7 months ago #349352
by maurizio.dematteis@gmail.com
Error PHP 8 ? was created by maurizio.dematteis@gmail.com
-- 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
-- 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
Please Log in or Create an account to join the conversation.
3 years 7 months ago - 3 years 7 months ago #349355
by Philip
Replied by Philip on topic Error PHP 8 ?
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
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: 3 years 7 months ago by Philip.
Please Log in or Create an account to join the conversation.
- maurizio.dematteis@gmail.com
-
Topic Author
- Offline
Less
More
- Posts: 18
- Thank you received: 2
3 years 7 months ago #349370
by maurizio.dematteis@gmail.com
Replied by maurizio.dematteis@gmail.com on topic Error PHP 8 ?
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
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.
- maurizio.dematteis@gmail.com
-
Topic Author
- Offline
Less
More
- Posts: 18
- Thank you received: 2
3 years 7 months ago #349430
by maurizio.dematteis@gmail.com
Replied by maurizio.dematteis@gmail.com on topic Error PHP 8 ?
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
}
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.
3 years 7 months ago #349433
by nicolas
Replied by nicolas on topic Error PHP 8 ?
Hi,
Change the line:
to:
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.
Change the line:
Code:
if($this->config->get('synchronized_add_to_cart', 0)) {
Code:
if($this->config->get('synchronized_add_to_cart', 0) && isset($this->row)) {
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.
- maurizio.dematteis@gmail.com
-
Topic Author
- Offline
Less
More
- Posts: 18
- Thank you received: 2
3 years 7 months ago #349516
by maurizio.dematteis@gmail.com
Replied by maurizio.dematteis@gmail.com on topic Error PHP 8 ?
Hello Nicolas,
works well!
Thanks and with best regards
Maurizio
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.207 seconds