Batch Delete Zen cart items without images

Source: Internet
Author: User
Tags zen cart
<? 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/>' ;}}}?>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.