Magento 2 + how to remove character limit from meta keyword field in product The 2019 Stack Overflow Developer Survey Results Are InMagento 2.2 - How to remove product Meta Keywords maxlength validation from backend?Magento2 - Remove Meta Keywords from all pagesHow to remove country field from My Account address?Magento 2 -Limit the length of the product name on the front end.How to remove the prefix field from the checkout in 2.2how can i change length of meta description from 255Remove keywords meta tag from head in Magento 2Removal decimals from Quantity on Orders PageHow to increase character limit of text field in Magento 2?Magento 2.2 - How to remove product Meta Keywords maxlength validation from backend?'Migration Meta Information' is not updating when I edit product title/name in magento 2.3
For what reasons would an animal species NOT cross a *horizontal* land bridge?
What is the meaning of Triage in Cybersec world?
Why can I use a list index as an indexing variable in a for loop?
How do I free up internal storage if I don't have any apps downloaded?
If my opponent casts Ultimate Price on my Phantasmal Bear, can I save it by casting Snap or Curfew?
Can a flute soloist sit?
Hello, Goodbye, Adios, Aloha
Cooking pasta in a water boiler
Loose spokes after only a few rides
Do ℕ, mathbbN, BbbN, symbbN effectively differ, and is there a "canonical" specification of the naturals?
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
Word to describe a time interval
Question on an engine pulling a train
Why did Peik say, "I'm not an animal"?
Magento 2 + how to remove character limit from meta keyword field in product
What is this sharp, curved notch on my knife for?
Geography at the pixel level
How to notate time signature switching consistently every measure
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Why is this recursive code so slow?
What options are there, if any, to get information from an enemy's familiar?
Falsification in Math vs Science
Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?
How much of the clove should I use when using big garlic heads?
Magento 2 + how to remove character limit from meta keyword field in product
The 2019 Stack Overflow Developer Survey Results Are InMagento 2.2 - How to remove product Meta Keywords maxlength validation from backend?Magento2 - Remove Meta Keywords from all pagesHow to remove country field from My Account address?Magento 2 -Limit the length of the product name on the front end.How to remove the prefix field from the checkout in 2.2how can i change length of meta description from 255Remove keywords meta tag from head in Magento 2Removal decimals from Quantity on Orders PageHow to increase character limit of text field in Magento 2?Magento 2.2 - How to remove product Meta Keywords maxlength validation from backend?'Migration Meta Information' is not updating when I edit product title/name in magento 2.3
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to remove 255 characters limit from meta keywords field in product in admin while saving or updating existing ?
magento2 admin magento2.2.7 product-edit meta-keywords
add a comment |
How to remove 255 characters limit from meta keywords field in product in admin while saving or updating existing ?
magento2 admin magento2.2.7 product-edit meta-keywords
1
You have raised a good point, +1 for that
– Shoaib Munir
5 hours ago
You would possible need to update catalog_product_entity_varchar to change the value column to either a heigher number or to a text value with no limit
– Dava Gordon
4 hours ago
I wouldnt recommend adding no more than 10 keyword phrases to a product as they will just be ignored
– Dava Gordon
1 hour ago
add a comment |
How to remove 255 characters limit from meta keywords field in product in admin while saving or updating existing ?
magento2 admin magento2.2.7 product-edit meta-keywords
How to remove 255 characters limit from meta keywords field in product in admin while saving or updating existing ?
magento2 admin magento2.2.7 product-edit meta-keywords
magento2 admin magento2.2.7 product-edit meta-keywords
edited 5 hours ago
Jessy Loran
asked 5 hours ago
Jessy LoranJessy Loran
456
456
1
You have raised a good point, +1 for that
– Shoaib Munir
5 hours ago
You would possible need to update catalog_product_entity_varchar to change the value column to either a heigher number or to a text value with no limit
– Dava Gordon
4 hours ago
I wouldnt recommend adding no more than 10 keyword phrases to a product as they will just be ignored
– Dava Gordon
1 hour ago
add a comment |
1
You have raised a good point, +1 for that
– Shoaib Munir
5 hours ago
You would possible need to update catalog_product_entity_varchar to change the value column to either a heigher number or to a text value with no limit
– Dava Gordon
4 hours ago
I wouldnt recommend adding no more than 10 keyword phrases to a product as they will just be ignored
– Dava Gordon
1 hour ago
1
1
You have raised a good point, +1 for that
– Shoaib Munir
5 hours ago
You have raised a good point, +1 for that
– Shoaib Munir
5 hours ago
You would possible need to update catalog_product_entity_varchar to change the value column to either a heigher number or to a text value with no limit
– Dava Gordon
4 hours ago
You would possible need to update catalog_product_entity_varchar to change the value column to either a heigher number or to a text value with no limit
– Dava Gordon
4 hours ago
I wouldnt recommend adding no more than 10 keyword phrases to a product as they will just be ignored
– Dava Gordon
1 hour ago
I wouldnt recommend adding no more than 10 keyword phrases to a product as they will just be ignored
– Dava Gordon
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
After some debugging I found out that all inputs have 255 length limit and they all have the same template.
The limit is set by the html template itself (kinda hard-coded).
The file path is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
So we have to override it into a custom adminhtml theme.
Before you start, please replace the "Vendor" and "Theme" with your "Vendor" and "Module" names
If you do not have one:
Create the following files:
app/design/adminhtml/Vendor/Theme/composer.json
"name": "<vendor>/<theme>",
"description": "N/A",
"require":
"php": "~5.5.0,
"type": "magento2-theme",
"version": "1.0.0",
"license": [
],
"autoload":
"files": [
"registration.php"
]
app/design/adminhtml/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::THEME,
'adminhtml/<Vendor>/<Theme>',
__DIR__
);
app/design/adminhtml/Vendor/Theme/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Theme</title>
<parent>Magento/backend</parent>
</theme>
These are the theme files.
Now we have to create a custom module to make this work:
app/code/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Vendor_Theme',
__DIR__
);
app/code/Vendor/Theme/composer.json
"name": "vendor/theme",
"description": "",
"require":
"php": "~5.5.0,
"suggest":
,
"type": "magento2-module",
"version": "0.1.0",
"license": [
],
"autoload":
"files": [
"registration.php"
],
"psr-4":
"Vendor\Theme\": ""
,
"extra":
"map": [
[
"*",
"Vendor/Theme"
]
]
app/code/Vendor/Theme/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Theme" setup_version="0.1.0">
</module>
</config>
app/code/Vendor/Theme/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoThemeModelViewDesign">
<arguments>
<argument name="themes" xsi:type="array">
<item name="adminhtml" xsi:type="string">Vendor/Theme</item>
</argument>
</arguments>
</type>
</config>
Now we have a custom adminhtml(backend) theme that overrides the Magento_Backend theme.
Here comes the magic:
The input template file for ui components is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
We copy it in a relative path in our custom theme:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/web/form/element/input.html
We modify the content into:
<!--Overrides: vendor/magento/module-ui/view/base/web/templates/form/element/input.html -->
<!-- ko if: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
"/>
<!--/ko-->
<!-- ko ifnot: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled,
maxlength: 255
"/>
<!-- /ko -->
As you can see here, we tell to knockoutjs to render the input without the maxlength condition only when the input name is "product[meta_keyword]" (thats our input we want)
else, we render the input normally to not do something we don't want to.
Now, we have to make our template override the Magento_Ui template file:
As we see in the Magento_Ui requirejs_config.js of base,
vendor/magento/module-ui/view/base/requirejs-config.js
There is a namespace for the template paths of the ui components:
....
paths:
'ui/template': 'Magento_Ui/templates'
,
....
That means all the templates paths that are from "Magento_Ui/templates" are replaced with "ui/template".
So, we create our requirejs_config.js:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/requirejs-config.js
var config =
map:
"*":
"ui/template/form/element/input": "Magento_Catalog/form/element/input"
;
Now clear the cache, clear the static files (or deploy them) and refresh the page, and you should see something like this:
This works for 2.3.1, and it should work for the lower versions
New contributor
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269820%2fmagento-2-how-to-remove-character-limit-from-meta-keyword-field-in-product%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After some debugging I found out that all inputs have 255 length limit and they all have the same template.
The limit is set by the html template itself (kinda hard-coded).
The file path is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
So we have to override it into a custom adminhtml theme.
Before you start, please replace the "Vendor" and "Theme" with your "Vendor" and "Module" names
If you do not have one:
Create the following files:
app/design/adminhtml/Vendor/Theme/composer.json
"name": "<vendor>/<theme>",
"description": "N/A",
"require":
"php": "~5.5.0,
"type": "magento2-theme",
"version": "1.0.0",
"license": [
],
"autoload":
"files": [
"registration.php"
]
app/design/adminhtml/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::THEME,
'adminhtml/<Vendor>/<Theme>',
__DIR__
);
app/design/adminhtml/Vendor/Theme/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Theme</title>
<parent>Magento/backend</parent>
</theme>
These are the theme files.
Now we have to create a custom module to make this work:
app/code/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Vendor_Theme',
__DIR__
);
app/code/Vendor/Theme/composer.json
"name": "vendor/theme",
"description": "",
"require":
"php": "~5.5.0,
"suggest":
,
"type": "magento2-module",
"version": "0.1.0",
"license": [
],
"autoload":
"files": [
"registration.php"
],
"psr-4":
"Vendor\Theme\": ""
,
"extra":
"map": [
[
"*",
"Vendor/Theme"
]
]
app/code/Vendor/Theme/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Theme" setup_version="0.1.0">
</module>
</config>
app/code/Vendor/Theme/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoThemeModelViewDesign">
<arguments>
<argument name="themes" xsi:type="array">
<item name="adminhtml" xsi:type="string">Vendor/Theme</item>
</argument>
</arguments>
</type>
</config>
Now we have a custom adminhtml(backend) theme that overrides the Magento_Backend theme.
Here comes the magic:
The input template file for ui components is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
We copy it in a relative path in our custom theme:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/web/form/element/input.html
We modify the content into:
<!--Overrides: vendor/magento/module-ui/view/base/web/templates/form/element/input.html -->
<!-- ko if: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
"/>
<!--/ko-->
<!-- ko ifnot: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled,
maxlength: 255
"/>
<!-- /ko -->
As you can see here, we tell to knockoutjs to render the input without the maxlength condition only when the input name is "product[meta_keyword]" (thats our input we want)
else, we render the input normally to not do something we don't want to.
Now, we have to make our template override the Magento_Ui template file:
As we see in the Magento_Ui requirejs_config.js of base,
vendor/magento/module-ui/view/base/requirejs-config.js
There is a namespace for the template paths of the ui components:
....
paths:
'ui/template': 'Magento_Ui/templates'
,
....
That means all the templates paths that are from "Magento_Ui/templates" are replaced with "ui/template".
So, we create our requirejs_config.js:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/requirejs-config.js
var config =
map:
"*":
"ui/template/form/element/input": "Magento_Catalog/form/element/input"
;
Now clear the cache, clear the static files (or deploy them) and refresh the page, and you should see something like this:
This works for 2.3.1, and it should work for the lower versions
New contributor
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
add a comment |
After some debugging I found out that all inputs have 255 length limit and they all have the same template.
The limit is set by the html template itself (kinda hard-coded).
The file path is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
So we have to override it into a custom adminhtml theme.
Before you start, please replace the "Vendor" and "Theme" with your "Vendor" and "Module" names
If you do not have one:
Create the following files:
app/design/adminhtml/Vendor/Theme/composer.json
"name": "<vendor>/<theme>",
"description": "N/A",
"require":
"php": "~5.5.0,
"type": "magento2-theme",
"version": "1.0.0",
"license": [
],
"autoload":
"files": [
"registration.php"
]
app/design/adminhtml/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::THEME,
'adminhtml/<Vendor>/<Theme>',
__DIR__
);
app/design/adminhtml/Vendor/Theme/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Theme</title>
<parent>Magento/backend</parent>
</theme>
These are the theme files.
Now we have to create a custom module to make this work:
app/code/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Vendor_Theme',
__DIR__
);
app/code/Vendor/Theme/composer.json
"name": "vendor/theme",
"description": "",
"require":
"php": "~5.5.0,
"suggest":
,
"type": "magento2-module",
"version": "0.1.0",
"license": [
],
"autoload":
"files": [
"registration.php"
],
"psr-4":
"Vendor\Theme\": ""
,
"extra":
"map": [
[
"*",
"Vendor/Theme"
]
]
app/code/Vendor/Theme/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Theme" setup_version="0.1.0">
</module>
</config>
app/code/Vendor/Theme/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoThemeModelViewDesign">
<arguments>
<argument name="themes" xsi:type="array">
<item name="adminhtml" xsi:type="string">Vendor/Theme</item>
</argument>
</arguments>
</type>
</config>
Now we have a custom adminhtml(backend) theme that overrides the Magento_Backend theme.
Here comes the magic:
The input template file for ui components is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
We copy it in a relative path in our custom theme:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/web/form/element/input.html
We modify the content into:
<!--Overrides: vendor/magento/module-ui/view/base/web/templates/form/element/input.html -->
<!-- ko if: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
"/>
<!--/ko-->
<!-- ko ifnot: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled,
maxlength: 255
"/>
<!-- /ko -->
As you can see here, we tell to knockoutjs to render the input without the maxlength condition only when the input name is "product[meta_keyword]" (thats our input we want)
else, we render the input normally to not do something we don't want to.
Now, we have to make our template override the Magento_Ui template file:
As we see in the Magento_Ui requirejs_config.js of base,
vendor/magento/module-ui/view/base/requirejs-config.js
There is a namespace for the template paths of the ui components:
....
paths:
'ui/template': 'Magento_Ui/templates'
,
....
That means all the templates paths that are from "Magento_Ui/templates" are replaced with "ui/template".
So, we create our requirejs_config.js:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/requirejs-config.js
var config =
map:
"*":
"ui/template/form/element/input": "Magento_Catalog/form/element/input"
;
Now clear the cache, clear the static files (or deploy them) and refresh the page, and you should see something like this:
This works for 2.3.1, and it should work for the lower versions
New contributor
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
add a comment |
After some debugging I found out that all inputs have 255 length limit and they all have the same template.
The limit is set by the html template itself (kinda hard-coded).
The file path is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
So we have to override it into a custom adminhtml theme.
Before you start, please replace the "Vendor" and "Theme" with your "Vendor" and "Module" names
If you do not have one:
Create the following files:
app/design/adminhtml/Vendor/Theme/composer.json
"name": "<vendor>/<theme>",
"description": "N/A",
"require":
"php": "~5.5.0,
"type": "magento2-theme",
"version": "1.0.0",
"license": [
],
"autoload":
"files": [
"registration.php"
]
app/design/adminhtml/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::THEME,
'adminhtml/<Vendor>/<Theme>',
__DIR__
);
app/design/adminhtml/Vendor/Theme/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Theme</title>
<parent>Magento/backend</parent>
</theme>
These are the theme files.
Now we have to create a custom module to make this work:
app/code/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Vendor_Theme',
__DIR__
);
app/code/Vendor/Theme/composer.json
"name": "vendor/theme",
"description": "",
"require":
"php": "~5.5.0,
"suggest":
,
"type": "magento2-module",
"version": "0.1.0",
"license": [
],
"autoload":
"files": [
"registration.php"
],
"psr-4":
"Vendor\Theme\": ""
,
"extra":
"map": [
[
"*",
"Vendor/Theme"
]
]
app/code/Vendor/Theme/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Theme" setup_version="0.1.0">
</module>
</config>
app/code/Vendor/Theme/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoThemeModelViewDesign">
<arguments>
<argument name="themes" xsi:type="array">
<item name="adminhtml" xsi:type="string">Vendor/Theme</item>
</argument>
</arguments>
</type>
</config>
Now we have a custom adminhtml(backend) theme that overrides the Magento_Backend theme.
Here comes the magic:
The input template file for ui components is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
We copy it in a relative path in our custom theme:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/web/form/element/input.html
We modify the content into:
<!--Overrides: vendor/magento/module-ui/view/base/web/templates/form/element/input.html -->
<!-- ko if: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
"/>
<!--/ko-->
<!-- ko ifnot: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled,
maxlength: 255
"/>
<!-- /ko -->
As you can see here, we tell to knockoutjs to render the input without the maxlength condition only when the input name is "product[meta_keyword]" (thats our input we want)
else, we render the input normally to not do something we don't want to.
Now, we have to make our template override the Magento_Ui template file:
As we see in the Magento_Ui requirejs_config.js of base,
vendor/magento/module-ui/view/base/requirejs-config.js
There is a namespace for the template paths of the ui components:
....
paths:
'ui/template': 'Magento_Ui/templates'
,
....
That means all the templates paths that are from "Magento_Ui/templates" are replaced with "ui/template".
So, we create our requirejs_config.js:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/requirejs-config.js
var config =
map:
"*":
"ui/template/form/element/input": "Magento_Catalog/form/element/input"
;
Now clear the cache, clear the static files (or deploy them) and refresh the page, and you should see something like this:
This works for 2.3.1, and it should work for the lower versions
New contributor
After some debugging I found out that all inputs have 255 length limit and they all have the same template.
The limit is set by the html template itself (kinda hard-coded).
The file path is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
So we have to override it into a custom adminhtml theme.
Before you start, please replace the "Vendor" and "Theme" with your "Vendor" and "Module" names
If you do not have one:
Create the following files:
app/design/adminhtml/Vendor/Theme/composer.json
"name": "<vendor>/<theme>",
"description": "N/A",
"require":
"php": "~5.5.0,
"type": "magento2-theme",
"version": "1.0.0",
"license": [
],
"autoload":
"files": [
"registration.php"
]
app/design/adminhtml/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::THEME,
'adminhtml/<Vendor>/<Theme>',
__DIR__
);
app/design/adminhtml/Vendor/Theme/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Theme</title>
<parent>Magento/backend</parent>
</theme>
These are the theme files.
Now we have to create a custom module to make this work:
app/code/Vendor/Theme/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Vendor_Theme',
__DIR__
);
app/code/Vendor/Theme/composer.json
"name": "vendor/theme",
"description": "",
"require":
"php": "~5.5.0,
"suggest":
,
"type": "magento2-module",
"version": "0.1.0",
"license": [
],
"autoload":
"files": [
"registration.php"
],
"psr-4":
"Vendor\Theme\": ""
,
"extra":
"map": [
[
"*",
"Vendor/Theme"
]
]
app/code/Vendor/Theme/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Theme" setup_version="0.1.0">
</module>
</config>
app/code/Vendor/Theme/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoThemeModelViewDesign">
<arguments>
<argument name="themes" xsi:type="array">
<item name="adminhtml" xsi:type="string">Vendor/Theme</item>
</argument>
</arguments>
</type>
</config>
Now we have a custom adminhtml(backend) theme that overrides the Magento_Backend theme.
Here comes the magic:
The input template file for ui components is:
vendor/magento/module-ui/view/base/web/templates/form/element/input.html
We copy it in a relative path in our custom theme:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/web/form/element/input.html
We modify the content into:
<!--Overrides: vendor/magento/module-ui/view/base/web/templates/form/element/input.html -->
<!-- ko if: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
"/>
<!--/ko-->
<!-- ko ifnot: inputName == "product[meta_keyword]" -->
<input class="admin__control-text" type="text"
data-bind="
event: change: userChanges,
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr:
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled,
maxlength: 255
"/>
<!-- /ko -->
As you can see here, we tell to knockoutjs to render the input without the maxlength condition only when the input name is "product[meta_keyword]" (thats our input we want)
else, we render the input normally to not do something we don't want to.
Now, we have to make our template override the Magento_Ui template file:
As we see in the Magento_Ui requirejs_config.js of base,
vendor/magento/module-ui/view/base/requirejs-config.js
There is a namespace for the template paths of the ui components:
....
paths:
'ui/template': 'Magento_Ui/templates'
,
....
That means all the templates paths that are from "Magento_Ui/templates" are replaced with "ui/template".
So, we create our requirejs_config.js:
app/design/adminhtml/Vendor/Theme/Magento_Catalog/requirejs-config.js
var config =
map:
"*":
"ui/template/form/element/input": "Magento_Catalog/form/element/input"
;
Now clear the cache, clear the static files (or deploy them) and refresh the page, and you should see something like this:
This works for 2.3.1, and it should work for the lower versions
New contributor
edited 2 hours ago
New contributor
answered 2 hours ago
LuciLuci
465
465
New contributor
New contributor
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
add a comment |
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
Excellent!! Thanks :)
– Jessy Loran
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
This should and will work for any type of html template override This is one method. There is another method to override the 'global' template by overriding it in the custom theme under its module directory path.
– Luci
1 hour ago
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269820%2fmagento-2-how-to-remove-character-limit-from-meta-keyword-field-in-product%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You have raised a good point, +1 for that
– Shoaib Munir
5 hours ago
You would possible need to update catalog_product_entity_varchar to change the value column to either a heigher number or to a text value with no limit
– Dava Gordon
4 hours ago
I wouldnt recommend adding no more than 10 keyword phrases to a product as they will just be ignored
– Dava Gordon
1 hour ago