Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length


Need help or want to talk to other developers? Join the VirtueMart Chat! Read more...

  Advanced search

216589 Posts in 58326 Topics- by 87990 Members - Latest Member: barry2mayer432
Pages: [1]   Go Down
Print
Author Topic: I found some bugs when I upgrade virtuemart 1.0.3 to 1.0.4  (Read 5537 times)
freechoice
Newbie
*
Posts: 10


View Profile
« on: March 25, 2006, 10:39:59 am »

When I upgrade virtuemart 1.0.3 to 1.0.4 today,I find some problems(Bugs?)
1,The product scoller(Random products module) changes to blank now
2,When I open the administrator pannel,I find the menu changes to mess up characters,when I replace header.php to old version,It works,So I think there's some bugs on this file with multiple chars.

Now I am trying to resolve these promblems.

My language is traditional chinese and my enviroment is joomla 1.0.8 + virtuemart 1.0.4(upgrade from 1.0.2->1.0.3->1.0.4)
I modify some files change the character form iso-8859-1 to utf-8

My site is http://www.xmsus.com

I wrote a module called prod_homepage for virtuemart,If someone need it,give me a mail(osulcn@gmail.com)
« Last Edit: March 25, 2006, 10:47:00 am by freechoice » Logged
freechoice
Newbie
*
Posts: 10


View Profile
« Reply #1 on: March 25, 2006, 11:03:06 am »

Look


* virtuemartbug.GIF (74.81 KB, 1024x768 - viewed 815 times.)
Logged
freechoice
Newbie
*
Posts: 10


View Profile
« Reply #2 on: March 25, 2006, 13:24:31 pm »

In mod_productscroller.php, go to line 140,like this
      $this->category_id            =  explode(',', $params->get('category_id', 0 ) );
Replace with this
      $this->category_id            =  intval( $params->get('category_id', 0 ) );

« Last Edit: March 25, 2006, 13:43:13 pm by freechoice » Logged
freechoice
Newbie
*
Posts: 10


View Profile
« Reply #3 on: March 25, 2006, 14:22:57 pm »

Use a text editor(such as vi,editplus,emacs,Zendstudio ect.) open the file header.php(the path is $site_path/administrator/components/com_virtuemart/header.php).

On line 329,we see that
$menu_code = htmlentities( $menu_code, ENT_NOQUOTES );

before this line,you may saw some line like this
ob_start();
$menu_code=ob_get_contents();
ob_end_clean().

well,well,well,In the new version, the header file turned output buffer on, absoulutly, there's no problem,but on line 329,it has the code like this
$menu_code = htmlentities( $menu_code, ENT_NOQUOTES );

if you use single byte charset such as iso-8859-1,still no problem

but

if you use multi-byte character(such as GB2312,BIG5,UTF-8 ECT.) encoding,
aha, trouble's coming,

the htmlentities() function translated all special characters in the buffer,so...

you've seen the result like....
like the 2nd floor


At last , We try to fix the bug,The best way to fix the bug is

delete this line or
comment it like this
//$menu_code = htmlentities( $menu_code, ENT_NOQUOTES );
Logged
simbo1905
Guest
« Reply #4 on: March 27, 2006, 02:51:07 am »

the htmlentities() function translated all special characters in the buffer,so...

http://uk2.php.net/htmlentities says that you could try passing a third parameter into the htmlentities function to deal with the character set.
Logged
freechoice
Newbie
*
Posts: 10


View Profile
« Reply #5 on: March 27, 2006, 04:37:46 am »

Like this
$menu_code = htmlentities( $menu_code, ENT_NOQUOTES, 'UTF-8' );

but if you this other character encoding,change the third parameter to your own character encoding!

thanks for your remind!
Logged
walkerhxg
Newbie
*
Posts: 3


View Profile
« Reply #6 on: March 27, 2006, 17:07:56 pm »

Two bugs have been fixed,thanks a lot! Smiley
Logged
Graeme
Newbie
*
Posts: 35


View Profile
« Reply #7 on: April 13, 2006, 22:38:42 pm »

Quote
In mod_productscroller.php, go to line 140,like this
      $this->category_id            =  explode(',', $params->get('category_id', 0 ) );
Replace with this
      $this->category_id            =  intval( $params->get('category_id', 0 ) );

Tried this  mod it works but displays the error "Warning: Invalid argument supplied for foreach() in /home/xxx/xxxx/htdocs/modules/mod_productscroller.php on line 245"  in the scroller

any thoughts


Graeme
Logged
Pages: [1]   Go Up
Print
Jump to: