Jump to content
Sign in to follow this  
muckster

Mangled Characters in Easy Populate

Recommended Posts

Hi,

 

I'm just getting started with EP, which seems very helpful. I am having good success adding products and no problems except for one field: my products_description is fairly long (about 130 lines) and involves a bunch of HTML, tables, etc. The code works fine when I insert it through the web interface, but when I paste it in excel and upload it through EP, some of the characters get mangled.

 

I found this in easypopulate.php:

 

// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = 0;

 

and I changed it to 0, but the characters still get mangled just the same.

 

For example:

 

<p><img src="../../images/shrinkfilm.jpg" width=?" height=?"

 

What am I doing wrong?

Share this post


Link to post
Share on other sites

I haven't been able to fix this -- I still get mangled characters although I turned the escape character conversion off. If anybody has an idea what else to try, I'd love to hear it. Do I have to simplify my HTML code until it works? I'm stuck. Thanks.

 

This is what I have:

 

// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = false;

Share this post


Link to post
Share on other sites

If I view source on the output, I get something like this:

 

        <p><p><span class="content">Dynaclear is a food approved PVC shrink-film, environmentally

        friendly that will not cause unwanted corrosion to your machinery. Dynaclear

        has high clarity and sparkle, high puncture resistance, memory, and excellent

        seal strength, making it excellent for all shrink packaging applications

        and ideal for display wrapping applications.</span></p>

      <p><img src="../../images/shrinkfilm.jpg" width=蘚" height=蕾" alt="PVC Shrink Wrap Film"></p>

    <p><span class="content">

Dynaclear DB series PVC is available in a wide range of characteristics -- low/high shrink percentage, as well as preferential shrink to suit the needs of the application and product to be packed. Available in centerfold or flat. Ideal for high speed equipment with excellent lay flat and for candle applications.

</span></p>

<table width=ඏ%" border=ŕ" bordercolor="#000000">

          <tr bgcolor="#006699">

 

That looks like the quotes did get converted, right? I don't know what else to do.

Share this post


Link to post
Share on other sites

Im having the exact same problem & as yet i have not been able to find a way around this bug. The program itself works quite well but surely this is a major design flaw. html content in product descriptions is common place isnt it?

Im also looking for info on how to add "product name" to the "model/price/qty" download as a work around instead of having to download the "complete" tab-delimited file, but i have a feeling you can only add new feilds from the "products" table.

 

Good luck!

Share this post


Link to post
Share on other sites

OK, after weeks of tearing out my hair, I finally managed to fix this. I still don't know how--but I kept playing with the replace_quotes variable until, somehow, it worked. Here's the code I'm currently using:

 

// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = false;

 

If there's a difference to what I had before, I don't see it. Combobulator, all I can recommend is messing with this, reuploading, and re-trying, until somehow it works. Good luck.

Share this post


Link to post
Share on other sites

In fact, I spoke to soon-- it's working on one OSC install, but the exact same easypopulate.php still messes up the HTML on my other store. If anybody with more php experience or any kind of help could weigh in, I'd appreciate it.

Share this post


Link to post
Share on other sites

sorry... it seems not to show correctly in the last post...

 

Let's go on:

 

add ; before every " and ' that you find in /admin/easypopulate.php file

Share this post


Link to post
Share on other sites

Thank you. I had pretty much given up hope to make this work, so I'm glad to get a response. Unfortunately, this doesn't fix it. My problem is that quotes are getting changed even when they're part of HTML tags -- width="50%" -- and adding the semi-colon won't fix that. I don't know why I can't turn off the conversion of quotes.

 

Anyway, thanks again for your help.

Share this post


Link to post
Share on other sites
// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = 0;

 

I am having this same problem.

 

I have messed around with it and cant get a change by doing anything with the code above. What I have to do it get rid of the width and hieght in my img tags or else it comes out chinese characters. Also the image tag repeats the url with an extra " in it.

 

To get around it, I have to delete any mention of widht and height tags and then upload. Then I go to the admin and update each and every item (admin, click like you are going to edit it the old way, the go to update and update the item but dont change anything) after that my html is sorta right.

 

anyone else have any ideas?? its like easy populate converts into the database wrong but updating it in oscommerce works to convert it and back?? wierd

Share this post


Link to post
Share on other sites

mike9999, easy populate is not your problem with the pasting of your description, it is a limitation with excel, it doesnt like that many characters. if you have 130 lines in a product description, i know i would not take the time to read it. but that is me. you will have to manually type in or cut and paste several times.


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

its not just 300 lines of text, its html. you dont have html in your product description??

 

The only problem I have with excel is the carriage returns in my html wrap to the next cell.

 

 

Easy populate doesnt do well with quotes on my install?? anyone else?

Share this post


Link to post
Share on other sites

Go to about line 1268:

 

Replace this:

________________________________________________________________

// now any remaining doubled double quotes should be converted to one doublequote

 

$items[$i] = str_replace('""',""",$items[$i]);

if ($replace_quotes){

$items[$i] = str_replace('""',""",$items[$i]);

$items[$i] = str_replace('"',""",$items[$i]);

$items[$i] = str_replace("'","'",$items[$i]);

}

_______________________________________________________________

 

With This:

_______________________________________________________________

// now any remaining doubled double quotes should be converted to one doublequote

 

 

if ($replace_quotes){

$items[$i] = str_replace('""',""",$items[$i]);

$items[$i] = str_replace('""',""",$items[$i]);

$items[$i] = str_replace('"',""",$items[$i]);

$items[$i] = str_replace("'","'",$items[$i]);

}

________________________________________________________

 

It did the trick for me..

Share this post


Link to post
Share on other sites

Thanks for your help, justfun. I tried to make the changes you suggest, but it's still not working--now my source code ends up with double quotes everywhere. It looks like this was a promising way to go about this, though -- or maybe I made the wrong changes? I replaced

 

// now any remaining doubled double quotes should be converted to one doublequote

 

$items[$i] = str_replace('""',""",$items[$i]);

if ($replace_quotes){

$items[$i] = str_replace('""',""",$items[$i]);

$items[$i] = str_replace('"',""",$items[$i]);

$items[$i] = str_replace("'","'",$items[$i]);

}

 

with this:

 

// now any remaining doubled double quotes should be converted to one doublequote

 

 

if ($replace_quotes){

$items[$i] = str_replace('""',""",$items[$i]);

$items[$i] = str_replace('"',""",$items[$i]);

$items[$i] = str_replace("'","'",$items[$i]);

}

 

Was that correct? If you or anybody else could shed some light on this, it would be much appreciated. It would be fantastic to finally get EP working properly. Thanks again.

Share this post


Link to post
Share on other sites

you can not use carriage returns at all in your description. you must use <br> because ep (actually any program using tab delimited) sees that as white space. you never stated that the first time around.

 

also, the post should be continued here, for others to see the answers.

 

http://forums.oscommerce.com/index.php?showtopic=64945


John Oligario

 

Knowledge Base Contributions

Share this post


Link to post
Share on other sites

Mibble,

thanks, but I'm not sure what you're telling me. My descriptions don't have carriage returns, as far as I can tell. They fit comfortably in an excel cell, and I use tables, p and br tags, but no carriage returns. What gave you that idea? As far as I can tell, the conversion of quotes are what causes the problem.

 

Also, I'm not sure why we should move the conversation to a 65+ page long catch-all thread, when we have this one, which is dedicated to this issue and has an appropriate subject line. Don't threads get bumped as soon as there is a response?

 

Thanks.

Share this post


Link to post
Share on other sites

Found a quick fix:

Set to False,

 

Replace with this:

 

// now any remaining doubled double quotes should be converted to one doublequote

$items[$i] = str_replace('""','"',$items[$i]);

if ($replace_quotes){

$items[$i] = str_replace('"',""",$items[$i]);

$items[$i] = str_replace("'","'",$items[$i]);

Edited by mcothmane

Share this post


Link to post
Share on other sites

I've been facing the same issue, and since this " ' problem does also affect Netscape (the " in the code become a %22), I've worked on my own solution:

 

In the easypopulate.php file I've made a few changes, and the places in the code that looked like this...

 

$items[$i] = str_replace('\"',""",$items[$i]);

 

... now look like this...

 

$items[$i] = str_replace('\"','\"',$items[$i]);

 

 

It is working fairly well for me now.

Edited by magicjebb

--

Fabian Balbinot

Share this post


Link to post
Share on other sites
in the contributions there is a little post on how to deal with the 34 39 issue

 

Finally.....

 

This one worked for me... thanks :)

I also want to thank the creators of this contrib, it saves me a lot of time...

 

greetz,

Compsolve

Share this post


Link to post
Share on other sites

First let me say HOWDY and thanks to anyone who can help. I posted this in it's own thread b4 I found this one, sorry.

I'm Using OsCommerce CartXpress. I've configured Easy Populate to upload all the fields necessary for a Product to show EXCEPT for ATTRIBUTES (still trying to figure this out since a lot of the products have at least 2 different drop downs with lengths in quarter inch increments in one , and half centimeter increments in another, not to mention 15 angle choices, Plus other options/attributes. TOO MANY for calc or excel. BUT this is a prollum fer anodder day)

 

I'm using Open Office Calc (the data looks clean) and Easy Populate. The Description Field is the problem. During upload of my EP file ALL the quotes in my description are converted to ". This breaks my STYLESHEET references (ie: <SPAN class="valueprice">Only: $174.95 each</SPAN>). I only have simple HTML couple <P tags and 1-2 stylesheet references

I found this part in easypopulate.php and changed it:

// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = false;

 

Seems to me, just setting it to False should turn off the replace_quotes function, but....

Still the same problem.

I can go to the ADMIN and open / edit the product description, replacing the 2 instances of " around valueprice and my stylesheet reference works. (3 added styles are in stylesheet.css)

I tried escaping the quotes on upload to (ie <SPAN class=\"valueprice\"> ) which also did not work. (I didn't think it would)

 

I see the code which finds quotes and changes them. I've read this forum, tried it all (or missed something??) AND the fix for me is not obvious: Here's the original code:

// make sure all non-set things are set to '';

// and strip the quotes from the start and end of the stings.

// escape any special chars for the database.

foreach( $filelayout as $key=> $value){

$i = $filelayout[$key];

if (isset($items[$i]) == false) {

$items[$i]='';

} else {

// Check to see if either of the magic_quotes are turned on or off;

// And apply filtering accordingly.

if (function_exists('ini_get')) {

//echo "Getting ready to check magic quotes<br>";

if (ini_get('magic_quotes_runtime') == 1){

// The magic_quotes_runtime are on, so lets account for them

// check if the last character is a quote;

// if it is, chop off the quotes.

if (substr($items[$i],-1) == '"'){

$items[$i] = substr($items[$i],2,strlen($items[$i])-4);

}

// now any remaining doubled double quotes should be converted to one doublequote

 

$items[$i] = str_replace('\"\"',""",$items[$i]);

if ($replace_quotes){

$items[$i] = str_replace('\"',""",$items[$i]);

$items[$i] = str_replace("\'","'",$items[$i]);

}

} else { // no magic_quotes are on

// check if the last character is a quote;

// if it is, chop off the 1st and last character of the string.

if (substr($items[$i],-1) == '"'){

$items[$i] = substr($items[$i],1,strlen($items[$i])-2);

}

// now any remaining doubled double quotes should be converted to one doublequote

$items[$i] = str_replace('""',""",$items[$i]);

if ($replace_quotes){

$items[$i] = str_replace('"',""",$items[$i]);

$items[$i] = str_replace("'","'",$items[$i]);

}

}

}

}

}

 

I'm really hoping I don't have to manually open every product through the ADMIN to fix this...

Actually , I'd probably do a Search and Replace for the broke code to my final MySql dump and re INSERT it, but it'd be nice for this to just upload simple HTML.

ANYONE know what needs to be done to the EP code so it works on the upload and can help me I'd be ever so grateful.

Thanks.

Walter

Share this post


Link to post
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
Sign in to follow this  

×