Jump to content

dreamscape

Members
  • Content count

    1,499
  • Joined

  • Last visited

Everything posted by dreamscape

  1. http://forums.oscommerce.com/viewtopic.php?t=27991
  2. yeah... I've got mine adjusted for magic quotes and it works wonderful now (see the fix code I wrote)... I don't know if OSC requires magic quotes or not, but when I installed it gave me the error "magic quotes are turned off"... that might just be for the install... yeah an if statement to check if they are turned on or off and then use the appropirate "clean-up" code would make it more universal... in the mean time, I'll sit here and mull over why if I delete the default categories & products that come with OSC, my database gums up.
  3. did some research on PHP.net and found out some stuff... OSC requires that magic_quotes be enabled in PHP.ini... so with magic quotes enabled, any info passed through PHP is automatically backslashed if needed.... here is my fix for the double quotes with magic_quotes enabled... tested it and it works great! // fix for magic_quotes // check if the last character is a quote; // if it is, chop off the 1st two and last two characters of the string. 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]); //get rid of those quadrouple quotes $items[$i] = str_replace('"',""",$items[$i]); //replace any double quotes with their char code $items[$i] = str_replace("'",''',$items[$i]); //replace apostrophes with their char code since magic quotes is enabled, when the script gets the fields, the slashes are already there, so I just changed it to look for a quote as the last character and if its there, cut off the 1st two (/") and last two (/") characters of the string... then I just changed the str_replace to account for the slashes that magic_quotes inserted and replace the quadrople & double quotes & apostrophes with their character codes to ensure compadibility with every part of OSC.
  4. thanks wasson... it is working now, though on line 440, I had to change "$max_manufacturers_id" to the new "$max_mfg_id" string. other than that it works great.... but those darn excell double qoutes... the code doesn't allow them to pass through (SQL syntax error), but if you change the $items[$i] = substr($items[$i],1,strlen($items[$i])-1); to something like the length-20 instead of one, it allows it pass through to the database... Now here is the part I don't get (maybe cause I am not that great with PHP)... when you goto look at that product in the database, the double quotes are still around the description (even though we told it to strip off some characters... 20 in my test case!), and the quadruple quotes are still there (even though we told it to change all cases of them to normal double quotes)... example: the description in the Excell cell is: This is my "great" description. in the exported file it shows as: "This is my ""great"" description." the new code doesn't allow this to pass through to the database, but just for a test I changed the end to -20 instead of -1... It now passes to the database. Pull up the product desctription and I expect to see: This is my "great" description. But instead see: "This is my ""great"" description." over at PHP.net in the manual there is a note on str_replace that states it may not work with strings longer than 329 characters. that would explain why the quadrouple quote wasn't changed... but I don't get why the start and end quotes weren't stripped off when they were passed to the database.
  5. yes fixed those two, but now an even bigger problem exsits... on upload of file, it shows all went well -------------------------------------------------------------------- File uploaded. Temporary filename: C:PHPuploadtempphp42E.tmp User filename: EP_Split1.csv Size: 30739 1 | BFAICOL.gi | BFAICOL | Fairies & | A merry wo | 1.5 | 0 | 11/22/2002 | 100 | Books | Angels, De | Marty Nobl | !New Product!1 | Bfaichi.gi | BFAICHI | Fairy' | Wandering | 19.95 | 0 | 11/22/2002 | 100 | Books | Angels, De | | !New Product!1 | BFAIFUN.gi | BFAIFUN | Fairies Fu | A gift set | 13.5 | 0 | 11/22/2002 | 100 | Books | Angels, De | Marty Nobl | !New Product!1 | BFAIIRO.gi | BFAIIRO | Fairies & | Ethereal f | 3.95 | 0 | 11/22/2002 | 100 | Books | Angels, De | Marty Nobl | !New Product!1 | BFAISTI.gi | BFAISTI | Fairyland | With this | 1.5 | 0 | 11/22/2002 | 100 | Books | Angels, De | Marty Nobl | !New Product!1 | BFAEDES.gi | BFAEDES | Faeries by | Faeries ex | 19.95 | 0 | 11/22/2002 | 100 | Books | Angels, De | | !New Product!1 | BFAITAL.gi | BFAITAL | Fairy Tale | Heres a wo | 1.5 | 0 | 11/23/2002 | 100 | Books | Angels, De | Carolyn Ew | !New Product!1 | BFAITAT.gi | BFAITAT | Fairies & | Get ready | 1.5 | 0 | 11/23/2002 | 100 | Books | Angels, De | Marty Nobl | !New Product!1 | BFINFAI.gi | BFINFAI | Finding Fa | Finding Fa | 17.95 | 0 | 11/23/2002 | 100 | Books | Angels, De | | !New Product!1 | BFAIRIE1.g | BFAIRIE1 | Fairies, T | This is an | 19.95 | 0 | 11/23/2002 | 100 | Books | Angels, De | Suza Scalo | !New Product!1 | BFLOBOO.gi | BFLOBOO | Flower Fai | These ench | 1.5 | 0 | 11/23/2002 | 100 | Books | Angels, De | Marty Nobl | !New Product!1 | BFLOCOL0KI | BFLOCOL0KI | Flower & F | Children w | 3.5 | 0 | 11/23/2002 | 100 | Books | Angels, De | Darcey May | !New Product!1 | BFLOSTI.gi | BFLOSTI | Flower Fai | This engag | 1.5 | 0 | 11/23/2002 | 100 | Books | Angels, De | Darcey May | !New Product!1 | BGOOFAE.gi | BGOOFAE | Good Faeri | In this ri | 30 | 0 | 11/23/2002 | 100 | Books | Angels, De | Brian Frou | !New Product!1 | BGREENC.gi | BGREENC | Great Ency | Sirens and | 25 | 0 | 11/23/2002 | 100 | Books | Angels, De | Pierre Dub | !New Product!1 | BMAGARC.gi | BMAGARC | Magic of t | What the a | 4.25 | 0 | 11/23/2002 | 100 | Books | Angels, De | Chris Jone | !New Product!1 | BMIDNIG.gi | BMIDNIG | Midsummer | It is Mids | 18 | 0 | 11/23/2002 | 100 | Books | Angels, De | Terri Wind | !New Product!1 | BPREFAI.gi | BPREFAI | Pressed Fa | This hands | 15.95 | 0 | 11/23/2002 | 100 | Books | Angels, De | | !New Product!1 | BTOLBES.gi | BTOLBES | A Tolkien | Here is th | 25 | 0 | 11/23/2002 | 100 | Books | Angels, De | David Day | !New Product!1 | BTOLILL.gi | BTOLILL | Tolkien Il | Tolkien Il | 25 | 0 | 11/23/2002 | 100 | Books | Angels, De | David Day | !New Product!1 | BWITGUI1.g | BWITGUI1 | Witches Gu | A Witch& | 14.95 | 0 | 11/23/2002 | 100 | Books | Angels, De | Edain McCo | !New Product!1 | BWITWIZ1.g | BWITWIZ1 | Witches & | The creato | 19.95 | 0 | 11/23/2002 | 100 | Books | Angels, De | Suza Scalo | !New Product!1 | BASTBEG.gi | BASTBEG | Astrology | Learn the | 12.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | William He | !New Product!1 | BASTHAN0AS | BASTHAN0AS | Astrologer | Precise, c | 16 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Louis Acke | !New Product!1 | BASTPRO1.g | BASTPRO1 | Astral Pro | This book | 9.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | | !New Product!1 | BASTPROB.g | BASTPROB | Astral Pro | Gain spiri | 9.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Edain McCo | !New Product!1 | BASTTRA0AP | BASTTRA0AP | Astral Tra | We all hav | 12.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Frost | !New Product!1 | BCELAST.gi | BCELAST | Celtic Ast | Celtic | 13.99 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Phyllis Ve | !New Product!1 | BCRYBAL1.g | BCRYBAL1 | Crystal Ba | Crystal ba | 11 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Uma Silbey | !New Product!1 | BCRYBAL0DI | BCRYBAL0DI | Crystal Ba | A Complete | 3.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Sibyl Ferg | !New Product!1 | BEXPSCR.gi | BEXPSCR | Exploring | Explori | 12.99 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Ambrose Ha | !New Product!1 | BFORTEL1.g | BFORTEL1 | Little Gia | Open a win | 9.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Diagram Gr | !New Product!1 | BHOWOUI1OC | BHOWOUI1OC | How to Use | Michael St | 6.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Michael St | !New Product!1 | BHOWTRA.gi | BHOWTRA | How to Tra | There is n | 10 | 0 | 11/23/2002 | 100 | Books | Astral, Di | | !New Product!1 | BICHING.gi | BICHING | I Ching, T | For centur | 10.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Brian Walk | !New Product!1 | BILLDIV.gi | BILLDIV | Illustrate | Divination | 14.95 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Judy Hall | !New Product!1 | BJOSSIL.gi | BJOSSIL | Jose Silva | Jose Silva | 13.99 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Ed Bernd | !New Product!1 | BKARTAR.gi | BKARTAR | Karmic Tar | A true exp | 19.99 | 0 | 11/23/2002 | 100 | Books | Astral, Di | William La | !New Product!1 | BMAGAST.gi | BMAGAST | Magickal A | We live in | 12.99 | 0 | 11/23/2002 | 100 | Books | Astral, Di | Skye Alexa | !New Product! | | | | | | | | | | | | No products_model field in record or incorrect root for category. I cannot import this record! Thats all! ----------------------------------------- when I goto Categories/Products in admin, it shows the categories are there and were created, but when I click on a category or subcategory, there are no products listed... it is blank... and if I try to goto my store, the database is gummed up... I can see my header, and only part of the 1st infoBox with "<input type="text" na" inside the box... looking at the HTML, the page has stopped there... it is the same for all pages... unless I delete the categories from admin and then all is well, until I try to import again, and it gives the categories but again none of the products are shown in admin and the storefront doesn't completely load (looks like gummed up database)...
  6. uh oh... I've a couple problems... #1 Excel doesn't automatically put quotes around each field... it just does under certain conditions.... so the script never find "--EOR--" because --EOR-- is all that is there... Excel also will not allow for typing in --EOR-- because of the dashes, it interprits them as minus signs, and give you an incomplete formula error. Copying and pasting works, and typing "--EOR--" is allowed too. when you use "--EOR--", excel then double quotes it to """--EOR--"""... I just took care of this for now by replacing "--EOR--" in the easypopulate.php with just --EOR-- and am copying and pasting --EOR-- into the cells since excel prohibits it from being typed in. so now thats working... but then I get this error: File uploaded. Temporary filename: C:PHPuploadtempphp3EF.tmp User filename: books.txt Size: 30787 The category_root_name is Books 34 | BFAICOL.gi | BFAICOL | Fairies & | A merry wo | 1.5 | 0 | 11/22/2002 | 100 | Books | Angels, De | Marty Nobl | BFAICOL is the number !New Product!1062 - Duplicate entry '1-1' for key 1 INSERT INTO products_description (products_id, language_id, products_name, products_description) VALUES ('1', '1', 'Fairies & Elves Coloring Book by Noble, Marty', 'A merry world awaits you within an enchanted forest, where lovable woodland sprites dwell amid toadstools, flowers, and other natural settings. This fanciful coloring book contains 30 illustrations, depicting fairies and elves perched on blossoms and at play with birds, ladybugs, bees, and other woodland creatures. The broad outlines of these carefully designed images make them easy to color, promising hours of satisfying and magical fun.') [TEP STOP] and nothing is imported...
  7. cool... no we must thank you... this saves alot of us alot of time populating our databases. on another note, the OSC code doesn't strip out slashes in titles for apostrophes, but using the character code ' does the job (have to get rid of the semi-colon or else it thinks a new field is beginning). I've been using the character codes for quotes and semi-colons in the description, but I guess I can stop... another idea... have the new easypopulate (tab delimented) change the special characters to their character codes... well I'll change mine to do that anyways since the development team reccomends using the character codes (found at http://www.w3.org/MarkUp/html-spec/html-spec_13.html) because parts of OSC still do not strip out the slashes (apostrophes in titles, I think emails, etc...)
  8. I see whats going on with the quotes now... if there is a quote in a text field, excell will quote the entire text field and the double quote the quote within the field (does that make any sense??? lol) I opened my CSV file in notepad and removed the begining and ending quotes on my description field and leaving the double quotes around the actual quote... went to easypopulate and dam it went through... maybe there is a way to check for a quote as the 1st and last character of a field (well 2nd to last I guess cause of semi-colons) and if it is there, chop them off...
  9. * that should be doesn't seem to be removing them
  10. I figured it out... I opened up easypopulate.php and some nut job (j/k) put code in there to change all commas to periods (commented that out), and to replace apostrophes with quotes (fixed that)... As the nut-job in question ;-) I'll take this fix and check it to be sure that the database isn't going to get confused. Unescaped chars like single/double quotes can trip up the db. You guys don't miss nothin'! Hehehe, Tim I am not having troubles with keeping commas and apostrophes... but the quotes are whats getting me... say the description is something like "The book "A Hobbit's Tale" is a wonderful masterpiece." excel will double quote the quotes making it "The book ""A Hobbit's Tale""... and the remove double quotes code: $item1 = str_replace('""','"',$item1); does seem to be removing them because on import it comes in ""The book ""A Hobbit's Tale""... it handles everthing fine (apostrophes and commas) except quotes where there are still double quotes and it puts double before each quote instead of just one... (i.e "A Hobbit's Tale") for now leaving quotes out of descriptions isn't that big of a deal... I've got my commas and apostrophes back, so all is well for now. (though you can't have apostrophes in the title, they show up on the website with the ' there... but it does the same if you use the admin panel to add them in by hand, so I suspect it is a problem with OSC)
  11. I figured it out... I opened up easypopulate.php and some nut job (j/k) put code in there to change all commas to periods (commented that out), and to replace apostrophes with quotes (fixed that)...
  12. hey also, any commas in any of the fields are being changed to periods on import. This really isn' that big of a deal for most fields, but in the product despcription, it sure can make for one heck of a mess when all the commas are now periods. anyway around this? I know when you add products one at a time in the admin, it keeps the commas and allows for quotes and apostrophes (it atomatically parses them to the correct code to avoid errors), so surely there would be a way to add this to the import function... though I don't know how since I am not really that big on PHP.
  13. wasson, thanks for this kickin contribution man... one question... I am new to PHP and know that something about " and ' mess it up... and in a few of my discriptions I have quotes " and apostrophes ', and it has trouble importing them, giving me a syntax error... so in the product descriptions, exactly how do I allow for quotes and apostrophes?
×