Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Upgraded from 2.2RC2 to 2.3.4BS Gold, product description missing line breaks <br>


nigelt74

Recommended Posts

Posted

Hi All

 

Upgraded from 2.2RC2 to 2.3.4BS Gold,

 

the Product description in the old 2.2rc2 reads like this

 

 

 

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

 

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

 

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

 

 

In 2.3.4bs

Reads

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

 

 

as in all the line breaks are gone

 

To upgrade I,

Exported the 2.2RC2 database to an sql file

 

Then did a complete install of 2.3.4bs,

 

Then imported the 2.2rc2 sql into a new database and hooked this up to the 2.4.3 files

 

Then added in the database fields as per this instruction

 

http://www.oscommerce.com/forums/topic/403341-updating-elderly-oscommerce-cart-what-do-i-keep/?p=1720080

 

What have I done wrong in the upgrade?

 

Any help would be greatly appreciated as i am stumped

 

Posted

Ok I have just checked both databases in phpMyadmin and noticed something interesting (as in I don't know if it relevant)

 

When i view the product description (in the Insert Tab of phpMyadmin) the descriptions are breaking in the correct place for both of them, but i don't see any code

Can't work out how to upload an image

 

I also noticed that the old database and the imported database are both

 

MyISAM latin1_swedish_ci

 

While a brand new install of OSCommerce 2.3.4bs database is

 

MyISAM utf8_unicode_ci

 

Could this be the issue?

Posted

Not tested, but you can try this.

 

In the product_info.php file find

 

<?php echo stripslashes($product_info['products_description']); ?>

 

and change that to

 

 

<?php echo stripslashes(nl2br($product_info['products_description'])); ?>

Posted

When importing an .sql backup into a UTF-8 MySQL database, make sure you tell phpMyAdmin exactly what encoding the database backup is. The default is to assume it is Latin-1 encoded, unless you tell it otherwise. In your case, it probably was Latin-1 (or maybe Windows-1252), so no harm done. However, if you have a backup from a UTF-8 database, and forget to tell phpMyAdmin that it's UTF-8, any non-ASCII data will be corrupted (UTF-8 multibyte characters will be treated as multiple accented/non-ASCII characters, and each expanded into multibyte UTF-8 characters).

 

Do you know if the original data (text) actually had <br> tags in it, or were these just hard line ends (carriage returns)? The nl2br() call should convert hard line ends into <br>'s. Whether a hard line end was stored as x0A or x0D0A (or even just x0D), the encoding shouldn't affect it. If the text actually had <br>'s in it, I wonder what happened to them?

Posted

@@MrPhil

 

I believe they were hard line returns, as no matter how I exported the table no <br> appeared at all.

Posted

OK, if there never were <br>'s in the text, then nl2br() should do the job (and it sounds like it did). It was confusing for you to mention <br>. Could perhaps you have added an add-on to the older store that used nl2br()? I don't know why it isn't built in to 2.3.4 -- maybe they expect you to use HTML markup (such as <br>) for product descriptions. That would probably be a more general solution to formatting the text.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...