Casper_O 37 Posted January 20, 2015 Posted January 20, 2015 I found the solution for the above. I updated override/classes/Product.php so it now also override cacheFrontFeatures: public static function cacheFrontFeatures($product_ids, $id_lang) { if (!Feature::isFeatureActive()) return; $product_implode = array(); foreach ($product_ids as $id_product) if ((int)$id_product && !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures)) $product_implode[] = (int)$id_product; if (!count($product_implode)) return; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT id_product, name, GROUP_CONCAT(value SEPARATOR \', \') AS value, pf.id_feature FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature) '.Shop::addSqlAssociation('feature', 'f').' WHERE `id_product` IN ('.implode($product_implode, ',').') GROUP BY id_product, pf.id_feature ORDER BY f.position ASC'); foreach ($result as $row) { if (!array_key_exists($row['id_product'].'-'.$id_lang, self::$_frontFeaturesCache)) self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang] = array(); if (!isset(self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_feature']])) self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_feature']] = $row; } } To show the features in your product-list.tpl, you could do it this way (I only want to list the feature with ID: 8) {if isset($product.features.8)} <div class="features"> <div> <span>{$product.features.8}</span> </div> </div> {/if} Product.php Share this post Link to post Share on other sites
UnaiSC 0 Posted January 30, 2015 Posted January 30, 2015 (edited) I have Prestahop 1.6.0.9 and I'm unable to do the first step, enter pd_feature_product, since I have no idea what is phpmyadmin and seems that it can't be done with Filezilla or directly entering the server. Can someone help me? Thanks! Edited January 30, 2015 by UnaiSC (see edit history) Share this post Link to post Share on other sites
TheWolf 2 Posted February 18, 2015 Posted February 18, 2015 Hello everyone. I'm using Prestashop 1.6.0.11 and this fix is great! exactly what i needed. The problem is that when i add alot of features, scroll bars apear, how can i increase the size of this "box" to allow it to display more features without interruption? picture attached: Thank you. Share this post Link to post Share on other sites
jdanthinne 8 Posted March 6, 2015 Posted March 6, 2015 Hi, For those still searching for a solution, I'm sharing a module that allows multiple values. Please try it here: https://github.com/jdanthinne/advancedfeaturesvalues 4 Share this post Link to post Share on other sites
mlarino 2 Posted May 11, 2015 Posted May 11, 2015 I tried all your suggestions but none work because in the Database I can't ALTER ps_feature_product I am using: ALTER TABLE ps_feature_product DROP PRIMARY KEY, ADD PRIMARY KEY (id_feature, id_product, id_feature_value); on 1.6.0.14 but that table doesn't have a primary key. Has something changed in 1.6.0.14? Thanks! Share this post Link to post Share on other sites
creative7 4 Posted May 27, 2015 Posted May 27, 2015 Mine was all worked fine but for some reason it is displaying the features like this all of a sudden? Previously the airlines we're grouped together Prestashop v1.6.0.14 Any help greatly appreciated, thanks in advance Share this post Link to post Share on other sites
jdanthinne 8 Posted May 27, 2015 Posted May 27, 2015 @creative7: what have you changed/updated since this was working? Share this post Link to post Share on other sites
creative7 4 Posted May 28, 2015 Posted May 28, 2015 @jdanthinne haven't changed or updated anything, cleared cache and this happened which is really weird. I have also tried your module on github but unfortunately, threw up errors during install. Share this post Link to post Share on other sites
creative7 4 Posted May 29, 2015 Posted May 29, 2015 Okay so, I have the features displaying correctly now but have a new problem. The features tab in the back end of the product now doesn't display any option to insert features? 1 Share this post Link to post Share on other sites
mikajaxxxx 2 Posted June 28, 2015 Posted June 28, 2015 HI every one how about this? https://github.com/jdanthinne/advancedfeaturesvalues it is a module.. it is free and worked fine for me Share this post Link to post Share on other sites
Zen_j1 9 Posted June 29, 2015 Posted June 29, 2015 I tried module on prestashop 1.5.4.1 and i get error how to fix this The following module(s) were not installed properly: - advancedfeaturesvalues :The version of your module is not compliant with your PrestaShop version. Share this post Link to post Share on other sites
mikajaxxxx 2 Posted June 29, 2015 Posted June 29, 2015 I tried module on prestashop 1.5.4.1 and i get error how to fix this The following module(s) were not installed properly: - advancedfeaturesvalues :The version of your module is not compliant with your PrestaShop version. I installed on presta 1.6.14 and works perfectly.. i also used the override file to match another module! it is really easy and cool Share this post Link to post Share on other sites
elgringolo 2 Posted October 9, 2015 Posted October 9, 2015 (edited) @mikajaxxxx I tried the module you are talking about on a fresh install of prestashop v1.6.0.9 I can't save because button are "turning" in a loop like on my screen capture.Any idea to fix it ? --------------EDIT--------------I think I fix it in "modules\advancedfeaturesvalues\views\templates\admin\products\features.tpl" line 140 : delete this > disabled="disabled" and replace process-icon-loading by process-icon-save do the same thing for the other button on the line 139it work for me ! v1.6.0.9 Edited October 9, 2015 by elgringolo (see edit history) Share this post Link to post Share on other sites
krawless 1 Posted December 4, 2015 Posted December 4, 2015 It doesn't work ok for me 1.6.0.9 and 1.6.0.13 installs. BlockLayer doesn't show anymore. Any ideea? Share this post Link to post Share on other sites
mjcasalins 0 Posted December 11, 2015 Posted December 11, 2015 It doesn't work in v1.6.1.0. Share this post Link to post Share on other sites
elgringolo 2 Posted December 17, 2015 Posted December 17, 2015 @krawless & @mjcasalins did you try the module than @mikajaxxx is talking about there : https://github.com/jdanthinne/advancedfeaturesvalues ? Install1. Download and copy the advancedfeaturesvalues folder into the /modules folder of your Prestashop installation. Important: be sure to remove the -master suffix after downloading the archive from GitHub. 2. Install the module in your prestashop backend (looking for "features") 3. If you have the problem with the inactived buttons, modify like I explain here :https://www.prestashop.com/forums/topic/176242-modification-select-multiple-values-for-one-feature/page-11?do=findComment&comment=2162173Work like a charm for me on a 1.6.0.9 version and it's free 1 Share this post Link to post Share on other sites
ajalex 0 Posted December 20, 2015 Posted December 20, 2015 Hi I installed the module featuresvalues advanced ins prestashop 1.6.1.3 but it does not work, I get blank features, anyone who can help? Thanks! Share this post Link to post Share on other sites
mjcasalins 0 Posted February 9, 2016 Posted February 9, 2016 Finally it works, thanks. But I have a problem. When I try to update a value, the value is in blank, but in the list the value appear. Anyone has the same problem? Share this post Link to post Share on other sites
Guest locen Posted February 18, 2016 Posted February 18, 2016 Hi, i have version1.6.1.1 and i can't find solution to solve this problem to features..anyone can help me..i installed module advancedfeaturesvalues-master but i can't find it in BO Share this post Link to post Share on other sites
toykala 0 Posted May 1, 2016 Posted May 1, 2016 @krawless & @mjcasalins did you try the module than @mikajaxxx is talking about there : https://github.com/jdanthinne/advancedfeaturesvalues ?Install1. Download and copy the advancedfeaturesvalues folder into the /modules folder of your Prestashop installation. Important: be sure to remove the -master suffix after downloading the archive from GitHub. 2. Install the module in your prestashop backend (looking for "features") 3. If you have the problem with the inactived buttons, modify like I explain here : https://www.prestashop.com/forums/topic/176242-modification-select-multiple-values-for-one-feature/page-11?do=findComment&comment=2162173 Work like a charm for me on a 1.6.0.9 version and it's free This module is great But after installing and using module for 1 day, all the changes have come back to before. then I cannot select multiple value, and all saved feature become single value. Do you know what is the problem. I used 1.6.1.2 Share this post Link to post Share on other sites
proghead 0 Posted June 1, 2016 Posted June 1, 2016 (edited) Works for me, thanks! Is there any chance to group features by categories? Hi, i have version1.6.1.1 and i can't find solution to solve this problem to features..anyone can help me..i installed module advancedfeaturesvalues-master but i can't find it in BO Dont install it via admin, just unpack zip, change folder name to 'advancedfeaturesvalues' and copy it to 'modules' folder on FTP. After that find and install it in admin panel. -- I found a problem, when i try to fill customized value, when there is already pre-defined ones, then it simply dont save to DB. When there is no pre-defined values, then cutomized value works fine. Anyone solve this? Edited June 3, 2016 by proghead (see edit history) Share this post Link to post Share on other sites
Tirips 11 Posted July 4, 2016 Posted July 4, 2016 @locen Maybe it's too late but I had the same trouble. Solution : unzip and copy in your "modules" files (using Filezilla) after having erased "-master" (warning, if you erase "-master" from the zip file when unzip it keeps the "-master" in the file name! so delete after unzip ) Share this post Link to post Share on other sites
Guest locen Posted July 4, 2016 Posted July 4, 2016 Thanks guys Share this post Link to post Share on other sites
carolinalour 1 Posted September 19, 2016 Posted September 19, 2016 (edited) Hi, Sorry in advance for this, but the topic is 12 pages long and I could not understand it fully. I've installed this module. However, the values I import with CSV, even though they show up in product details page, they dont show up in filters. How to make them appear ? Thanks Edited September 20, 2016 by carolinalour (see edit history) Share this post Link to post Share on other sites
Tomasci 3 Posted September 28, 2016 Posted September 28, 2016 Can anyone confirm this module/fix works in PS 1.6.1.7 ? Lots of info here, many seam to have problems. I certainly agree it should be a core function within Prestashop. Thank Share this post Link to post Share on other sites
mikajaxxxx 2 Posted September 28, 2016 Posted September 28, 2016 yeah it is really needed for prestashop. i don't know why they don't care about this? Share this post Link to post Share on other sites
Tomasci 3 Posted September 28, 2016 Posted September 28, 2016 (edited) So it does not work in PS 1.6.1.7. I have tried installing the overrides, changing the database. It looks good in backoffice, but the selected product features do not save upon saving product. So now I am left with possibility to purchase 1 out of these 2 modules: http://addons.prestashop.com/nl/6356-multiple-features-assign-your-features-as-you-want.html http://addons.prestashop.com/nl/8196-multiple-features-for-products.html The first does not have layered navigation in front office demo. The second just doesn't add up. When selecting a feature value (in the layered navigation) with 1 product (compositions/cotton) I still get 7 results. Anyone have some experience with one of these 2 addons? Any recommendations? Thanks Edited September 28, 2016 by Tomzie (see edit history) Share this post Link to post Share on other sites
tkv 0 Posted September 28, 2016 Posted September 28, 2016 Hello Tomzie, I purchased this two modules a few weeks ago. This modules do not work either with prestashop 1.6.1.5. And the support ist bu******t! They don´t answear my questions. So now I am looking for another solution.. Important is that I need to import multiple features. I have more than 6000 products with multiple features to import... Share this post Link to post Share on other sites
Tomasci 3 Posted September 29, 2016 Posted September 29, 2016 Hi TKV, Yeah. Don't have any great experience with the addons support either. I would gladly pay for this function. But if and when I pay for it, it should work without problems/delays. So no solution there. Hopefully someone will find a fix for this. The only problem in latest version of the override proposed by David Bucur is that feature values do not save in Back Office. I have done every step correctly. Also I have tried in a fresh PS 1.6.1.7 installation. Share this post Link to post Share on other sites
EvrenE 0 Posted October 1, 2016 Posted October 1, 2016 (edited) is it working on PS 1.6.1.6 well? installed on PS 1.6.1.6 as said by Tomzie, it is not working on front office (The error is: Fatal error: Class 'ProductCore' not found in E:\xampp\htdocs\classes\Product.php on line 4) Back office working well... I really want to know how can we use check box instead of radio buttons. multiple selection must be necessary for this system i think... Edited October 2, 2016 by EvrenE (see edit history) Share this post Link to post Share on other sites
fortuner 21 Posted November 15, 2016 Posted November 15, 2016 I found the solution for the above. I updated override/classes/Product.php so it now also override cacheFrontFeatures: public static function cacheFrontFeatures($product_ids, $id_lang) { if (!Feature::isFeatureActive()) return; $product_implode = array(); foreach ($product_ids as $id_product) if ((int)$id_product && !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures)) $product_implode[] = (int)$id_product; if (!count($product_implode)) return; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT id_product, name, GROUP_CONCAT(value SEPARATOR \', \') AS value, pf.id_feature FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature) '.Shop::addSqlAssociation('feature', 'f').' WHERE `id_product` IN ('.implode($product_implode, ',').') GROUP BY id_product, pf.id_feature ORDER BY f.position ASC'); foreach ($result as $row) { if (!array_key_exists($row['id_product'].'-'.$id_lang, self::$_frontFeaturesCache)) self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang] = array(); if (!isset(self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_feature']])) self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_feature']] = $row; } } To show the features in your product-list.tpl, you could do it this way (I only want to list the feature with ID: 8) {if isset($product.features.8)} <div class="features"> <div> <span>{$product.features.8}</span> </div> </div> {/if} Ok, try this override: Place file AdminImportController.php in overide/controllers/admin/ AdminImportContoller.php I also correctes some bugs in it (my last post) Let me know if there are any problems Hello! I'm having trouble with feature import, could you please help? Here is my feature line in CSV: Size:Large adult|Standard adult:1:0;Measuring method:Korotkov tones|Ocillometric:2:0;Cuff type:Standard with ring:3:0;AC Adapter:Yes:4:0 Here is what I get in features values when importing products: As I assume features are combined somehow and import is misbehaving. Help, please Share this post Link to post Share on other sites
cell.bg 0 Posted December 5, 2016 Posted December 5, 2016 Hey fortuner, You need to place file AdminImportController.php in overide/controllers/admin/ and delete the file /cache/class_index.php Share this post Link to post Share on other sites
casadelvigile 0 Posted December 9, 2016 Posted December 9, 2016 Hello guys, I'm trying to use this module but I'm not able. I use PS 1.6.1.9. I pasted the folder advancedfeaturesvalues in /modules but in BO I don't see any change. How is it possible? Thank you in advance Share this post Link to post Share on other sites
mikajaxxxx 2 Posted December 30, 2016 Posted December 30, 2016 Hi everybody I found something really good module to do this and it is FREE! https://github.com/jdanthinne/advancedfeaturesvalues this module works much better than you think . the only problem i faced is that it have some kind of overrides for Layered navigation block. and if you use a replacement for this module it will not work for you the owner didn't update it for a year.. but if we could update it will work like a charm 1 Share this post Link to post Share on other sites
gafonso 0 Posted January 11, 2017 Posted January 11, 2017 Hi, Anything like this for prestashop 1.7? Share this post Link to post Share on other sites
prestowicz 4 Posted January 17, 2017 Posted January 17, 2017 (edited) OK Now, the front display is another problem due to a strange cache which isn't always updated. The only workaround I could find, is to avoid testing this cache when displaying features. Try replacing the code in /override/classes/Product.php with this one : <?php class Product extends ProductCore { public static function getFrontFeaturesStatic($id_lang, $id_product) { if (!Feature::isFeatureActive()) return array(); //if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache)) //{ self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT name, value, pf.id_feature FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') WHERE pf.id_product = '.(int)$id_product.' ORDER BY f.position ASC' ); //PWeb: join multiple values of one feature into one value $features =& self::$_frontFeaturesCache[$id_product.'-'.$id_lang]; $features_key = array(); foreach ($features as $key => $feature) { if (!array_key_exists($feature['name'], $features_key)) { $features_key[$feature['name']] = $key; } else { $features[ (int)$features_key[$feature['name']] ]['value'] .= ', ' . $feature['value'] ; unset($features[$key]); } } //} return self::$_frontFeaturesCache[$id_product.'-'.$id_lang]; } } Note that this is a temporary workaround, hoping someone will find how to handle this strange "frontFeaturesCache" properly THX 4 this one! My sollution to fix the caching issue is to override the cacheFrontFeatures class Product method like this to get the caching working: /* * module: advancedfeaturesvalues fix for caching */ public static function cacheFrontFeatures($product_ids, $id_lang) { if (!Feature::isFeatureActive()) { return; } $product_implode = array(); foreach ($product_ids as $id_product) { if ((int)$id_product && !array_key_exists($id_product.'-'.$id_lang, self::$_cacheFeatures)) { $product_implode[] = (int)$id_product; } } if (!count($product_implode)) { return; } $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT id_product, name, GROUP_CONCAT(value ORDER BY f.position SEPARATOR ", ") AS value, pf.id_feature FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature) '.Shop::addSqlAssociation('feature', 'f').' WHERE `id_product` IN ('.implode($product_implode, ',').') GROUP BY id_product, f.position ORDER BY id_product,f.position ASC'); foreach ($result as $row) { if (!array_key_exists($row['id_product'].'-'.$id_lang, self::$_frontFeaturesCache)) { self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang] = array(); } if (!isset(self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_feature']])) { self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_feature']] = $row; } } } Edited January 17, 2017 by prestowicz (see edit history) Share this post Link to post Share on other sites
PinkyPurple 0 Posted June 17, 2017 Posted June 17, 2017 (edited) Hi, Anything like this for prestashop 1.7? I'm using the latest Prestashop 1.7 and I've been able to find the first code and adjust it (see the first post) in the /controllers/admin/adminproductscontroller.php if ($val && $val[0] != 0) foreach ($val AS $feature_val) $product->addFeaturesToDB($match[1], $feature_val); I also adjusted the database (drop primary key) But what's the next step for 1.7? I don't know much about code, but any help with with which files to adjust with the right code would be greatly appreciated. I think lots of people are looking for this in the latest Prestashop (this should've been one of the basics that comes with Prestashop anyway) Anyone? Edited June 17, 2017 by PinkyPurple (see edit history) Share this post Link to post Share on other sites
trace 7 Posted July 7, 2017 Posted July 7, 2017 (edited) Ok, so I did it myself If You want to Import Multiple features (with this mod) in presta 1.6+ (I tested it on 1.6.0.9) you should modify 1 File: /controllers/admin/AdminImportController.php .... ID;Feature (Name:Value:Position:Customized) 11;Grupa roślin:Iglaste|Liściaste:0 Notice that You should use | as a multiple feature devider. Should work It's not working on PS 1.6.1.11 (with php7) Edited July 7, 2017 by trace (see edit history) Share this post Link to post Share on other sites
bTk 4 Posted December 9, 2017 Posted December 9, 2017 (edited) Hi guys, I struggled with this issue in presta 1.7 for 3 days now and finally i found out a solution It's not "elegant" (you have to modify core file in "/src" folder) but it works. Maybe someone will come up with a more suitable solution after seeing mine. Here it goes: 1st step is modifing table "(your_prefix)_feature_product" to allow inserting multiple lines with same "id_feature" and "id_product", like in 1st post in this topic (see it for more detailed instructions). 2nd step is modyfing file "AdminModelAdapter.php" found in "/src/PrestaShopBundle/Model/Product/" folder. We just have to change line 340 (in my Presta version) from: $form_data['feature_'.$idFeature.'_value'] = $dataFeature['value']; to: $form_data['feature_'.$idFeature.'_value'.$dataFeature['value']] = $dataFeature['value']; Point of this step is to change the way Prestashop converts data from $_POST variable. And that's it, now you can add multiple values to one feature in Back Office (like in the attached screenshot), enjoy ! Edited December 9, 2017 by bTk (see edit history) Share this post Link to post Share on other sites
Krystian Podemski 289 Posted December 9, 2017 Posted December 9, 2017 From PrestaShop 1.7.3 this feature would be natively in PrestaShop 2 Share this post Link to post Share on other sites
trace 7 Posted December 10, 2017 Posted December 10, 2017 17 hours ago, Krystian Podemski said: From PrestaShop 1.7.3 this feature would be natively in PrestaShop Five years later 1 1 Share this post Link to post Share on other sites
elgringolo 2 Posted December 10, 2017 Posted December 10, 2017 better late than never 1 Share this post Link to post Share on other sites
casadelvigile 0 Posted December 16, 2017 Posted December 16, 2017 Good news Someone knows when will be available the stable version of 1.7.3.0? Thank you!! Share this post Link to post Share on other sites
ukbaz 2 Posted June 25, 2019 Posted June 25, 2019 So can someone please post full solution for Prestashop 1.7 I'm confused over what files need changing now! Thanks Baz Share this post Link to post Share on other sites
Edel 1 Posted July 9, 2019 Posted July 9, 2019 Hello, It's now native in PrestaShop. Share this post Link to post Share on other sites
ukbaz 2 Posted July 10, 2019 Posted July 10, 2019 14 hours ago, Edel said: Hello, It's now native in PrestaShop. What version of 1.7 is it native in? I'm using 1.7.5.1 and Can't select/display multiple values. I can, as always set multiple values for a given 'feature' but only one can be selected at any one time using the drop-down or preset. Am I missing something or is it still not possible to select and display multiple values for a given feature? 1 Share this post Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now