jdanthinne / advancedfeaturesvalues

Prestashop module to enable multiple values selection for features, and features values ordering.
GNU General Public License v2.0
38 stars 20 forks source link

Product page truncates features #5

Closed piel17 closed 9 years ago

piel17 commented 9 years ago

Hello, I have installed your module and it works almost perfectly. I met success for growing up the features values length but product page truncate the "$feature.value" string and I don't understand why. (~350 characters) Can you help mee with this ? PS: I'm using Prestashop 1.6.1.0

jdanthinne commented 9 years ago

Hi! Where exactly is the truncated string? Screenshot welcome.

piel17 commented 9 years ago

front front-code back-features-values

This is the front product page. I tried to replace the SEPARATOR value in the db query in Product.php but that didn't change anything except the features text is truncating somewhere else. The third image show you that my features values are correctly save.

jdanthinne commented 9 years ago

I've just checked, and nothing in my code is truncating the results… Are you using a custom theme (which one?) that could truncate the results?

kpawel commented 9 years ago

piel17, you found solution?

kpawel commented 9 years ago

@jdanthinne I found reason why values are truncate.

But i need your help.

You used in module function group_concat and this function have lenght limit in default 1024. With utf-8 formatting it's about 350 chars.

For fix this we need use this: set session group_concat_max_len = 4096

But i don't know where place this in product class. I tried in few places but without success, every time some errors.

PS. I don't have acces to server conf file to change it permamently.

jdanthinne commented 9 years ago

Where is this _groupconcat function in my module? I can't find it.

kpawel commented 9 years ago

override\classes\product.php

Line 51 SELECT name, GROUP_CONCAT(value ORDER BY fv.position SEPARATOR ", ") AS value, pf.id_feature

jdanthinne commented 9 years ago

You're right, I was searching in PHP code instead of MySQL :-). I've juste created a branch https://github.com/jdanthinne/advancedfeaturesvalues/tree/issue%235 with a fix that set a bigger length. Can you try that please and tell if it's ok?

kpawel commented 9 years ago

empty

Empty field where before was table.

jdanthinne commented 9 years ago

Is it on a live server, or a testing server? Perhaps some servers are limiting the use of SET SESSION… In this case, I need to completely rewrite the SQL query to manually concatenate all the values.

kpawel commented 9 years ago

On live server. I wrote also to hosting support for change global limit but i don't know if they will do it.

jdanthinne commented 9 years ago

I've just made a change and set the max length in a separate query. Can you try that? https://github.com/jdanthinne/advancedfeaturesvalues/commit/0d3f7e6ae9af382ddd1720b9c6413a4c8bc80ecd

kpawel commented 9 years ago

Now it works perfectly! Good Job :)

Thank you very much :)

jdanthinne commented 9 years ago

Good! Merged changes to the master branch.