Warning: htmlspecialchars() expects parameter1 to

  • Posts: 5
  • Thank you received: 0
12 years 11 months ago #39841

Hi,

I had a problem when trying to set (for to value) to checkbox so that my product corresponds to the selected check box, and when i go to the registration form and select the product in the shopping cart the product doesn't appears (the other options appears in the cart that are not selected)

Here is screen shot of my problem, please review it and give me quick response.
Regards,

Attachments:

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

  • Posts: 83103
  • Thank you received: 13415
  • MODERATOR
12 years 11 months ago #39881

Hi,

Please change the line:
$html = $class->display($field,htmlspecialchars($value, ENT_COMPAT,'UTF-8'),$map,$inside,$options,$test);

to:
if(is_string($value)) $value = htmlspecialchars($value, ENT_COMPAT,'UTF-8');
$html = $class->display($field,$value,$map,$inside,$options,$test);

in the file administrator/components/com_hikashop/classes/field.php

That will remove the warning.

Regarding the fact that the product gets added to the cart when the checkbox is not ticked, looking at your screenshot, that's normal. It's just that you didn't tick the checkbox in the "For the value". After doing so and saving, it should work like you expect.

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

  • Posts: 5
  • Thank you received: 0
12 years 11 months ago #39902

Hi Nikolas,

I copy and replace the code that have give in the massage but now when I ticked the checkbox and click save after saving the checkbox (for the value box) is still unchecked and when I go and fill the registration form and select the products the shopping card is empty ?

Please help me with this because is urgent!

Thanks,
Irena

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

  • Posts: 83103
  • Thank you received: 13415
  • MODERATOR
12 years 11 months ago #39915

Hi,

We were able to reproduce the problem on our end.

Please change the code:

$value = explode(',',$value);
return parent::display($field,$value,$map,'checkbox',$inside,$options,$test);
to:
if(!is_array($value)){
			$value = explode(',',$value);
		}
		return parent::display($field,$value,$map,'checkbox',$inside,$options,$test);
in the file administrator/components/com_hikashop/classes/field.php
and the code:
}elseif($value == $field->field_options['product_value']){
to:
}elseif(is_string($value) && in_array($value,$field->field_options['product_value'])){
								$ok = true;
							}elseif($value == $field->field_options['product_value']){
in the file administrator/components/com_hikashop/classes/cart.php and that should fix the problem.

The following user(s) said Thank You: len4e

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

  • Posts: 5
  • Thank you received: 0
12 years 10 months ago #40541

Hi HikaShopers,

I want to ask Is it possible to unable ticking the check box field when the product is on quantity 0 in the stock, I have a form when user chooses products which are listed as check boxes and I want to unable (make it not clickable unavailable or more gray or something like that, want to stay on site but not to be clickable) the check boxes related to the products which quantity is 0 in the stock.

I hope that you understand what I'm trying to do and If you have any suggestions please write me.

Thanks a lot.
Best regards,
Irena

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

Time to create page: 0.066 seconds
Powered by Kunena Forum