Jump to content

pre-fill product description input field in back office?


aaront1

Recommended Posts

ADMIN_DIR/themes/default/controllers/product/information.tpl

 

there is a code:
 

	{include
				file="controllers/products/textarea_lang.tpl"
				languages=$languages input_name='description'
				class="autoload_rte"
				input_value=$product->description}

you can change it, add there if condition to check if $product->description contains some contents

if not - include some custom content, if so include $product->description

Link to comment
Share on other sites

  • 4 years later...

Is there a option for Presta 1.7.5? Especially for the Short description?

I have found httpdocs/src/PrestaShopBundle/Form/Admin/Product/ProductInformation.php

But how i set it up with 'data' => 'some text the pre fill', Does overide text that already in DB and that is not showing after saving product, then DATA has come back kicking in.
I must do an if empty then on the text area but symphony is not my strongest side.
 

        ->add('description_short', TranslateType::class, [
                'type' => FormType\TextareaType::class, // https://github.com/symfony/symfony/issues/5906
                'options' => [
			    'data' => 'Testen', //This overides the stored information in the DB, So does not work.
                    'attr' => [
                        'class' => 'autoload_rte',
                        'placeholder' => $this->translator->trans('The summary is a short sentence describing your product.<br />It will appears at the top of your shop\'s product page, in product lists, and in search engines\' results page (so it\'s important for SEO). To give more details about your product, use the "Description" tab.', [], 'Admin.Catalog.Help'),
                        'counter' => (int) $this->configuration->get('PS_PRODUCT_SHORT_DESC_LIMIT') <= 0 ? 800 : (int) $this->configuration->get('PS_PRODUCT_SHORT_DESC_LIMIT'),
                    ],
                    'constraints' => [
                        new TinyMceMaxLength([
                            'max' => (int) $this->configuration->get('PS_PRODUCT_SHORT_DESC_LIMIT') <= 0 ? 800 : (int) $this->configuration->get('PS_PRODUCT_SHORT_DESC_LIMIT'),
                        ]),
                    ],
                    'required' => false,
                ],
                'locales' => $this->locales,
                'hideTabs' => true,
                'label' => $this->translator->trans('Short description', [], 'Admin.Catalog.Feature'),
                'required' => false,

 

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