Jump to content

Reference length of combinations, how to have more than 32 characters?


NielsTy

Recommended Posts

Dear all.

 

I have a bit of a problem with my shop (PS 1.6.1.6). I desperately need to be able to have more than 32 characters in the Reference fields of my product combinations (i get this error when trying to import from csv:
Property Combination->reference length (37) must be between 0 and 32 )

 

I am not a wizard in php, and i couldn't really find a solution in the forum for this problem. There are solutions when it comes to other field lengths, but not for this one, and i am not able to use the info for my specific needs!

 

Can anybody guide me in the right direction?

It will be much appreciated :)

 

With kind regards,

Niels

Edited by NielsTy (see edit history)
Link to comment
Share on other sites

Create override/classes/Combination.php with the following:

<?php

class Combination extends CombinationCore
{
    public function __construct()
    {
        CombinationCore::$definition['fields']['reference']['size'] = 64;
        parent::__construct();
    }
}

This will increase the field size to 64 characters. Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override.

 

You'll also need to log in to your database using phpMyAdmin, edit the structure of the reference field in the ps_product_attribute table and change the type from varchar(32) to varchar(64).

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Create override/classes/Combination.php with the following:

<?php

class Combination extends CombinationCore
{
    public function __construct()
    {
        CombinationCore::$definition['fields']['reference']['size'] = 64;
        parent::__construct();
    }
}

This will increase the field size to 64 characters. Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override.

 

You'll also need to log in to your database using phpMyAdmin, edit the structure of the reference field in the ps_product_attribute table and change the type from varchar(32) to varchar(64).

 

Worked like a dream... awesome!

Thanks :)

Link to comment
Share on other sites

  • 6 months later...
  • 1 year later...
  • 7 months later...

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...