Announcement

Collapse
No announcement yet.

Rich Text Editor Nightmare - Options?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Rich Text Editor Nightmare - Options?

    I am working with a site that needs to be able to modify product descriptions via an export file. Unfortunately, they have copied formatted text from Word and pasted it into the rich text editor, and now the source code of the descriptions is full of MS Office encoding and it is breaking the export file in a big way.

    Are there any options for fixing this short of going in and recoding the messed up descriptions? The site has 2,300 products, and the export file is 19,000 lines long.

    #2
    Originally posted by Leanne View Post
    I am working with a site that needs to be able to modify product descriptions via an export file. Unfortunately, they have copied formatted text from Word and pasted it into the rich text editor, and now the source code of the descriptions is full of MS Office encoding and it is breaking the export file in a big way.

    Are there any options for fixing this short of going in and recoding the messed up descriptions? The site has 2,300 products, and the export file is 19,000 lines long.
    OMG - or for a site that uses Microsoft Expressions, then copy & pastes from <html> to </html> into the Product Description field.
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    Comment


      #3
      Here's a thought:

      Create or use the existing Product List page.

      In the product loop for that page, output product_code, product_name, and then

      Code:
       
       <mvt:assign name="g.allowed_tags" value="''" /> <mvt:eval expr="miva_html_strip( l.settings:product:descrip, g.allowed_tags )" />
      You should be able to use that output as product import file. You might use the "allowed" tags to preserve <p> or <h1>, but seeing how its MS:Office HTML, probably wont help much.
      Bruce Golub
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
      phosphormedia.com

      Comment


        #4
        I was hoping you'd chime in, you always have good ideas. I may try that. Unfortunately, all of the product descriptions have <p> <b> and <ul> and<li> tags in them that will have to be put back in so I'm not sure how much time it would save.

        Comment


          #5
          Can the method be used to strip "stuff" out from inside a tag? MS Expressions attempts to build using classes inside things like the <p> <ul> and <li> tags.
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment


            #6
            Originally posted by Leanne View Post
            I was hoping you'd chime in, you always have good ideas. I may try that. Unfortunately, all of the product descriptions have <p> <b> and <ul> and<li> tags in them that will have to be put back in so I'm not sure how much time it would save.
            Well, it should get rid of quite a bit of code bloat...you can add p, ul, li, etc to the allowed tags, then perhaps create your own 'parser' (to go with what Leslie was suggesting) to remove all 'style' attributes.

            It might be tricky...but it's doable. Or you could try running the results through something like this:

            https://html-cleaner.com/features/re...inline-styles/

            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


              #7
              With 2300 descriptions to fix, even at just one minute per product, that's almost 40 hours of someone's time. It might be worthwhile to have a custom script written that can do them all with a few clicks. Depending on the specifics of what you need removed or replaced, it could be a huge time saver. If you're interested, you can drop me a line by email, and send me a sample of the text.

              Thanks --
              Kent Multer
              Magic Metal Productions
              http://TheMagicM.com
              * Web developer/designer
              * E-commerce and Miva
              * Author, The Official Miva Web Scripting Book -- available on-line:
              http://www.amazon.com/exec/obidos/IS...icmetalproducA

              Comment


                #8
                So Bruce's solution is very close to brilliant and allows me to keep the basic html*, but I've been beating my head against the wall trying to remove the line breaks from the descriptions so that with no success. I have searched all over trying to find a solution and nothing I have tried is working. I can't import the results into Excel with the existing line breaks. I'm sure it's something simple but I've been fighting with this site all day and my brain is dead. Any help is appreciated.

                Kent, fortunately only later-added products are affected, and that 2300 number includes product variants and other inactive products so it's not quite at that scope, but you make an excellent point. I will definitely be in touch if needed.

                *But I am now discovering that some of the crap code is making its way through. Urgh.

                Comment


                  #9
                  Is it showing up as:
                  Code:
                  \r\n
                  Last edited by lesliekirk; 05-02-19, 03:41 AM.
                  Leslie Kirk
                  Miva Certified Developer
                  Miva Merchant Specialist since 1997
                  Previously of Webs Your Way
                  (aka Leslie Nord leslienord)

                  Email me: [email protected]
                  www.lesliekirk.com

                  Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                  Comment


                    #10
                    Originally posted by Leanne View Post
                    So Bruce's solution is very close to brilliant and allows me to keep the basic html*, but I've been beating my head against the wall trying to remove the line breaks from the descriptions so that with no success.

                    Which suggestion worked for you? https://html-cleaner.com/ or

                    Create or use the existing Product List page.

                    In the product loop for that page, output product_code, product_name, and then

                    Code:
                    <mvt:assign name="g.allowed_tags" value="''" /> <mvt:eval expr="miva_html_strip( l.settings:product:descrip, g.allowed_tags )" />
                    Leslie Kirk
                    Miva Certified Developer
                    Miva Merchant Specialist since 1997
                    Previously of Webs Your Way
                    (aka Leslie Nord leslienord)

                    Email me: [email protected]
                    www.lesliekirk.com

                    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                    Comment


                      #11
                      Originally posted by Kent Multer View Post
                      With 2300 descriptions to fix, even at just one minute per product, that's almost 40 hours of someone's time. It might be worthwhile to have a custom script written that can do them all with a few clicks. Depending on the specifics of what you need removed or replaced, it could be a huge time saver. If you're interested, you can drop me a line by email, and send me a sample of the text.

                      Thanks --
                      I'll drop you a line. My problem is there is no consistency to the usage of HTML in the product description. Some descriptions have a complete HTML page pasted in the field. Others start with just <style> ... </style> that was created by MS Expressions. Some of the HTML is as old as FrontPage. Then there is a ton of inline styling. I'll send you samples. - Leslie
                      Leslie Kirk
                      Miva Certified Developer
                      Miva Merchant Specialist since 1997
                      Previously of Webs Your Way
                      (aka Leslie Nord leslienord)

                      Email me: [email protected]
                      www.lesliekirk.com

                      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                      Comment


                        #12
                        I think I've run into this before. And ideally, I think the RTE wants UTF8 encoding.

                        So the export is breaking because of the line feeds? If that isn't it, I don't understand how the exported file is broken.

                        Assuming my "assumption" the copying from Word seems to be the problem. Isn't there a way in word save the file into another format, that also saves the content with UTF8 encoding? This is how I think the formatting will be preserved and entities like linefeeds won't be interpreted literally.

                        It's possible that the content from Word simply needs to be read into a different app like a spreadsheet that could interpret the formatting and encode it correctly in that app.

                        I can't be exact for the steps to take, I'm not a Word guru. But this seems like it will be worth a try before trying to code/script a band-aid on a gash that really needs stitches.

                        Scott
                        Need to offer Shipping Insurance?
                        Interactive Design Solutions https://www.myids.net
                        MivaMerchant Business Partner | Certified MivaMerchant Web Developer
                        Competitive Rates, Custom Modules and Integrations, Store Integration
                        AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
                        My T-shirt Collection is mostly MivaCon T-shirts!!

                        Comment


                          #13
                          Once you find a solution, please post same here, I have a similar problem with over 10K products.
                          Thank you, Bill Davis

                          Comment


                            #14
                            Originally posted by lesliekirk View Post


                            Which suggestion worked for you? https://html-cleaner.com/ or

                            It was the PLST page idea. There is still MS Office encoding coming through, but it's significantly cleaned up, and seems to follow a pattern that I could search and replace for if I could get the content nicely into a spreadsheet, but the line breaks are messing me up.

                            Comment


                              #15
                              The way i've solved line breaks in the past is pasting the offending column into a text editor and changing the character Encoding until they disappear (not very eloquent, but it works when you don't know what the line break encoding is.)

                              You could try using:

                              <mvt:assign name="g.thisDescription" value="glosub(l.settings:product:descrip, asciichar(10), '')" />
                              <mvt:assign name="g.thisDescription" value="glosub(g.thisDescription, asciichar(11), '')" />
                              <mvt:assign name="g.thisDescription" value="glosub(g.thisDescription, asciichar(12), '')" />
                              <mvt:assign name="g.thisDescription" value="glosub(g.thisDescription, asciichar(13), '')" />

                              <mvt:assign name="g.thisDescription" value="glosub(g.thisDescription, '\r', '')" />
                              <mvt:assign name="g.thisDescription" value="glosub(g.thisDescription, '\n', '')" />

                              &mvt:global:thisDescription;

                              <mvt:assign name="g.thisDescription" value="''" />
                              Bruce Golub
                              Phosphor Media - "Your Success is our Business"

                              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                              phosphormedia.com

                              Comment

                              Working...
                              X