yaniv14 Posted January 25, 2015 Share Posted January 25, 2015 (edited) Hi, I am trying to save multiple values of features to product. I have changed featured.tpl to select multiple and modified class/Product.php 'addFeaturesToDB' function to accept array, but for some reason its only saves the last object from the selected objects. Any help will be appreciated. Edited February 9, 2015 by yaniv14 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 25, 2015 Share Posted January 25, 2015 what ps version you use and what you changed? Link to comment Share on other sites More sharing options...
yaniv14 Posted January 26, 2015 Author Share Posted January 26, 2015 (edited) Latest release. I override Product class with: public function addFeaturesToDB($id_feature, $id_value, $cust = 0) { if ($cust) { $row = array('id_feature' => (int)$id_feature, 'custom' => 1); Db::getInstance()->insert('feature_value', $row); $id_value = Db::getInstance()->Insert_ID(); } $base = array( 'id_feature' => (int)$id_feature, 'id_product' => (int)$this->id, ); $rows = array(); foreach ($id_value as $value) { if(!empty($value)) { $rows[] = $base + array('id_feature_value' => $value); } } $row = array('id_feature' => (int)$id_feature, 'id_product' => (int)$this->id, 'id_feature_value' => (int)$id_value); Db::getInstance()->insert('feature_product', $row); SpecificPriceRule::applyAllRules(array((int)$this->id)); if ($id_value) return ($id_value); } and modified admin/features.tpl to select multiple. I can see that the post is ok with the array but it doesn't saves both values, only the second one. Thanks. Edited January 27, 2015 by yaniv14 (see edit history) Link to comment Share on other sites More sharing options...
yaniv14 Posted January 27, 2015 Author Share Posted January 27, 2015 (edited) Hi Vekia, Any suggestion? Edited January 31, 2015 by yaniv14 (see edit history) Link to comment Share on other sites More sharing options...
jdanthinne Posted March 7, 2015 Share Posted March 7, 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 3 Link to comment Share on other sites More sharing options...
creative7 Posted April 14, 2015 Share Posted April 14, 2015 jdanthinne this is the error i get trying to install on 1.6.0.9 [PrestaShop] Fatal error in module Module:Uncaught exception 'ReflectionException' with message 'Class FeatureValueOverrideOriginal_remove552cc5d693331 does not exist' in /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php:2496 Stack trace: #0 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php(2496): ReflectionClass->__construct('FeatureValueOve...') #1 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php(2405): ModuleCore->removeOverride('FeatureValue') #2 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php(284): ModuleCore->uninstallOverrides() #3 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/modules/advancedfeaturesvalues/advancedfeaturesvalues.php(26): ModuleCore->install() #4 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/controllers/admin/AdminModulesController.php(805): AdvancedFeaturesValues->install() #5 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/controllers/admin/AdminModulesController.php(1045): AdminMod any help appreciated 1 Link to comment Share on other sites More sharing options...
Kyasarin Posted September 18, 2015 Share Posted September 18, 2015 (edited) jdanthinne this is the error i get trying to install on 1.6.0.9 [PrestaShop] Fatal error in module Module: Uncaught exception 'ReflectionException' with message 'Class FeatureValueOverrideOriginal_remove552cc5d693331 does not exist' in /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php:2496 Stack trace: #0 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php(2496): ReflectionClass->__construct('FeatureValueOve...') #1 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php(2405): ModuleCore->removeOverride('FeatureValue') #2 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/classes/module/Module.php(284): ModuleCore->uninstallOverrides() #3 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/modules/advancedfeaturesvalues/advancedfeaturesvalues.php(26): ModuleCore->install() #4 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/controllers/admin/AdminModulesController.php(805): AdvancedFeaturesValues->install() #5 /Applications/XAMPP/xamppfiles/apps/prestashop/htdocs/controllers/admin/AdminModulesController.php(1045): AdminMod any help appreciated That happends when you uninstall and install again. it didnt work for me too have to wait For the problems that give after uninstall: delete de feature class in /override/classes adminfeat... in /override/controllers/admin de directory blocklayered from override/modules and delete the class_index.php from cache Edited September 18, 2015 by Kyasarin (see edit history) Link to comment Share on other sites More sharing options...
jdanthinne Posted September 21, 2015 Share Posted September 21, 2015 Unfortunately, it seems that the uninstall process of PS is a little buggy. Already had the same thing with some other modules. The only solution is to remove the overrides by hand. Link to comment Share on other sites More sharing options...
vucumbra Posted September 8, 2016 Share Posted September 8, 2016 work for me but i can't select multiple value with csv file Link to comment Share on other sites More sharing options...
thehurricane Posted June 7, 2018 Share Posted June 7, 2018 On 7.03.2015 at 5:17 PM, jdanthinne said: 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 Is this module working on Ps 1.7? How to install it? Link to comment Share on other sites More sharing options...
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