- Posts: 7
- Thank you received: 1
Undefined variable $optionValue in view.raw.php
- Christoph
- Topic Author
- Offline
- New Member
-
Less
More
1 month 18 hours ago - 1 month 18 hours ago #174818
by Christoph
Undefined variable $optionValue in view.raw.php was created by Christoph
Hello,
May be I noticed a small bug in EShop 4.0.3?
In the file components/com_eshop/views/product/view.raw.php inside the display() method of EShopViewProduct, the variable $optionValue is assigned at the end:
$this->option_value = $optionValue;
However, $optionValue is only defined inside the foreach ($options as $productOptionId => $optionValue) loop.
If no product options are set, the loop never runs, and $optionValue is undefined.
This causes the following warning:Warning: Undefined variable $optionValue in .../components/com_eshop/views/product/view.raw.php on line 290
Fix: Initialize the variable before the loop, just like the other option variables:
$optionSku = '';
$optionQuantity = '';
$optionWeight = 0;
$optionPrice = 0;
$optionValue = null; // <--- add this line
This resolves the warning and keeps $this->option_value consistent.
Or have I overlooked something?
Best regards,
Christoph
May be I noticed a small bug in EShop 4.0.3?
In the file components/com_eshop/views/product/view.raw.php inside the display() method of EShopViewProduct, the variable $optionValue is assigned at the end:
$this->option_value = $optionValue;
However, $optionValue is only defined inside the foreach ($options as $productOptionId => $optionValue) loop.
If no product options are set, the loop never runs, and $optionValue is undefined.
This causes the following warning:Warning: Undefined variable $optionValue in .../components/com_eshop/views/product/view.raw.php on line 290
Fix: Initialize the variable before the loop, just like the other option variables:
$optionSku = '';
$optionQuantity = '';
$optionWeight = 0;
$optionPrice = 0;
$optionValue = null; // <--- add this line
This resolves the warning and keeps $this->option_value consistent.
Or have I overlooked something?
Best regards,
Christoph
Last edit: 1 month 18 hours ago by Christoph.
Please Log in or Create an account to join the conversation.
- Giang Dinh Truong
-
- Offline
- Administrator
-
2 weeks 4 days ago #175037
by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Undefined variable $optionValue in view.raw.php
Hello Christoph,
Yes, this is a good fix. I just updated this into the code. It will be included in the next version of EShop.
Sincerely, Giang
Yes, this is a good fix. I just updated this into the code. It will be included in the next version of EShop.
Sincerely, Giang
Please Log in or Create an account to join the conversation.
Moderators: Giang Dinh Truong
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.