Jump to content

Adding long custom features and compare by them


Recommended Posts

What are the possibilities (modules, custom work) to add custom features in the product (more than 255 characters), and compare them?

 

I have a composition of the products (nutritional supplements), counterindications and the indications for their use. And I want ability for users the opportunity to compare products by composition and indications/counterindications.

 

Right now I can't add composition as a feature just because the usual product contains dozens of words of text in the composition. Much more than 255 chars.

 

Exactly the same state with the indications and contraindications.

 

Yes, I can buy several Custom Tab modules etc but is there a chance to see them (additional features like product composition) in a standard Prestashop product comparison?

Link to comment
Share on other sites

Have you trying going to phpMyAdmin and increasing the maximum length of the value field in ps_feature_value_lang? By default, it is VARCHAR(255). Then you can increase the value to the same amount on line 50 of classes/FeatureValue.php:

            'value' =>        array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
Link to comment
Share on other sites

Hopefully, PrestaShop won't change the ps_feature_value table in future database upgrades and it will be left the way it is. The classes/FeatureValue.php file will be overwritten, however, so you'll need to change it again after upgrading, unless you create override/classes/FeatureValue.php with the following:
<?php

class FeatureValue extends FeatureValueCore {
    public function __construct()
    {
        FeatureValue::$definition['fields']['value']['size'] = 1024;

        parent::__construct();
    }
}

Remember to delete cache/class_index.php so PrestaShop can find the override. PrestaShop will not change your overrides when upgrading.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...