Custom Field Display Problem in Invoice

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #244390

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.4.45

We have a custom field display limited to "both eye - different problem"
it did work well by not display all the while at checkout process and front end order as well as backend order detail page

however, when we click on invoice, this field come out from nowhere and have a value do not know come from where and same problem occur for field limited to "same power"

please see screen shot below






We did a check on order_product if there is any value in database, but we are sure it is empty and fine as expected


and this is the setting of the problem field which should not display in invoice



the main point of this problem is the left eye field should have no reason to display in invoice

Attachments:
Last edit: 8 years 4 months ago by ler@singmuiheng.com.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 4 months ago #244470

Hi,

From what I can see in the code of the invoice, the custom fields display if there is a value in them:
take.ms/lj6gC
And there should only be a value when displayed on the product page.

And your screenshots are not consistent, so we're not sure that the field is not empty.
In your custom field settings screenshot, you're displaying the field "left2", but that column is not in your screenshot of your phpmyadmin.

What strange though is that in that case, you should get the same result on the order details page.
So I've checked the code there too, and the only change I could see is that it uses the line:
if(empty($product->$namekey) || !strlen($product->$namekey)){
instead of the line:
if(empty($product->$namekey) && !strlen($product->$namekey)){
So try changing that in your invoice view file and see if that helps.

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #244511

Thanks for your kind help nicolas

We did follow your suggestion to modify the invoice view however, it is still the same

attached the database screen shot, this is quite obvious the left2 is empty, we also quite suprise how did the script find the value and enable it to be display

where can we check if there is anything wrong in getfield function as we print_r the $itemFields, the value is already taken in
"$itemFields = $this->fieldsClass->getFields($item_type,$product,'item')"

P/S : this happen only when we update to 2.6.3, before that all are normal

Attachments:
Last edit: 8 years 4 months ago by ler@singmuiheng.com.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 4 months ago #244517

Hi,

The fact that the field is in $itemFields is normal since that field can be potentially displayed based on what the customer selects.
However, if the data is empty in the database for the field, then $product->left2 should be empty. And that's what the system bases itself on to display or not the value. So check on that variable as I'm not able to reproduce the problem on our end.

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #244982

Dear Nicolas

We are very sure that $product-left2 is empty as per screenshoot provided earlier

Any else place we can check on it?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 4 months ago #245004

Hi,

if the data is empty in the database for the field, then $product->left2 should be empty

We are very sure that $product-left2 is empty


I'm afraid that I can't understand your question.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #245064

Please see this screen shot, we are sure that database is empty, if not the order detail part would not show correctly, however, during invoice detail it display the empty field with a default value, all these problem arise when using the "display limited to" function




May we know what is the "view" file name for the order detail that display correctly? we would like to compare this two view as the problem lies at $itemFields = $this->fieldsClass->getFields($item_type,$product,'item');

Attachments:
Last edit: 8 years 4 months ago by ler@singmuiheng.com.

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #245495

it has been one week since last post.... and no counter measure was found yet......

We are very sure that the database value is empty for the printed error field

Kindly help to advise the location of getFields function so that we can help to have a check on this if your side can not reproduce this problem

or we can pass u a akeeba copy of this site??

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #246149

any update for this problem?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 4 months ago #246190

Hi,

We are still not able to understand your message and we already gave you some elements but your screenshots from your database do not give any proof which could help.

Now you can read that post which talk about a similar subject :
www.hikashop.com/forum/3-bug-report/8855...?limitstart=0#245874

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #246194

the bug is clearly shown as per earlier screen shot

i had also tried what is mentioned in the related post given
1. rebuild category
2. modify the line of code

and it make the scenario worst

please see below screen shot, after rebuild category, more unexpected field is shown in invoice



i have send a link download the full akeeba backup of the site from contact form, can nicolas help to check on it (since nicolas have better understanding on this kind of bug)? or it is prefer to pass you the joomla access ?

Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 4 months ago #246223

Hi,

Please understand that if there is no value in the database, the field won't be display in the invoice.
You must have these "0.50 / -0.50" values in your database to display them. HikaShop can't create them from nothing.
We don't know what are your screenshots and if the order is recent or not. If his data is already corrupted you need to fix them once and for all ; and specially made new orders to be sure that the storage in the database is now working fine.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 567
  • Thank you received: 11
  • Hikashop Business
8 years 4 months ago #246257

Dear jerome

we have pass you the full website in contact form, please have a FULL check on it

as per mentioned and in screenshot
www.hikashop.com/media/kunena/attachment...ration_-_Order_3.png

1. in order detail - all the custom field display correctly
2. in invoice view - the custom field come out from nowhere (this is already a bug when order detail do not match invoice detail)
3. we check thru the database
www.hikashop.com/media/kunena/attachment...MyAdmin_4_4_15_4.png
and sure the come out from no where field is empty

and as per mention as well

we have initially only one "come out from no where" field

1. after apply "rebuild category" as per suggest in another thread
more "come out from no where field" appear

i believe you can understand from now?

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
8 years 4 months ago #246308

Hello,

I get it ! This case was totally new for us !
Thanks for provide your website that allow us to get a bug, and add a fix !

In order to correct it, follow these steps :
- Get your file field.php, here in ...\administrator\components\com_hikashop\classes
find this arround line 440 :

case 'item':
				$order_id = (int)@$data->order_id;
				if($order_id > 0){
					$orderClass = hikashop_get('class.order');
					$order = $orderClass->get($order_id);
					$user_id = (int)@$order->order_user_id;
				} else {
					$user_id = 0;
				}
				break;
And this $id = 'product_id'; just before break; to get this :
case 'item':
				$order_id = (int)@$data->order_id;
				if($order_id > 0){
					$orderClass = hikashop_get('class.order');
					$order = $orderClass->get($order_id);
					$user_id = (int)@$order->order_user_id;
				} else {
					$user_id = 0;
				}
				$id = 'product_id';
				break;

And in ...\administrator\components\com_hikashop\views\order\tmpl, get invoice.php and find this around line 200 :
if(!empty($itemFields)) {
												foreach($itemFields as $field){
													$namekey = $field->field_namekey;
														if(empty($product->$namekey) && !strlen($product->$namekey)){
														continue;
													}

And replace if(empty($product->$namekey) && !strlen($product->$namekey)){
by this if(empty($product->$namekey) && (!isset($product->$namekey) || !strlen($product->$namekey))){
to get this :
if(!empty($itemFields)) {
												foreach($itemFields as $field){
													$namekey = $field->field_namekey;
														if(empty($product->$namekey) && (!isset($product->$namekey) || !strlen($product->$namekey))){
														continue;
													}

That must solve your issue, but I awaiting news from you.

Note : that this fix is now added to our Version from now.

Regards

Last edit: 8 years 4 months ago by Philip.
The following user(s) said Thank You: ler@singmuiheng.com, haur0214

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

Time to create page: 0.114 seconds
Powered by Kunena Forum