Home Joomla! Joomla! Tutorials Getting JavaScript errors or no response with Virtue Mart when clicking on Add, Apply or Cancel button?
 
 
 

Getting JavaScript errors or no response with Virtue Mart when clicking on Add, Apply or Cancel button?

PDF Print E-mail

Question: Getting JavaScript errors or no response with VirtueMart when clicking on Add, Apply, Cancel or other buttons? Getting error in VirtueMart 1.1.4

 

The error is similar to the below and it has to do with the readfile php function. 

 

Error: invalid regular expression flag v Source File: http://joomla/components/com_virtuemart/fetchscript.php?gzip=0&subdir[0]=/themes/default&file[0]=theme.js&subdir[1]=/js&file[1]=functions.js&subdir[2]=/js/admin_menu/js&file[2]=virtuemart_menu.js&subdir[3]=/js/admin_menu/js&file[3]=nifty.js&subdir[4]=/js/admin_menu/js&file[4]=fat.js&subdir[5]=/js/extjs2&file[5]=yui-utilities.js&subdir[6]=/js/extjs2&file[6]=ext-yui-adapter.js&subdir[7]=/js/extjs2&file[7]=ext-all.js

 

This happens most probably because the System Administrator has disabled the readmore function within the php.ini file on the server. It's the easiest to get it enabled, but most of the time it's impossible since it has been disabled for security reasons. But luckily there are some work arounds.

 

 

Answer:

  • In the file: /var/www/joomla/components/com_virtuemart/fetchscript.php replace line 226
    readfile( $file );
    with
    $contents = file_get_contents( $file );echo $contents;

  • In the file: /var/www/joomla/components/com_virtuemart/show_image_in_imgtag.php replace lines 148 - 166
     
    if( file_exists( $fileout ) ) {
      /* We already have a resized image
      * So send the file to the browser */
          switch(strtolower($ext))
            {
                case ".gif":
                    header ("Content-type: image/gif");
                    readfile($fileout);
                    break;
                case ".jpg":
                    header ("Content-type: image/jpeg");
                    readfile($fileout);
                    break;
                case ".png":
                    header ("Content-type: image/png");
                    readfile($fileout);
                    break;
            }
    }
     

    with
     
    if( file_exists( $fileout ) ) {
      /* We already have a resized image
      * So send the file to the browser */
          switch(strtolower($ext))
            {
                case ".gif":
                    header ("Content-type: image/gif");
                    $fileout = file_get_contents( $fileout );
                    echo $fileout;
                    break;
                case ".jpg":
                    header ("Content-type: image/jpeg");
                    $fileout = file_get_contents( $fileout );
                    echo $fileout;
                    break;
                case ".png":
                    header ("Content-type: image/png");
                    $fileout = file_get_contents( $fileout );
                    echo $fileout;
                    break;
            }
    }
     
  • In the file: /var/www/joomla/administrator/components/com_virtuemart/classes/shipping/minixml/classes/doc.inc.php replace line 322
     
    readfile($filename);
     

    with
     
    $contents = file_get_contents($filename);
    echo $contents;
     
Now try again and the issue should be solved.

 

+/-
+/- Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
Security Please input the anti-spam code that you can read in the image.
 

Go Daddy $7.49 .com Sale!