Jump to content

CatDadRick

Members
  • Content count

    253
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Rick Knight
  1. They say that's the first thing to go... Anyway, I did some price and quantity updates yesterday and the dates changed on me. I thought we had fixed this but when I searched, I found a post to the general forum I had made before posting to this forum. Then I opened my easypopulate.php and found the change we'd made and, well... what can I say. I tried to delete the new post but couldn't so my Ooops was the best I could think of. I still don't know why the dates changed, maybe another lapse of memory, but it's working today. Sorry for the memory lapse, and thanks for a great contrib and excellent support of it. Thanks, Rick
  2. Please ignore my previous post. Thanks, Rick Knight
  3. I posted this to the general support forum several months ago but didn't much response, so I'm reposting here. Since my problem is with EasyPopulate this is the better forum to post in... I'm trying to get the Date Available (date_avail) and Date Added (date_added) fields to keep the data in the existing table. When I add a product I set the date added and date available in the EP upload file and then upload the file to my catalog. Then when I upload updates to the catalog, the original date added and date available are over-written with the current date. I want EP to ignore the current date and use the dates already in the catalog and only use the current date when I'm adding a new item or when the catalog item doesn't have a date in the date added or date available fields. I've added... $default_these[] = 'v_date_avail'; $default_these[] = 'v_date_added'; to the Defaulted items code... // these are the fields that will be defaulted to the current values in // the database if they are not found in the incoming file $default_these = array(); foreach ($languages as $key => $lang){ $default_these[] = 'v_products_name_' . $lang['id']; $default_these[] = 'v_products_description_' . $lang['id']; $default_these[] = 'v_products_url_' . $lang['id']; if (EP_HTC_SUPPORT == true) { $default_these[] = 'v_products_head_title_tag_' . $lang['id']; $default_these[] = 'v_products_head_desc_tag_' . $lang['id']; $default_these[] = 'v_products_head_keywords_tag_' . $lang['id']; } } $default_these[] = 'v_products_image'; if (EP_MORE_PICS_6_SUPPORT == true) { $default_these[] = 'v_products_subimage1'; $default_these[] = 'v_products_subimage2'; $default_these[] = 'v_products_subimage3'; $default_these[] = 'v_products_subimage4'; $default_these[] = 'v_products_subimage5'; $default_these[] = 'v_products_subimage6'; } if (EP_UNKNOWN_ADD_IMAGES_SUPPORT == true) { $default_these[] = 'v_products_mimage'; $default_these[] = 'v_products_bimage'; $default_these[] = 'v_products_subimage1'; $default_these[] = 'v_products_bsubimage1'; $default_these[] = 'v_products_subimage2'; $default_these[] = 'v_products_bsubimage2'; $default_these[] = 'v_products_subimage3'; $default_these[] = 'v_products_bsubimage3'; } $default_these[] = 'v_categories_id'; $default_these[] = 'v_products_price'; $default_these[] = 'v_products_quantity'; $default_these[] = 'v_products_weight'; $default_these[] = 'v_status_current'; $default_these[] = 'v_date_avail'; $default_these[] = 'v_date_added'; $default_these[] = 'v_tax_class_title'; $default_these[] = 'v_manufacturers_name'; $default_these[] = 'v_manufacturers_id'; // Additional fields $default_these[] = 'v_products_price_list'; $default_these[] = 'v_vendors_product_price'; $default_these[] = 'v_vendors_id'; $default_these[] = 'v_vendors_prod_comments'; $default_these[] = 'v_vendors_prod_id'; $default_these[] = 'v_products_ship_price'; $default_these[] = 'v_products_discount1'; $default_these[] = 'v_products_discount2'; $default_these[] = 'v_products_discount3'; $default_these[] = 'v_products_discount1_qty'; $default_these[] = 'v_products_discount2_qty'; $default_these[] = 'v_products_discount3_qty'; $default_these[] = 'v_products_discount_percentage'; // End Added fields But this doesn't seem to work. What else do I need to do to get the date_added and date_avail to keep the original values? Thanks, Rick Knight
  4. CatDadRick

    Division by zero

    Graham, I tried the above change. Didn't make any difference. Any other idesa? Anyone? Thanks, Rick
  5. CatDadRick

    Division by zero

    Thanks Germ, I've made this change. I'll see if it works. Rick Knight
  6. I thought I had solved the "division by zero" warnings but I was wrong, I'm still getting them... [Tue Nov 18 15:56:24 2008] [error] [client 172.16.88.5] PHP Warning: Division by zero in /var/www/catalog_live/includes/functions/html_output.php on line 181, referer: http://catdads.rlknight.com/index.php?cPath=12_34 [Tue Nov 18 15:56:24 2008] [error] [client 172.16.88.5] PHP Warning: Division by zero in /var/www/catalog_live/includes/functions/html_output.php on line 182, referer: http://catdads.rlknight.com/index.php?cPath=12_34 Here's the tep_image function from my html_output.php... // 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 = '') { // if no file exists display the 'no image' file if (!is_file($src)) { $src = "images/no_image.jpg"; } // 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; } // Dont calculate if a pixel image is being passed (hope you dont have pixels for sale) if (!strstr($image, 'pixel')) { $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 not the original size if ($image_size[0] != $width || $image_size[1] != $height) { // echo 'variable1:'.$width; // echo 'variable1:'.$height; //echo 'height:'.$height.' width:'.$width.' for image:'.$src.'<br>'; $rx = $image_size[1] / $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 (tep_not_null($params)) $image .= ' ' . $params; $image .= ' border="0" alt="' . tep_output_string($alt) . '"'; if (tep_not_null($alt)) { $image .= ' title="' . tep_output_string($alt) . '"'; } $image .= '>'; return $image; } // End Replace I was getting the warning on the page every time I loaded the CATALOG page, but I had modified my shop to show a text message for out of stock items hadn't changed my "shoppe_enhancements_controller.php" file to reflect the modification. I corrected that and got rid of the on page warning message but I'm still getting the warning in my log file and I can't tell where it's coming from. I added code to show the $height and $width variables and the image name, but that didn't show any zero size images. Any idea what's causing this? Thanks, Rick
  7. CatDadRick

    Division by zero

    I thought I had solved the division by zero warnings, but I was wrong. I am still getting the warning in my logs. I've enabled this bit of added code to spot the zero size variable, but it does not show any height or width of zero. Everything looks OK, but I still get the warning. echo 'height:'.$height.' width:'.$width.' for image:'.$src.'<br>'; Any ideas, anyone? Thanks, Rick
  8. I installed this contribution several months ago and all seemed OK, but yesterday while trying to debug a "division by zero" warning, I came accross these other PHP Warnings in my error_log that I think are du to this contribution... [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecreate() [<a href='function.imagecreate'>function.imagecreate</a>]: Invalid image dimensions in /var/www/catalog_live/product_thumb.php on line 310, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 313, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagefill(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 315, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecolortransparent(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 316, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 350, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagegif(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 377, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecreate() [<a href='function.imagecreate'>function.imagecreate</a>]: Invalid image dimensions in /var/www/catalog_live/product_thumb.php on line 310, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 313, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagefill(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 315, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecolortransparent(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 316, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 350, referer: http://catdads.rlknight.com/product_info.php?products_id=86 [Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning: imagegif(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 377, referer: http://catdads.rlknight.com/product_info.php?products_id=86 Am I correct in assuming that these warning are being generated by this contribution? Can someone tell me how to trouble shoot them, or how to fix the problem? Thanks, Rick
  9. CatDadRick

    Division by zero

    Germ, thanks for the reply. Yes, that was a snippet from function tep_image. Full function below. I was able to fix the "division by zero" warning. I had replaced the Out of Stock image with an out of stock message but didn't change my shoppe_enhancements_controller.php to reflect the change. I am still seeing the other warnings in my log files though. Here are the PHP Warnings again, [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecreate() [<a href='function.imagecreate'>function.imagecreate</a>]: Invalid image dimensions in catalog/product_thumb.php on line 310 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 313 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagefill(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 315 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecolortransparent(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 316 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecopyresampled(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 350 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagegif(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 377 Here's function tep_image in full, function tep_image($src, $alt = '', $width = '', $height = '', $params = '') { // if no file exists display the 'no image' file if (!is_file($src)) { $src = "images/no_image.jpg"; } // 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; } // Dont calculate if a pixel image is being passed (hope you dont have pixels for sale) if (!strstr($image, 'pixel')) { $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 not the original size if ($image_size[0] != $width || $image_size[1] != $height) { // echo 'variable1:'.$width; // echo 'variable1:'.$height; //echo 'height:'.$height.' width:'.$width.' for image:'.$src.'<br>'; /* Added to troubleshoot "Division by zero" */ $rx = $image_size[1] / $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 (tep_not_null($params)) $image .= ' ' . $params; $image .= ' border="0" alt="' . tep_output_string($alt) . '"'; if (tep_not_null($alt)) { $image .= ' title="' . tep_output_string($alt) . '"'; } $image .= '>'; return $image; } Any idea where these warnings are coming from and how to fix them? Thanks Rick
  10. CatDadRick

    Division by zero

    I am getting a "division by zero" PHP Warning in my log files along with another PHP Warning. The Divide by zero warning seems to happen in pairs as below... [Thu Nov 13 18:47:24 2008] [error] [client 172.16.88.25] PHP Warning: Division by zero in catalog/includes/functions/html_output.php on line 180, referer: [url="http://catdads.rlknight.com/index.php?cPath=3_85"]http://catdads.rlknight.com/index.php?cPath=3_85[/url] [Thu Nov 13 18:47:24 2008] [error] [client 172.16.88.25] PHP Warning: Division by zero in catalog/includes/functions/html_output.php on line 181, referer: [url="http://catdads.rlknight.com/index.php?cPath=3_85"]http://catdads.rlknight.com/index.php?cPath=3_85[/url] [Thu Nov 13 18:47:24 2008] [error] [client 172.16.88.25] PHP Warning: Division by zero in catalog/includes/functions/html_output.php on line 180, referer: [url="http://catdads.rlknight.com/index.php?cPath=3_85"]http://catdads.rlknight.com/index.php?cPath=3_85[/url] [Thu Nov 13 18:47:24 2008] [error] [client 172.16.88.25] PHP Warning: Division by zero in catalog/includes/functions/html_output.php on line 181, referer: [url="http://catdads.rlknight.com/index.php?cPath=3_85"]http://catdads.rlknight.com/index.php?cPath=3_85[/url] The other PHP Warning is this... [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecreate() [<a href='function.im agecreate'>function.imagecreate</a>]: Invalid image dimensions in catalog/product_thumb.php on line 310 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 313 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagefill(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 315 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecolortransparent(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 316 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagecopyresampled(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 350 [Fri Nov 14 16:16:11 2008] [error] [client 65.55.108.172] PHP Warning: imagegif(): supplied argument is not a valid Image resource in catalog/product_thumb.php on line 377 Here's the code in catalog/includes/functions/html_output.php that seems to be causing the first warning... // Scale the image if not the original size if ($image_size[0] != $width || $image_size[1] != $height) { // echo 'variable1:'.$width; // echo 'variable1:'.$height; $rx = $image_size[1] / $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) . '"'; } Can someone tell me how to get rid of these warnings? I have error_reporting turned off in php.ini so the warnings don't show up on my pages, but my log files are getting pretty full. Thanks, Rick Knight
  11. Surfalot, This did the trick. Also, I assume that I can do the same with other fields by just adding "if" statements? Thanks again, Rick Knight
  12. Surfalot, Thanks, I have a bunch of updates ready to upload so I'll add that today and give it a try. Thanks, Rick Knight
  13. Thanks for the reply Surfalot, I'm using 2.76f-MS2-r1, I'll try 2.76g. What behaviour should I get when the column is included but empty? That seems to be where I'm having problems. Thanks again, Rick Knight
  14. I'm trying to get the Date Available (date_avail) and Date Added (date_added) fields to keep the data in the existing table. When I add a product I set the date added and date available in the EP upload file and then upload the file to my catalog. Then when I upload updates to the catalog, the original date added and date available are over-written with the current date. I want EP to ignore the current date and use the dates already in the catalog and only use the current date when I'm adding a new item or when the catalog item doesn't have a date in the date added or date available fields. I've added... $default_these[] = 'v_date_avail'; $default_these[] = 'v_date_added'; to the Defaulted items code... // these are the fields that will be defaulted to the current values in // the database if they are not found in the incoming file $default_these = array(); foreach ($languages as $key => $lang){ $default_these[] = 'v_products_name_' . $lang['id']; $default_these[] = 'v_products_description_' . $lang['id']; $default_these[] = 'v_products_url_' . $lang['id']; if (EP_HTC_SUPPORT == true) { $default_these[] = 'v_products_head_title_tag_' . $lang['id']; $default_these[] = 'v_products_head_desc_tag_' . $lang['id']; $default_these[] = 'v_products_head_keywords_tag_' . $lang['id']; } } $default_these[] = 'v_products_image'; if (EP_MORE_PICS_6_SUPPORT == true) { $default_these[] = 'v_products_subimage1'; $default_these[] = 'v_products_subimage2'; $default_these[] = 'v_products_subimage3'; $default_these[] = 'v_products_subimage4'; $default_these[] = 'v_products_subimage5'; $default_these[] = 'v_products_subimage6'; } if (EP_UNKNOWN_ADD_IMAGES_SUPPORT == true) { $default_these[] = 'v_products_mimage'; $default_these[] = 'v_products_bimage'; $default_these[] = 'v_products_subimage1'; $default_these[] = 'v_products_bsubimage1'; $default_these[] = 'v_products_subimage2'; $default_these[] = 'v_products_bsubimage2'; $default_these[] = 'v_products_subimage3'; $default_these[] = 'v_products_bsubimage3'; } $default_these[] = 'v_categories_id'; $default_these[] = 'v_products_price'; $default_these[] = 'v_products_quantity'; $default_these[] = 'v_products_weight'; $default_these[] = 'v_status_current'; $default_these[] = 'v_date_avail'; $default_these[] = 'v_date_added'; $default_these[] = 'v_tax_class_title'; $default_these[] = 'v_manufacturers_name'; $default_these[] = 'v_manufacturers_id'; // Additional fields $default_these[] = 'v_products_price_list'; $default_these[] = 'v_vendors_product_price'; $default_these[] = 'v_vendors_id'; $default_these[] = 'v_vendors_prod_comments'; $default_these[] = 'v_vendors_prod_id'; $default_these[] = 'v_products_ship_price'; $default_these[] = 'v_products_discount1'; $default_these[] = 'v_products_discount2'; $default_these[] = 'v_products_discount3'; $default_these[] = 'v_products_discount1_qty'; $default_these[] = 'v_products_discount2_qty'; $default_these[] = 'v_products_discount3_qty'; $default_these[] = 'v_products_discount_percentage'; // End Added fields But this doesn't seem to work. What else do I need to do to get the date_added and date_avail to keep the original values? Thanks, Rick Knight P.S Sorry for the double post, I originally posted posted to the general thread.
  15. CatDadRick

    Defaulted Fields

    Other fields in the "defaulted fields" list seem to work a little differently. If, for example, I leave the status or quantity fields empty in the incoming file the data that is already in the catalog database will be left untouched. If I leave the date added and date available fields empty in the incoming file, the date added and date available fields are updated with the current date for date available and the date the incoming file was saved for the date added field. I can't delete the date columns or modify the update statement because sometimes the incoming file has both new items and existing items that are being updated. So, is there a way to get the date fields to behave like the other defaulted fields? Thanks again, Rick Knight
×