Jump to content

solved |Configuration parameter to change the length of prestashop product name 1.7.8.3


Toulousain

Recommended Posts

Hello,

I want to change the length of the product name by increasing the number of characters allowed.
Before version 1.7.8.2, you just had to replace in the file product.php the line :

name' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => false, 'size' =>128,

The parameter

'size' => 128

By 

'size' => 190 // 190 being the new number of characters we want.

Since version 1.8.2 

'size' => 128

is replaced 
by 

'size' => ProductSettings::MAX_NAME_LENGTH]

 

It seems now that there is a configuration parameter from the backoffice but I can't find it.

Do you know where it can be found ?

Thanks a lot 

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

Hi,

1. You need to modify in db, ps_product_lang, increase length of the "name" to 192

2. prestashop\src\Core\Domain\Product\ProductSettings.php

public const MAX_NAME_LENGTH = 192;

3. prestashop\src\PrestaShopBundle\Form\Admin\Product\ProductInformation.php

->add('name', TranslateType::class, [
                'type' => FormType\TextType::class,
                'options' => [
                    'constraints' => [
                        new Assert\Regex([
                            'pattern' => '/[<>;=#{}]/',
                            'match' => false,
                        ]),
                        new Assert\NotBlank(),
                        new Assert\Length(['min' => 3, 'max' => 128]),
                    ],
                    'attr' => [
                        'placeholder' => $this->translator->trans('Enter your product name', [], 'Admin.Catalog.Help'),
                        'class' => 'edit js-edit serp-default-title',
                    ],
                ],

modify

new Assert\Length(['min' => 3, 'max' => 192]),

 

  • Like 2
Link to comment
Share on other sites

  • Toulousain changed the title to solved |Configuration parameter to change the length of prestashop product name 1.7.8.3
  • 1 year later...

This don't work when editing an already created product, after product crreation i am still limited to 128 characters when editing the product. I tried creating a new product manually and i was able to have 255 characters in the product title. There should be another settings to change for that part but i don't know what.

Link to comment
Share on other sites

  • 3 weeks 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...