This is a discussion on Report Missing and Unassignes Images within the New osCommerce Contributions forums, part of the osCommerce 2.2 Forums category; a function which can also be bundled with these and removes duplicate images for categories the file is just this ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| ||||
| ||||
| a function which can also be bundled with these and removes duplicate images for categories the file is just this function...... /************************************ *Functions * find and delete duplicate pictures from the database ************************************/ function goFindDuplicates() { $image_query = tep_db_query("select products_id, products_image, products_subimage1, products_subimage2, products_subimage3,products_subimage4,products_sub image5,products_subimage6,products_subimage7,produ cts_subimage8, products_subimage9 from products order by products_id "); $m = array("0","1","2","3","4","5","6","7","8","9"); // original array, all different $m2 = array("products_image","products_subimage1","produ cts_subimage2","products_subimage3","products_subi mage4","products_subimage5","products_subimage6"," products_subimage7","products_subimage8","products _subimage9"); // original array, all different $index = 1; while ( $m= tep_db_fetch_array($image_query)) { $xa[0]=$m['products_image']; if ($m['products_subimage1'] != '') $xa[1]=$m['products_subimage1']; if ($m['products_subimage2'] != '') $xa[2]=$m['products_subimage2']; if ($m['products_subimage3'] != '') $xa[3]=$m['products_subimage3']; if ($m['products_subimage4'] != '') $xa[4]=$m['products_subimage4']; if ($m['products_subimage5'] != '') $xa[5]=$m['products_subimage5']; if ($m['products_subimage6'] != '') $xa[6]=$m['products_subimage6']; if ($m['products_subimage7'] != '') $xa[7]=$m['products_subimage7']; if ($m['products_subimage8'] != '') $xa[8]=$m['products_subimage8']; if ($m['products_subimage9'] != '') $xa[9]=$m['products_subimage9']; $uniqueArray = array_unique($xa);//only unique values $dupArray = array_diff_assoc($xa, $uniqueArray);//duplicated values foreach ($dupArray as $value) { //do whatever you want here like build an assoc array. $index = array_search($value,$xa) ; if ($index == 0) { $xa[0]= 'ax'; // hose $index = array_search($value,$xa); // reset } // echo $m['products_id'] . ", duplicate value='$value' @ " . $m2[$index] . " "; // echo "update products set " . $m2[$index] . " = '' where products_id = " . $m['products_id'] . ' '; tep_db_query("update products set " . $m2[$index] . " = '' where products_id = " . $m['products_id'] ); } } } More...
__________________ Michael Sasek osCMax Developer
|
| Sponsored Links | ||
| ||
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Report Missing and Unassignes Images | michael_s | New osCommerce Contributions | 0 | 06-22-2007 10:10 AM |
| Report Missing and Unassignes Images | michael_s | New osCommerce Contributions | 0 | 01-13-2007 02:00 PM |
| Report Missing and Unassignes Images | michael_s | New osCommerce Contributions | 0 | 01-13-2007 12:11 PM |
| Missing Product Images | driwashsolutions | osCMax v2 Customization/Mods | 0 | 12-08-2006 03:13 PM |
| HTTPS SSL images missing also weird links? | doug | osCommerce 2.2 Installation Help | 7 | 05-12-2005 11:06 AM |