Cannot select products for discont or badges

  • Posts: 317
  • Thank you received: 17
  • Hikashop Business
9 years 6 months ago #201971

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1

When in discount or badges menu and want to select single or more product, cannot select. Some product are listed, some not (those have null). Those with null i cant select.



I was trying to find diferences between products, but no luck.

Attachments:

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #201972

Hi,

Thanks for the report.
Would it be possible to have more details about the products you got in the category ?
The goal is to understand why you got "null", what should be really displayed.

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: 317
  • Thank you received: 17
  • Hikashop Business
9 years 6 months ago #201986

This are products like other. With same setings. It should show their titles. What other info you need?
Maybe to send you admin to see?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 6 months ago #201988

Hi,

Yes. Please provide a backend access with a link to this thread via our contact form so that we can have a look at your setup:
www.hikashop.com/support/contact-us.html

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

  • Posts: 317
  • Thank you received: 17
  • Hikashop Business
9 years 6 months ago #202054

Access send. Thank you.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #202104

Hi,

Thanks for the accesses.
We saw that the products displayed by "null" are products with special characters (like "Č").
I tried to reproduce the issue in my local website but the display is fine on my side.
I checked if there were some modifications between the current stable release and the development version and I there is nothing related to the display of the elements.

So I see the source of the error but it is difficult to explain exactly why you have the error.
I see two differences with my local website.
First I can see it that I have a database with a "utf8_bin" collation and you have a database with a "latin1_swedish_ci" collation.
Second, You're using PHP 5.3.29 and I'm using PHP 5.4.12

It looks like that PHP 5.4 is better with UTF8 in strings when encoding to JSON.
( stackoverflow.com/questions/8143163/php-...null-instead-of-text )

So the best might be to detect if the product name have some special characters and is not in UTF8 ; in order to convert it into UTF8.
( stackoverflow.com/questions/4407854/how-...r-encode-on-a-string )

So in the file "administrator/components/com_hikashop/classes/product.php" please replace

		if(!empty($displayFormat) && !empty($displayFormat_tags)) {
			if($p->product_quantity == -1)
				$p->product_quantity = JText::_('UNLIMITED');
			$p->product_name = htmlentities($p->product_name);
			$o->name = $displayFormat;

			foreach($displayFormat_tags[1] as $key) {
				$o->name = str_replace('{'.$key.'}', $p->$key, $o->name);
			}
		}
		if(empty($o->name)) {
			$o->name = htmlentities($p->product_name);
			if(empty($o->name))
				$o->name = '['.$p->product_id.']';
		}
Into
		if(!preg_match('!!u', $p->product_name))
			$product_name = htmlentities(utf8_encode($p->product_name));
		else
			$product_name = htmlentities($p->product_name);

		if(!empty($displayFormat) && !empty($displayFormat_tags)) {
			if($p->product_quantity == -1)
				$p->product_quantity = JText::_('UNLIMITED');
			$p->product_name = $product_name;
			$o->name = $displayFormat;

			foreach($displayFormat_tags[1] as $key) {
				$o->name = str_replace('{'.$key.'}', $p->$key, $o->name);
			}
		}
		if(empty($o->name)) {
			$o->name = $product_name;
			if(empty($o->name))
				$o->name = '['.$p->product_id.']';
		}

And I hope it will fix your issue by converting the text into a correct encoding.

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.
Last edit: 9 years 6 months ago by Jerome. Reason: fix

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

  • Posts: 317
  • Thank you received: 17
  • Hikashop Business
9 years 6 months ago #202132

Solved with PHP 5.4.

On main domain, we have old joomla and using PHP 5.3. Now i changed php and Hikashop display of products is ok.

Thank you

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #202145

Hi,

Good to know that your problem is solved and thank you for sharing.
I hope that it will help other users with the same kind of issue.

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.

Time to create page: 0.070 seconds
Powered by Kunena Forum