Precisely Enterworks

 View Only
Expand all | Collapse all

Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

  • 1.  Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 07-31-2020 18:09

    Hi All.

    I have been struggling with this for some time now. Every once in a while, a user will paste an empty paragraph with a space in between. This shows up in the HTML as:

    <p>&nbsp;</p>

    Creating a replaceAll command with REGEX has been challenging and I've not been successful in having the VTL recognize and remove this code. I would like to use a rule to remove this.

    Any ideas?

    Thanks in advance.



    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | \+1 480 596 9690
    ------------------------------


  • 2.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 08-14-2020 15:12
    One quick question on this, John...are you finding that the patern of paragraph/space is constantly changing and you're having trouble identifying the various forms it could be submitted? If so, let me refer this to the team and see if there are some ideas to resolve this for you.

    ------------------------------
    David Howard | Solution Engineer
    Winshuttle North America | 240-534-3511
    ------------------------------



  • 3.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 08-14-2020 19:47
    Hi David.

    I'm wondering if my VTL in 8.2 may have a problem. I've received responses outside of the community saying to simply place that code into a Replace or ReplaceAll command. Unfortunately, it's not working for me in Rules. I believe that it works in Syndication Templates. Perhaps I may need to open a Support ticket for this.

    Thanks,
    -Jon

    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 4.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Employee
    Posted 12-06-2020 23:52
    Jonathan,

    One option that becomes available if using the latest Services Framework (which requires EnterWorks 10.x) would be to define a Change Notification that uses a SQL-based REPLACE() function to remove the extraneous paragraphs.

    -Brian

    ------------------------------
    Brian Zupke | Senior Technical Support Engineer
    Winshuttle North America | 9099009179
    ------------------------------



  • 5.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 12-19-2020 12:05

    We're planning on upgrading this year, Brian. We may need to wait until we get the new framework in place before fixing this issue.



    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 6.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Employee
    Posted 01-16-2021 01:51
    Jon,

    You may be able to use the StringUtils class to perform stringSubstitution calls.  If you Google search on Apache Velocity 1.7 (the version being used by EnterWorks 8.2) and StringUtils, you should find the details on the methods that can be called.  This class would be invoked in the same way the MathTool class is invoked.

    -Brian

    ------------------------------
    Brian Zupke | Senior Technical Support Engineer
    Winshuttle North America | 9099009179
    ------------------------------



  • 7.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 04-01-2021 16:02
    I was able to get that to replace but I needed to use this:

    replaceAll('<p> </p>','')

    Very weird. And it leaves a carriage return in it's place. As a matter of fact, if I replace <ul>, <li>, and others, it leaves a carriage return too. Any way to have a null be a null using replaceAll?

    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 8.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 04-01-2021 19:31
    Here's what I'm running into:

    HTML-ENABLED TEXT THAT IS IN A COPY FIELD:
    <p>A nod to the early era of rock &lsquo;n&rsquo; roll, the <strong>G6119TG-62RW-LTD Limited Edition &lsquo;62 Rosewood Tenny with Bigsby&reg; and Gold Hardware </strong>is a solid performer with the standout sound and stunning style that have made Gretsch a household name. Highly resonant with rosewood top, back and sides, the unique voice of this guitar cuts through any mix, standing out from the crowd with That Great Gretsch Sound!&trade;</p>
    <p>A pair of rich-sounding TV Jones&reg; TV Classic&trade; humbucking pickups creates unmistakable vintage snap and guttural growl with lively response, reflecting the natural voice of the guitar. Parallel tone bars connect the top and back of this guitar for authentic vintage tone. Traditional Gretsch controls&mdash;individual pickup volume controls, master volume, standby switch and the classic three-position tone switch&mdash;allow you to blend and shape the pickups&rsquo; sound, creating countless tonal variations. With the new Gretsch &ldquo;Squeezebox&rdquo; paper-in-oil capacitors, you get incredibly silky vintage high end. A &ldquo;rocking&rdquo; bar bridge with pinned rosewood base reacts in tandem with the Bigsby B6 vibrato tailpiece for stable tuning while the vintage-style bone nut lets the strings slide freely without binding in the slots. The standard &ldquo;U&rdquo;-shaped maple neck bears a 12&rdquo;-radius rosewood fingerboard with 22 vintage small frets for a classic playing experience that works with any style.</p>
    <p>An exquisite instrument inspired by one of guitar&rsquo;s greatest eras, the <strong>G6119TG-62RW-</strong><strong>LTD Limited Edition &lsquo;62 Rosewood Tenny with Bigsby&reg; and Gold Hardware</strong> features the classic aesthetics true Gretsch fans love&mdash;gold G-arrow control knobs and Grover&reg; Sta-Tite&trade; open-back tuning machines, aged white binding with black purfling, aged pearloid Neo-Classic&trade; thumbnail inlays, rosewood headcap, durable gloss urethane finish and black pickguard with Gretsch logo.</p>
    <p>&nbsp;</p>
    <ul>
    <li>Fully hollow build with rosewood top, back and sides</li>
    <li>Rosewood headcap</li>
    <li>Set maple neck for effortless access and performance</li>
    <li>Aged white body binding with black purfling</li>
    <li>Simulated F-holes</li>
    <li>12&rdquo;-radius rosewood fingerboard with 22 vintage small frets and pearloid Neo-Classic&trade; thumbnail inlays</li>
    <li>TV Jones&reg; TV Classic&trade; humbucking pickups</li>
    <li>Master volume, individual pickup volume controls, standby switch and three-position master tone toggle switch</li>
    <li>Bigsby&reg; B6G vibrato tailpiece</li>
    <li>Rocking bar bridge with pinned rosewood base</li>
    <li>Bone nut</li>
    <li>Gold hardware</li>
    <li>Available in a Natural finish with matching headstock and black pickguard</li>
    </ul>

    I'M USING THIS VTL:
    #set($cr="\u000D")
    #set($sdn="${SKU_Staging.skuDisplayName}")
    #set($sdn=$sdn.replaceAll('\u00ae','').replaceAll('™',''))
    ##
    #set($prpcopy="${SkuList.PRP Copy}")
    #set($prpcopy=$prpcopy.replaceAll('&nbsp;','').replaceAll('<p> </p>','').replaceAll('<p>','').replaceAll('</p><p>',$cr).replaceAll('</p>','').replaceAll('<br /><br />',"<br />").replaceAll("<br />",$cr).replaceAll("<br>",$cr).replaceAll("</br>",'').replaceAll("<sup>","").replaceAll("</sup>","").replaceAll("</strong>","").replaceAll("<strong>","").replaceAll("</em>","").replaceAll("<em>","").replaceAll("<ul>","").replaceAll("</ul>","").replaceAll("<li>","• ").replaceAll('&bull;',"• ").replaceAll('&Prime;','"').replaceAll('&acute;',"'").replaceAll('&ldquo;','"').replaceAll('&lsquo;',"'").replaceAll('&rdquo;','"').replaceAll('&rsquo;',"'").replaceAll('&trade;','').replaceAll('&mdash;','-').replaceAll('&reg;',"").replaceAll("</li>","").replaceAll('&amp;',"&").replaceAll('&ndash;'," - ").replaceAll('&nbsp;','').replaceAll('<p></p>','').replaceAll("</li>",'').replaceAll("™",'').replaceAll('\u00ae','').trim())
    #set($tax="${SKU_Staging.Taxonomy.code}")
    #set($brand="${SkuList.Brand}")
    $sdn
    $cr$prpcopy.trim()

    NOTE: This command doesn't work: .replaceAll('&nbsp;',''). This does: .replaceAll('<p> </p>','')
    This may be because I'm on 8.2?

    THIS IS WHAT OUTPUTS:

    G6119TG-62RW-LTD Limited Edition '62 Rosewood Tenny with Bigsby and Gold Hardware, Rosewood Fingerboard, Natural

    A nod to the early era of rock 'n' roll, the G6119TG-62RW-LTD Limited Edition '62 Rosewood Tenny with Bigsby and Gold Hardware is a solid performer with the standout sound and stunning style that have made Gretsch a household name. Highly resonant with rosewood top, back and sides, the unique voice of this guitar cuts through any mix, standing out from the crowd with That Great Gretsch Sound!

    A pair of rich-sounding TV Jones TV Classic humbucking pickups creates unmistakable vintage snap and guttural growl with lively response, reflecting the natural voice of the guitar. Parallel tone bars connect the top and back of this guitar for authentic vintage tone. Traditional Gretsch controls-individual pickup volume controls, master volume, standby switch and the classic three-position tone switch-allow you to blend and shape the pickups' sound, creating countless tonal variations. With the new Gretsch "Squeezebox" paper-in-oil capacitors, you get incredibly silky vintage high end. A "rocking" bar bridge with pinned rosewood base reacts in tandem with the Bigsby B6 vibrato tailpiece for stable tuning while the vintage-style bone nut lets the strings slide freely without binding in the slots. The standard "U"-shaped maple neck bears a 12"-radius rosewood fingerboard with 22 vintage small frets for a classic playing experience that works with any style.

    An exquisite instrument inspired by one of guitar's greatest eras, the G6119TG-62RW-LTD Limited Edition '62 Rosewood Tenny with Bigsby and Gold Hardware features the classic aesthetics true Gretsch fans love-gold G-arrow control knobs and Grover Sta-Tite open-back tuning machines, aged white binding with black purfling, aged pearloid Neo-Classic thumbnail inlays, rosewood headcap, durable gloss urethane finish and black pickguard with Gretsch logo.





    • Fully hollow build with rosewood top, back and sides

    • Rosewood headcap

    • Set maple neck for effortless access and performance

    • Aged white body binding with black purfling

    • Simulated F-holes

    • 12"-radius rosewood fingerboard with 22 vintage small frets and pearloid Neo-Classic thumbnail inlays

    • TV Jones TV Classic humbucking pickups

    • Master volume, individual pickup volume controls, standby switch and three-position master tone toggle switch

    • Bigsby B6G vibrato tailpiece

    • Rocking bar bridge with pinned rosewood base

    • Bone nut

    • Gold hardware

    • Available in a Natural finish with matching headstock and black pickguard


    Notice the five lines in the output in between the paragraphs and the unordered list; as well as the lines in between each <LI> in the list.
    How can I get rid of those?

    Thanks!


    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 9.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Employee
    Posted 04-13-2021 05:08
    Jon,

    VTL populates the target attribute with whatever is specified in the line, including the newline character.  So if a line has a newline character that is not a comment, it will be included in the output value.  To avoid this, end each line with a comment, which is denoted by two pound/hashtag symbols.  For example:

    #set($tax="${SKU_Staging.Taxonomy.code}")##
    #set($brand="${SkuList.Brand}")##
    $sdn##
    $cr$prpcopy.trim()##

    The comment tells VTL to ignore the rest of the line, including the newline character.

    While it makes the VTL a little harder to read, it should eliminate the problem.

    -Brian


    ------------------------------
    Brian Zupke | Senior Technical Support Engineer
    Winshuttle North America | 9099009179
    ------------------------------



  • 10.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 04-15-2021 11:59
    As always... thanks Brian!

    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 11.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 04-15-2021 13:18
    @Brian Zupke... any ideas on how to get rid of the new line for this though?

    <ul>
    <li>Fully hollow build with rosewood top, back and sides</li>
    <li>Rosewood headcap</li>
    <li>Set maple neck for effortless access and performance</li>
    <li>Aged white body binding with black purfling</li>
    <li>Simulated F-holes</li>
    <li>12&rdquo;-radius rosewood fingerboard with 22 vintage small frets and pearloid Neo-Classic&trade; thumbnail inlays</li>
    <li>TV Jones&reg; TV Classic&trade; humbucking pickups</li>
    <li>Master volume, individual pickup volume controls, standby switch and three-position master tone toggle switch</li>
    <li>Bigsby&reg; B6G vibrato tailpiece</li>
    <li>Rocking bar bridge with pinned rosewood base</li>
    <li>Bone nut</li>
    <li>Gold hardware</li>
    <li>Available in a Natural finish with matching headstock and black pickguard</li>
    </ul>

    EXPORTS AS:

    • Fully hollow build with rosewood top, back and sides

    • Rosewood headcap

    • Set maple neck for effortless access and performance

    • Aged white body binding with black purfling

    • Simulated F-holes

    • 12"-radius rosewood fingerboard with 22 vintage small frets and pearloid Neo-Classic thumbnail inlays

    • TV Jones TV Classic humbucking pickups

    • Master volume, individual pickup volume controls, standby switch and three-position master tone toggle switch

    • Bigsby B6G vibrato tailpiece

    • Rocking bar bridge with pinned rosewood base

    • Bone nut

    • Gold hardware

    • Available in a Natural finish with matching headstock and black pickguard

    Thanks!
    -Jon​

    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 12.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Employee
    Posted 04-16-2021 02:12
    Jon,

    Do you mean the blank line between the bullets?

    -Brian

    ------------------------------
    Brian Zupke | Senior Technical Support Engineer
    Winshuttle North America | 9099009179
    ------------------------------



  • 13.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 04-16-2021 15:53
    Hi Brian,

    Sorry! Yes... the spaces in between the unordered list items is something that I can't seem to remove.

    Thanks,
    -Jon

    ------------------------------
    Jonathan Varo | PIM Lead
    Fender Musical Instruments | 480-845-5823
    ------------------------------



  • 14.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Employee
    Posted 04-24-2021 16:17
    Jon,

    Where are you seeing the line breaks?  it may be an issue with whatever tool/application you are using to examine the results of the export.  Normally, actual line breaks in an HTML value are ignored as white space so the <li> tags would be the only thing that causes line breaks in the output.  But if the tool is honoring actual line breaks, then they are probably coming from the fact that the value as each <li> tag on a separate line.  I copied the HTML in your last post and saved it in an .html file and opened it in a browser and did not see any extra lines.

    You may want to conduct a test and have the values listed without the formatting.  For example:

    <ul><li>Fully hollow build with rosewood top, back and sides</li><li>Rosewood headcap</li><li>Set maple neck for effortless access and performance</li>

    etc...

    -Brian


    ------------------------------
    Brian Zupke | Senior Technical Support Engineer
    Winshuttle North America |
    ------------------------------



  • 15.  RE: Help Needed To Remove Spaces Surrounded By Paragraph Tags from HTML Enhanced Field In PIM

    Posted 02-02-2023 15:18
    Just wanted to follow up.

    In addition to extra spaces, there are always excess HTML code in the copy fields that is copied from a users rich text editor. I wrote this SQL query to find all offending code and will be splitting it up into rules in PIM to not allow formatting of any kind. This will allow the PIM to never send unwanted formatting to any connected systems or exports.

    You'll notice that I've even programmed in exceptions as well for coding that we DO want in there.

    The copy fields that we use are:
    PDP_Web_Description
    PRP_Description
    PRP_Copy
    Feature_Bullets
    priceListText

    My specific fields be italicized in my code below so that you can identify where to put your fields, if using this code snippet. I've also colored each type of code to be identified.

    "&nbsp" = Green
    "style =" = Blue
    "class =" = Red
    "<div"     = Burgundy
    "<br /><br />" = Purple

    Here is the SQL that I have been using to find these offending code entries:

    SELECT DISTINCT p.productNo

    FROM Product_Staging p

    WHERE p.PDP_Web_Description LIKE '%&nbsp%'

    OR p.PRP_Description LIKE '%&nbsp%'

    OR p.PRP_Copy LIKE '%&nbsp%'

    OR p.Feature_Bullets LIKE '%&nbsp%'

    OR p.priceListText LIKE '%&nbsp%'

    OR (p.PDP_Web_Description LIKE '%style=%' AND p.PDP_Web_Description NOT LIKE '%style="list-style-type: none;"%')

    OR (p.PRP_Description LIKE '%style=%' AND p.PRP_Description NOT LIKE '%style="list-style-type: none;"%')

    OR (p.PRP_Copy LIKE '%style=%' AND p.PRP_Copy NOT LIKE '%style="list-style-type: none;"%')

    OR (p.Feature_Bullets LIKE '%style=%' AND p.Feature_Bullets NOT LIKE '%style="list-style-type: none;"%' AND p.Feature_Bullets NOT LIKE '%<span style="text-decoration: underline;">%')

    OR (p.priceListText LIKE '%style=%' AND p.priceListText NOT LIKE '%style="list-style-type: none;"%')

    OR p.PDP_Web_Description LIKE '%class=%'

    OR p.PRP_Description LIKE '%class=%'

    OR p.PRP_Copy LIKE '%class=%'

    OR p.Feature_Bullets LIKE '%<class=%'

    OR p.priceListText LIKE '%class=%'

    OR p.PDP_Web_Description LIKE '%<div%'

    OR p.PRP_Description LIKE '%<div%'

    OR p.PRP_Copy LIKE '%<div%'

    OR p.Feature_Bullets LIKE '%<div%'

    OR p.priceListText LIKE '%<div%'

    OR p.PDP_Web_Description LIKE '%<br /><br />%'

    OR p.PRP_Description LIKE '%<br /><br />%'

    OR p.PRP_Copy LIKE '%<br /><br />%'

    OR p.Feature_Bullets LIKE '%<br /><br />%'

    OR p.priceListText LIKE '%<br /><br />%'

    ORDER BY p.productNo;


    Hope that this helps!

    Best,
    -Jon

    ------------------------------
    Jon Varo | Manager - Master Data and PIM Teams
    Fender Musical Instruments Corporation | (480) 845-5823
    ------------------------------