<? PHP/*** @ batch Delete Zen cart no image items * @ usage: Upload this file to the root directory of the website and run http: // your domain name/zcdelpro. PHP * @ $ status = 'delete'; // Delete products without images * @ $ status = 'hide '; // remove products without images * @ $ status = 'default'; // list products without images
* @ Author: QQ: 553008667 **/$ status = 'default'; $ no_img_id = array (); require ("includes/application_top.php "); $ pro_list = $ db-> execute ("select products_id, products_image from ". table_products); While (! $ Pro_list-> EOF) {If (file_exists (dir_ws_images. $ pro_list-> fields ['products _ imag']) & filesize (dir_ws_images. $ pro_list-> fields ['products _ image'])> 0 & preg_match ('/. *\. (JPG | BMP | GIF | PNG) $/UIS ', $ pro_list-> fields ['products _ image']) {// echo 'id is '. $ products_list-> fields ['products _ id']. 'product image normal <br/> ';} else {if ($ status = 'delete') {$ db-> execute ('delete from '. table_products. 'Where products_id = '. $ Pro_list-> fields ['products _ id']); $ db-> execute ('delete from '. table_products_attributes. 'Where products_id = '. $ pro_list-> fields ['products _ id']); $ db-> execute ('delete from '. table_products_description. 'Where products_id = '. $ pro_list-> fields ['products _ id']); $ db-> execute ('delete from '. table_products_to_categories. 'Where products_id = '. $ pro_list-> fields ['products _ id']); echo 'id is '. $ pro_list-> Fields ['products _ id']. 'product deleted <br/> ';} elseif ($ status = 'hide') {$ db-> execute ('update '. table_products. 'set products_status = 0 where products_id = '. $ pro_list-> fields ['products _ id']); echo 'id is '. $ pro_list-> fields ['products _ id']. 'product dismounted <br/> ';} else {$ no_img_id [] = $ pro_list-> fields ['products _ id']; echo 'id is '. $ pro_list-> fields ['products _ id']. 'product without images <br/> ';}}$ pro_list-> movenext ();} if ($ sta Tus! = 'Delete' & $ status! = 'Hide ') {echo' <span style = "color: #090;"> to delete products without images, change row 10th to $ status = "delete "; <br/> change row 10th to $ status = "hide"; <br/> </span> '; If (count ($ no_img_id)> 0) {echo 'list of products without images: <br/> '; foreach ($ no_img_id as $ id) {echo' <a href = "http ://'. $ _ server ['HTTP _ host']. dir_ws_catalog. 'Index. PHP? Main_page = product_info & products_id = '. $ id. '"target =" _ blank "> View ID '. $ id. 'product </a> <br/>' ;}}}?>