View Single Post
  #27  
Old 10-17-2005, 10:43 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default Simple update script

Here's a simple script that may help with the updating of existing products:
Code:
<?php # grab all images paths and redefine and copy to new field # cart-lab.com require "./auth.php"; $sql=func_query("SELECT productid,image_path,image_type FROM $sql_tbl[thumbnails] WHERE image_type = 'image/pjpeg'"); foreach($sql as $k=>$v) { $small_thumb = eregi_replace("thumb","small",$v[image_path]); if(file_exists($small_thumb)) { db_query("UPDATE $sql_tbl[thumbnails] SET thumb_path='$small_thumb' WHERE productid='$v[productid]'"); print "Updating $v[productid]... "; } else { db_query("UPDATE $sql_tbl[thumbnails] SET thumb_path='' WHERE productid='$v[productid]'"); print "File Not Found. "; } } print "Done."; ?>
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote