Jump to content
kiamaru

Change Size Ean-13 And Upc With Special Caractères

Recommended Posts

hi

 

i want to change the size of EAn (13 max) and UPC (12) and allow spécial caractères like '+, @, etc'

 

thanks for your replies

Share this post


Link to post
Share on other sites

Change the isEan13() and isUpc() functions in /classes/Validate.php for special characters.

 

Change values (size' => ...) for the ean13 and upc keys under 'fields' => array(... in /classes/Product.php as well as the ean13 and upc field lengths in the ps_product and ps_product_attribute tables.

 

And of course finally, use a barcode which supports special characters.

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

i had the same problem with ps 1.7

go to your database, find the ps_product and change the max value of ean13 column to 14

 

in src/PrestaShopBundle/Form/Admin/Product/ProductOptions.php

find

 ->add('ean13', 'Symfony\Component\Form\Extension\Core\Type\TextType', array(
            'required' => false,
            'error_bubbling' => true,
            'label' => $this->translator->trans('EAN-13 or JAN barcode', [], 'Admin.Catalog.Feature'),
            'constraints' => array(
                new Assert\Regex("/^[0-9]{0,13}$/"),
            )
        ))

 

and change new Assert\Regex("/^[0-9]{0,13}$/"), to new Assert\Regex("/^[0-9]{0,14}$/"),

 

 

then go to classes/product.php and modify

array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),

to

array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 14),

 

 

bye!

Matteo

Share this post


Link to post
Share on other sites

Hello, doesnt work. I cant open the admin page. What i do wrong?

Share this post


Link to post
Share on other sites
On 5/19/2019 at 3:51 PM, Birnex said:

Hello, doesnt work. I cant open the admin page. What i do wrong?

Hello,

what do you mean when you say "i can't open the admin page"?

Share this post


Link to post
Share on other sites

Hi. Does this still work? I currently have the same problem and we don't make them work. I made all the changes marked here. I did what @ tuk66 marked and still marks me as invalid. I also made the changes of @ mma87. I have version 1.7.4.3

Edited by Adrian (see edit history)

Share this post


Link to post
Share on other sites

Hello,

backup first!

then you can try with this:

delete var/cache/prod/class_index.php and var/cache/dev/class_index.php so it will rebuild the class cache file.

Share this post


Link to post
Share on other sites

 

Hi! Thank you for answering so quickly! That would be like clearing the cache from the backoffice, right?

Share this post


Link to post
Share on other sites

 

Do I delete the file or delete all the content from top to bottom?

Share this post


Link to post
Share on other sites

you can delete the cache from backoffice than check in the FTP if the files I tell you are still here. If yes you have to delete them manually.

Share this post


Link to post
Share on other sites

I have already deleted them and it still doesn't work.

 

- I have tried to increase the length in "Validate.php" and "Product.php".

- To change the length in the ps_product and ps_product_attribute tables of the database.

- To increase the length in "ProductOptions.php"

- And finally clear the cache you told me. I do not know what else to do :( 

Share this post


Link to post
Share on other sites

 

Ok, it's my fault. That does work. I have not explained well. I wanted to say in the EAN13 (or ISBN, no matter) of a product with combinations. I need it in the combinations, not in the product.

 

Product:

image.png.cf70c85629750e499995384afeda0d7c.png

Combinations: (i want this)

image.thumb.png.90f194ebe13f489b93e1324cb03dedf1.png

 

Edited by Adrian (see edit history)

Share this post


Link to post
Share on other sites

 

Yes, finally! You just had to edit that file! Thanks for the help!

src/PrestaShopBundle/Form/Admin/Product/ProductCombination.php

Edited by Adrian (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More