Jump to content

Is it possible to change the UPC code from 12 to 13 digits


Recommended Posts

Because we sell products from both Mexico which uses a 13 digit UPC code and the USA which is 12 we would like to be able to enter both in the UPC text box for items. Is it possible to change the length of the entry so that it does not truncate the 13th digit? This would be preferable to us than entering the Mexican UPC in the EAN13 slot as a European code.

Link to comment
Share on other sites

Hi, just like the latitude / longitude size problem http://www.prestashop.com/forums/topic/269436-longitude-field-error-i-can-not-enter-my-google-map-location/page__p__1347972#entry1347972

 

the upc size is coded inside PS class variable, and not configurable.

You need to manually change the size setting

classes/Product.php line 260

'upc' =>	   array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),

change the size to whatever number you require.

 

Please see the latitude / longitude topic first for details about using override folder and removing cache/class_index.php

  • Like 2
Link to comment
Share on other sites

as for adding 13 byte upc, it's rather more than a simple array update

 

1. the db has a varchar limit 12 (would require expanded to 13)

2. all the input forms limit to 12 (products/combinations) forms would need to be modified to support 13

3. and various other tid bits

Link to comment
Share on other sites

  • 4 years later...

Hi, I know this topic is old, but if somebody have this issues with ps 1.6.1.18 need change too those files:

\classes\validate.php
public static function isUpc($upc)
    {
        return !$upc || preg_match('/^[0-9]{0,12}$/', $upc);//change 12 by number you choice
    }

 

Change too in: \class\product.php y en combination.php

'upc' =>array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12);//change12 by number you choice

 

Good luck!

 

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