How to remove tags from short description programmatically in Magento 2?Description & Short description not updatingMove short description below page product detail title via XMLMagento 2: move the javascript to the end of the bodyShort Description / Description field, import Custom Attribute fieldRemove width=“” and height=“” from product imagesMagento 2 Product Short Description Truncate?Customize and override default magento meta tags in <head> for better SEOHow to set product Limit in cms page in Magento 1add product title into product tabsMagento 2 Configurable product radio button after need to short description show
Explicit song lyrics checker
TV show starring two men who develop various gadgets
In the US, can a former president run again?
Can a character with the Polearm Master feat make an opportunity attack against an invisible creature that enters their reach?
Is using Legacy mode is a bad thing to do?
Fibonacci sequence and other metallic sequences emerged in the form of fractions
How do I become a better writer when I hate reading?
I just entered the USA without passport control at Atlanta airport
Fill the maze with a wall-following Snake until it gets stuck
First occurrence in the Sixers sequence
...and then she held the gun
Regex version of strip() - Ch. 7 Automate the Boring Stuff
How can I ping multiple IP addresses at the same time?
Are there foreign customs agents on US soil?
Is this broken pipe the reason my freezer is not working? Can it be fixed?
How to sort human readable size
Are there any individual aliens that have gained superpowers in the Marvel universe?
Does knowing the surface area of all faces uniquely determine a tetrahedron?
Would a 7805 5v regulator drain a 9v battery?
How did the European Union reach the figure of 3% as a maximum allowed deficit?
Why can't I craft scaffolding in Minecraft 1.14?
Justifying Affordable Bespoke Spaceships
Right indicator flash-frequency has increased and rear-right bulb is out
What are the mechanical differences between Adapt and Monstrosity?
How to remove
tags from short description programmatically in Magento 2?
Description & Short description not updatingMove short description below page product detail title via XMLMagento 2: move the javascript to the end of the bodyShort Description / Description field, import Custom Attribute fieldRemove width=“” and height=“” from product imagesMagento 2 Product Short Description Truncate?Customize and override default magento meta tags in <head> for better SEOHow to set product Limit in cms page in Magento 1add product title into product tabsMagento 2 Configurable product radio button after need to short description show
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am using Magento 2.3.1
I have 8000 products which are migrated from Magento 1. The issue is that the
tags are added in short and long description in Magento 2. Please see below content for reference:
This is how short description looks like in the front end. Below content is added in the product in admin:
This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>
I have used the below code:
<?php
$short_description = strip_tags( $short_description, 'li' );
$short_description = "<ul><li>" . preg_replace( '/[rn]+/', '</li><li>',
$short_description ) . "</li></ul>";
$short_description = str_replace('<li></li>', '', $short_description );
?>
<?= $short_description ?>
But the whole content is displayed in one <li>
tag after implementing the above code.
Now I want to add each bullet points in <li>
tags and also I want to remove <br>
tag from the content as well. how can I do this?
magento2 product product-attribute
add a comment |
I am using Magento 2.3.1
I have 8000 products which are migrated from Magento 1. The issue is that the
tags are added in short and long description in Magento 2. Please see below content for reference:
This is how short description looks like in the front end. Below content is added in the product in admin:
This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>
I have used the below code:
<?php
$short_description = strip_tags( $short_description, 'li' );
$short_description = "<ul><li>" . preg_replace( '/[rn]+/', '</li><li>',
$short_description ) . "</li></ul>";
$short_description = str_replace('<li></li>', '', $short_description );
?>
<?= $short_description ?>
But the whole content is displayed in one <li>
tag after implementing the above code.
Now I want to add each bullet points in <li>
tags and also I want to remove <br>
tag from the content as well. how can I do this?
magento2 product product-attribute
1
why are you remove<ul>
<li>
&<br>
tag? If you are using editor in admin then you can get save formate value in frontend using function.$block->filterOutputHtml('yout field_name')
– Chirag Patel
Jun 10 at 8:28
add a comment |
I am using Magento 2.3.1
I have 8000 products which are migrated from Magento 1. The issue is that the
tags are added in short and long description in Magento 2. Please see below content for reference:
This is how short description looks like in the front end. Below content is added in the product in admin:
This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>
I have used the below code:
<?php
$short_description = strip_tags( $short_description, 'li' );
$short_description = "<ul><li>" . preg_replace( '/[rn]+/', '</li><li>',
$short_description ) . "</li></ul>";
$short_description = str_replace('<li></li>', '', $short_description );
?>
<?= $short_description ?>
But the whole content is displayed in one <li>
tag after implementing the above code.
Now I want to add each bullet points in <li>
tags and also I want to remove <br>
tag from the content as well. how can I do this?
magento2 product product-attribute
I am using Magento 2.3.1
I have 8000 products which are migrated from Magento 1. The issue is that the
tags are added in short and long description in Magento 2. Please see below content for reference:
This is how short description looks like in the front end. Below content is added in the product in admin:
This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>
I have used the below code:
<?php
$short_description = strip_tags( $short_description, 'li' );
$short_description = "<ul><li>" . preg_replace( '/[rn]+/', '</li><li>',
$short_description ) . "</li></ul>";
$short_description = str_replace('<li></li>', '', $short_description );
?>
<?= $short_description ?>
But the whole content is displayed in one <li>
tag after implementing the above code.
Now I want to add each bullet points in <li>
tags and also I want to remove <br>
tag from the content as well. how can I do this?
magento2 product product-attribute
magento2 product product-attribute
asked Jun 10 at 6:56
Chintan KaneriyaChintan Kaneriya
413214
413214
1
why are you remove<ul>
<li>
&<br>
tag? If you are using editor in admin then you can get save formate value in frontend using function.$block->filterOutputHtml('yout field_name')
– Chirag Patel
Jun 10 at 8:28
add a comment |
1
why are you remove<ul>
<li>
&<br>
tag? If you are using editor in admin then you can get save formate value in frontend using function.$block->filterOutputHtml('yout field_name')
– Chirag Patel
Jun 10 at 8:28
1
1
why are you remove
<ul>
<li>
& <br>
tag? If you are using editor in admin then you can get save formate value in frontend using function. $block->filterOutputHtml('yout field_name')
– Chirag Patel
Jun 10 at 8:28
why are you remove
<ul>
<li>
& <br>
tag? If you are using editor in admin then you can get save formate value in frontend using function. $block->filterOutputHtml('yout field_name')
– Chirag Patel
Jun 10 at 8:28
add a comment |
1 Answer
1
active
oldest
votes
<?php
$short_description= "This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>";
$strArray = explode('•',$short_description);
$newShortDescription = strip_tags($strArray[0]);
$newShortDescription .="<ul>";
for($i=1; $i<count($strArray);$i++)
$newShortDescription .="<li>".strip_tags($strArray[$i])."</li>";
$newShortDescription .="</ul>";
?>
<?= $newShortDescription ?>
New contributor
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%2f277766%2fhow-to-remove-br-tags-from-short-description-programmatically-in-magento-2%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
<?php
$short_description= "This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>";
$strArray = explode('•',$short_description);
$newShortDescription = strip_tags($strArray[0]);
$newShortDescription .="<ul>";
for($i=1; $i<count($strArray);$i++)
$newShortDescription .="<li>".strip_tags($strArray[$i])."</li>";
$newShortDescription .="</ul>";
?>
<?= $newShortDescription ?>
New contributor
add a comment |
<?php
$short_description= "This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>";
$strArray = explode('•',$short_description);
$newShortDescription = strip_tags($strArray[0]);
$newShortDescription .="<ul>";
for($i=1; $i<count($strArray);$i++)
$newShortDescription .="<li>".strip_tags($strArray[$i])."</li>";
$newShortDescription .="</ul>";
?>
<?= $newShortDescription ?>
New contributor
add a comment |
<?php
$short_description= "This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>";
$strArray = explode('•',$short_description);
$newShortDescription = strip_tags($strArray[0]);
$newShortDescription .="<ul>";
for($i=1; $i<count($strArray);$i++)
$newShortDescription .="<li>".strip_tags($strArray[$i])."</li>";
$newShortDescription .="</ul>";
?>
<?= $newShortDescription ?>
New contributor
<?php
$short_description= "This is the short description migrated from Magento 1<br><br>short description<br><br>• This is the point 1<br>• This is the point 2<br>• This is the point 3<br>• This is the point 4<br>• This is the point 5<br>•<b>This is the point 6</b>";
$strArray = explode('•',$short_description);
$newShortDescription = strip_tags($strArray[0]);
$newShortDescription .="<ul>";
for($i=1; $i<count($strArray);$i++)
$newShortDescription .="<li>".strip_tags($strArray[$i])."</li>";
$newShortDescription .="</ul>";
?>
<?= $newShortDescription ?>
New contributor
New contributor
answered Jun 10 at 8:16
Abdul PathanAbdul Pathan
513
513
New contributor
New contributor
add a comment |
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%2f277766%2fhow-to-remove-br-tags-from-short-description-programmatically-in-magento-2%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
why are you remove
<ul>
<li>
&<br>
tag? If you are using editor in admin then you can get save formate value in frontend using function.$block->filterOutputHtml('yout field_name')
– Chirag Patel
Jun 10 at 8:28