Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changed Domain URL, Not Getting Division By Zero


Guest

Recommended Posts

I have just changed the domain name for my store from domain .com to domain.co.uk.

I've used exactly the same files as I was using with the .com domain and put a 301 redirect in the htaccess for the .com to the .co.uk domain.

Although there are still some propegation issues I've used the following as a tempory fix in the config file.

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', 'http://67.15.94.144'); // eg, http://localhost - should not be empty for productive servers
 define('HTTP_CATALOG_SERVER', 'http://67.15.94.144');
 define('HTTPS_CATALOG_SERVER', '');
 define('ENABLE_SSL_CATALOG', 'false'); // secure webserver for catalog module
 define('DIR_FS_DOCUMENT_ROOT', '/home/httpd/vhosts/ideal-handling.co.uk/httpdocs/catalog/'); // where the pages are located on the server
 define('DIR_WS_ADMIN', '/catalog/myadmin/'); // absolute path required
 define('DIR_FS_ADMIN', '/home/httpd/vhosts/ideal-handling.co.uk/httpdocs/catalog/myadmin/'); // absolute pate required
 define('DIR_WS_CATALOG', '/catalog/'); // absolute path required
 define('DIR_FS_CATALOG', '/home/httpd/vhosts/ideal-handling.co.uk/httpdocs/catalog/'); // absolute path required
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
// define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');  old line
 define('DIR_WS_CATALOG_IMAGES', '../images/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
 define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
 define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
 define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
 define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
 define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');

 

But each time I try to access my pages I recieve the following error:

 

Warning: Division by zero in /home/httpd/vhosts/ideal-handling.co.uk/httpdocs/catalog/includes/functions/html_output.php on line 261

Warning: Division by zero in /home/httpd/vhosts/ideal-handling.co.uk/httpdocs/catalog/includes/functions/html_output.php on line 262

 

That is repeated 6 times, then further down the page, I have six missing images with ERROR in their place. So this division i due to an image issue I assume.

 

Then right at the bottom of my pages is the following error.

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX_DISPLAY_NEW_PRODUCTS' at line 1

select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id where products_status = '1' order by rand() desc limit MAX_DISPLAY_NEW_PRODUCTS

[TEP STOP]

 

Does anyone know why this is happening? I don't know why it should If the code I'm using is the same as the old code and I've changed the config files.

 

Any help would be much appreciated, thanks. :thumbsup:

Link to comment
Share on other sites

Your configuration table in the database is incomplete - try restoring it from a backup.

 

Matti

 

Odd the database wasnt touched. just moved the files around on the server, but the database stayed where it was. So i can't see how it would work one min but not the next.

 

Will it not be that there are some entries in the database that point to the .com domain?

 

If so has anyone else moved their stores to another domain?

Link to comment
Share on other sites

The section of html output is regarding the image thumbnailer, ie

 

////
// The HTML image wrapper function
// "On the Fly" Auto Thumbnailer using GD Library originally Nate Welch (v1.5) Updated by various contributors (v1.7.1)
// Scales product images dynamically, resulting in smaller file sizes, and keeps
// proper image ratio.  Used in conjunction with product_thumb.php t/n generator.
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') { 

   // Set default image variable and code
 $image = '<img src="' . $src . '"';

   // Don't calculate if the image is set to a "%" width
 if (strstr($width,'%') == false || strstr($height,'%') == false) { 
       $dont_calculate = 0; 
   } else {
       $dont_calculate = 1; 	 
 }	

   // Do we calculate the image size?
 if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) { 

       // Get the image's information
   if ($image_size = @getimagesize($src)) { 
   
       $ratio = $image_size[1] / $image_size[0];
   
       // Set the width and height to the proper ratio
     if (!$width && $height) { 
               $ratio = $height / $image_size[1]; 
               $width = intval($image_size[0] * $ratio); 
           } elseif ($width && !$height) { 
               $ratio = $width / $image_size[0]; 
               $height = intval($image_size[1] * $ratio); 
           } elseif (!$width && !$height) { 
               $width = $image_size[0]; 
               $height = $image_size[1]; 
           } 

           // Scale the image if larger than the set width or height
     if ($image_size[0] > $width || $image_size[1] > $height) { 
               $rx = $image_size[0] / $width; 
               $ry = $image_size[1] / $height; 

               if ($rx < $ry) { 
                   $width = intval($height / $ratio); 
               } else { 
                   $height = intval($width * $ratio); 
               } 

               $image = '<img src="product_thumb.php?img='.$src.'&w='.tep_output_string($width).'&h='.tep_output_string($height).'"';
           }
     
       } elseif (IMAGE_REQUIRED == 'false') { 
             return ''; 
       } 
   } 

   // Add remaining image parameters if they exist
 if ($width) { 
       $image .= ' width="' . tep_output_string($width) . '"'; 
   } 
 
   if ($height) { 
       $image .= ' height="' . tep_output_string($height) . '"'; 
   } 	 

   if ($params != '') { 
       $image .= ' ' . $params; 
   } 

   $image .= ' border="0" alt=" ' . tep_output_string($alt) . ' "';
 
 if ($alt)
       $image .= ' title=" ' . tep_output_string($alt) . ' "'; 

   $image .= '>';  
 
   return $image; 
}  

 

Please can anyone help me with this. ????

Link to comment
Share on other sites

This is what I am looking at:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX_DISPLAY_NEW_PRODUCTS' at line 1

select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id where products_status = '1' order by rand() desc limit MAX_DISPLAY_NEW_PRODUCTS

[TEP STOP]

 

The fact that the query has MAX_DISPLAY_NEW_PRODUCTS rather than the number indicates that the define entry is not in the configuration table of your database.

 

Matti

Link to comment
Share on other sites

This is what I am looking at:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX_DISPLAY_NEW_PRODUCTS' at line 1

select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id where products_status = '1' order by rand() desc limit MAX_DISPLAY_NEW_PRODUCTS

[TEP STOP]

 

The fact that the query has MAX_DISPLAY_NEW_PRODUCTS rather than the number indicates that the define entry is not in the configuration table of your database.

 

Matti

 

It is, its ID39 in my configuration table:

 

Heres the dump for it

 

-- 
-- Dumping data for table `configuration`
-- 

INSERT INTO `configuration` VALUES (39, 'New Products Module', 'MAX_DISPLAY_NEW_PRODUCTS', '3', 'Maximum number of new products to display in a category', 3, 5, '2005-02-15 09:41:26', '2004-08-23 15:55:53', NULL, NULL);

 

Like I said the database hasn't been touched. all that has happened is that Ive changed my domain name from .com to .co.uk

 

And my pages all have a problem with images, buttons are fine. But it seems that anything with a thumb is kaput

Link to comment
Share on other sites

OK Ive got my images showing again by updating 'On The Fly' Thumbnailer using GD Library but still getting the division by zero errors on the html_output.

 

Will try updating my page cahe next, and then ultimate urls

Link to comment
Share on other sites

Word to the wise,

 

After removing and replacing a shed load of contributions. the main culprit here was Configuraqtion Cache Contribution.

 

Removed that and ALL my errors dissapeared :)

 

No problems with missing information in my database or anything. just that one contribution.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...