Jump to content
Sign in to follow this  
Druide

Druids Images Control 1.0.1

Recommended Posts

Druids Images Control 1.0.1

 

Made for SEC with mo_pics but very easy to adjust to your needs

 

What does it do ?

  • It checks All given images if the links are valid or not and where there is no image set and needs to be updated
  • 'Display Only Records to Update' checks products_image AND products_bimage if one is empty then it will be printed on the screen (also shows available / existing mo_pics)
  • 'Display All Records' needs no explanation.. LOL
  • you are only 1 click away to update/edit or view the product information
  • Results have not active products in red text, verified image link in green button, default image in orange button, invalid image link in red button, no image set in light red button
  • Results can be sorted by products_id ASC / DESC and by products_name ASC / DESC
  • and more...

// Insert in Mysql: (NOTE: fill in your own DEFAULT images WITH path in catalog/images/...  or set to blank)
// This will appear in admin > configuration > images
insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('', 'DEFAULT Missing Image Small', 'SHOW_MISSING_IMAGE_FILE', 'products_small/no_picture.jpg', 'Choose image to replace the missing image', '4', '3001', '2003-12-30 11:40:08', '2003-12-30 00:23:41', NULL, 'tep_cfg_select_option(array(\'products_small/no_picture.jpg\', \'products_small/pixel.gif\', \'\'),');
insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('', 'DEFAULT Missing Image Big', 'SHOW_MISSING_BIMAGE_FILE', 'products_big/', 'Choose image to replace the missing image', '4', '3002', '2003-12-30 11:40:08', '2003-12-30 00:23:41', NULL, 'tep_cfg_select_option(array(\'products_big/no_picture.jpg\', \'products_big/\', \'\'),');
insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('', 'DEFAULT Missing Image More Pics', 'SHOW_MISSING_MIMAGE_FILE', 'products_more/', 'Choose image to replace the missing image', '4', '3003', '2003-12-30 11:40:08', '2003-12-30 00:23:41', NULL, 'tep_cfg_select_option(array(\'products_more/no_picture.jpg\', \'products_more/\', \'\'),');

// Add to admin/filenames.php
 define('FILENAME_MISSING_IMAGES', 'missing_image.php');

// Add to admin/includes/boxes/reports.php
 tep_admin_files_boxes(FILENAME_MISSING_IMAGES, 'Missing Images') .

// check in your admin/images/ directory for existing
icon_status_green.gif
icon_status_red.gif
icon_status_red_light.gif
icon_status_yellow.gif

// Add to admin/includes/languages/english.php
 define('BOX_TEXT_MISSING_IMAGES', 'Missing Images');
 define('TEXT_MISSING_IMAGES_NO_IMAGE', 'No IMAGE: ');
 define('TEXT_MISSING_IMAGES_DEFAULT', 'DEFAULT: ');
 define('TEXT_MISSING_IMAGES_ERROR', 'ERROR: ');
 define('TEXT_MISSING_IMAGES_VERIFIED', 'Verified: ');
and more...
//define('TEXT_MISSING_IMAGES', );

 

create a new file in admin/ called missing_image.php

if you have a existing one then rename that file

<?php
/*
 /admin/missing_image.php
 Contribution: Druids Images Control 1.0.1
 Used to maintain all images a little easier

 Copyright (c) Januari 22, 2004
 Idea from Linda McGrath

 Complete rewrite by Robert Hellemans (Druide)

*/
?>
<?php
 require('includes/application_top.php');
 (!isset($sOrder) ? $sOrder='2' : '');
 (!isset($orderBy) ? $sort_order = 'order by pd.products_name ASC' : '');
 ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<!-- body_text //-->
   <td width="100%" valign="top" class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php echo  tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_MISSING_IMAGES_VERIFIED, 10, 10) . ' Verified image  |  ' . tep_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_MISSING_IMAGES_DEFAULT, 10, 10) . ' Default Image  |  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_MISSING_IMAGES_NO_IMAGE, 10, 10) . ' No Image SET  |  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_MISSING_IMAGES_ERROR, 10, 10) . ' IMAGE Does Not Exist<br>' . tep_image(DIR_WS_ICONS . 'preview.gif', 'Edit Product') . ' Edit Product  |  ' . '<font color="red">Red Product Name</font> = Product status NOT ACTIVE'; ?>
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr class="dataTableHeadingRow">
           <td colspan="17" class="dataTableHeadingContent"><?php echo '<a href="' . tep_href_link(FILENAME_MISSING_IMAGES, 'sOrder=1') . '">Display All Records</a> | <a href="' . tep_href_link(FILENAME_MISSING_IMAGES, 'sOrder=2') . '">Display Only Records to Update</a> | '; ?></td>
         </tr>
         <tr class="main" align="center">
<?php
echo  '<td><a href="' . tep_href_link(FILENAME_MISSING_IMAGES, 'sOrder=' . $sOrder . '&orderBy=1b') . '">-</a>ID<a href="' . tep_href_link(FILENAME_MISSING_IMAGES, 'sOrder=' . $sOrder . '&orderBy=1a') . '">+</a></td>
  <td><a href="' . tep_href_link(FILENAME_MISSING_IMAGES, 'sOrder=' . $sOrder . '&orderBy=2b') . '">-</a>Product<a href="' . tep_href_link(FILENAME_MISSING_IMAGES, 'sOrder=' . $sOrder . '&orderBy=2a') . '">+</a></td>';?>
<TD>sI</TD><TD>BI</TD><TD>sSI1</TD><TD>BSI1</TD><TD>sSI2</TD><TD>BSI2</TD><TD>sSI3</TD><TD>BSI3</TD><TD>sSI4</TD><TD>BSI4</TD><TD>sSI5</TD><TD>BSI5</TD><TD>sSI6</TD><TD>BSI6</TD>
         </tr>
<?php
($orderBy == '1a' ? $sort_order = 'order by p.products_id ASC' : '');
($orderBy == '1b' ? $sort_order = 'order by p.products_id DESC' : '');
($orderBy == '2a' ? $sort_order = 'order by pd.products_name ASC' : '');
($orderBy == '2b' ? $sort_order = 'order by pd.products_name DESC' : '');
   if ($sOrder == '2') {
  	 $missing_images_raw = tep_db_query("select * from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id=pd.products_id and p.products_id=p2c.products_id and pd.language_id = '" . $languages_id . "' and (p.products_image = '' or p.products_image = '".SHOW_MISSING_IMAGE_FILE."' or p.products_bimage = '' or p.products_bimage = '".SHOW_MISSING_BIMAGE_FILE."') " . $sort_order . "");
} else {
       $missing_images_raw = tep_db_query("select * from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id=pd.products_id and p.products_id=p2c.products_id and pd.language_id = '" . $languages_id . "' " . $sort_order . "");
}
       $row=0;
       while($missing_images = tep_db_fetch_array($missing_images_raw)) {

     if (!isset($missing_images['products_id']) ) { // optional add or overwrite:  $missing_images['products_status'] == '0'
       echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $missing_images['categories_id'] . '&pID=' . $missing_images['products_id'] . '&action=new_product_preview&read=only') . '\'">' . "\n";
       $current_row='dataTableContentSelectedList';
     } else {
       echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $missing_images['categories_id'] . '&pID=' . $missing_images['products_id']) . '\'">' . "\n";
       $current_row='dataTableContent';
     }
     $row++;
?>
             <td class="<?php echo $current_row; ?>" width="3%" align="right"><?php echo $missing_images['products_id'];?></td>
             <td class="<?php echo $current_row; ?>" NOWRAP><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $missing_images['categories_id']  . '&pID=' . $missing_images['products_id'] . '&action=new_product') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', 'Edit Product') . '</a>' . '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $missing_images['categories_id']  . '&pID=' . $missing_images['products_id'] . '&action=new_product_preview&read=only') . '" title="Product Preview">' . ($missing_images['products_status'] == '0' ? '<font color="red"><b>'. $missing_images['products_name'] . '</font></b>' : $missing_images['products_name']) . '</a> ('. substr($missing_images['products_model'],0,1) . ')';?></td>
             <td class="<?php echo $current_row; ?>" width="4%" align="center"><?php echo (($missing_images['products_image'] == SHOW_MISSING_IMAGE_FILE or $missing_images['products_image'] == '') ? ($missing_images['products_image'] == '' ? tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_MISSING_IMAGES_NO_IMAGE.$missing_images['products_image'], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_MISSING_IMAGES_DEFAULT.$missing_images['products_image'], 10, 10)) : (!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $missing_images['products_image']) ? tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_MISSING_IMAGES_ERROR.$missing_images['products_image'], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_MISSING_IMAGES_VERIFIED.$missing_images['products_image'], 10, 10)));?></td><td class="<?php echo $current_row; ?>" width="4%" align="center"><?php echo (($missing_images['products_bimage'] == SHOW_MISSING_BIMAGE_FILE or $missing_images['products_bimage'] == SHOW_MISSING_BIMAGE_FILE or $missing_images['products_bimage'] == '') ? ($missing_images['products_bimage'] == '' ? tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_MISSING_IMAGES_NO_IMAGE.$missing_images['products_bimage'], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_MISSING_IMAGES_DEFAULT.$missing_images['products_bimage'], 10, 10)) : (!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $missing_images['products_bimage']) ? tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_MISSING_IMAGES_ERROR.$missing_images['products_bimage'], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_MISSING_IMAGES_VERIFIED.$missing_images['products_bimage'], 10, 10)));?></td>

     <?php	for ($i=1, $n=7; $i<$n; $i++) { ?>
             <td class="<?php echo $current_row; ?>" width="4%" align="center"><?php echo (($missing_images['products_subimage'.$i] == SHOW_MISSING_IMAGE_FILE or $missing_images['products_subimage'.$i] == '') ? ($missing_images['products_subimage'.$i] == '' ? tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_MISSING_IMAGES_NO_IMAGE.$missing_images['products_subimage'.$i], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_MISSING_IMAGES_DEFAULT.$missing_images['products_subimage'.$i], 10, 10)) : (!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $missing_images['products_subimage'.$i]) ? tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_MISSING_IMAGES_ERROR.$missing_images['products_subimage'.$i], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_MISSING_IMAGES_VERIFIED.$missing_images['products_subimage'.$i], 10, 10)));?></td><td class="<?php echo $current_row; ?>" width="4%" align="center"><?php echo (($missing_images['products_bsubimage'.$i] == SHOW_MISSING_BIMAGE_FILE or $missing_images['products_bsubimage'.$i] == SHOW_MISSING_MIMAGE_FILE or $missing_images['products_bsubimage'.$i] == '') ? ($missing_images['products_bsubimage'.$i] == '' ? tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_MISSING_IMAGES_NO_IMAGE.$missing_images['products_bsubimage'.$i], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', TEXT_MISSING_IMAGES_DEFAULT.$missing_images['products_bsubimage'.$i], 10, 10)) : (!file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . $missing_images['products_bsubimage'.$i]) ? tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_MISSING_IMAGES_ERROR.$missing_images['products_bsubimage'.$i], 10, 10) : tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_MISSING_IMAGES_VERIFIED.$missing_images['products_bsubimage'.$i], 10, 10)));?></td>
   <?php } ?>
           </tr>
<?php
     } // while
?>
           <tr><td colspan="17" class="dataTableHeadingContent">Total <?php echo $row . '/' . tep_db_num_rows($missing_images_raw); ?> checked</td></tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Feel free to update this version with pagination, search functions etc, but please SHARE your work on this contribution with THIS forum ONLY and at this thread

 

When this is written then its time to add it to the contribution AREA

 

Please HONOR the original coders names !!


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

Before someone asks...LOL

 

SEC = SECv2.2 with Credit Class and GVv5.05 for MS2

 

Support thread for it at this link


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

in reports.php it would work better for ms2, but don't use this on the end or last option.

 

 '<a href="' . tep_href_link(FILENAME_MISSING_IMAGES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_TEXT_MISSING_IMAGES . '</a><br>' .

 

The only thing I would like to see this open in a new window or at least display the column left so I replaced

 

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<!-- body_text //-->

 

with this

 

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->

 

in the missing_image.php file


Best Regards

Share this post


Link to post
Share on other sites

Thanks for posting that, i left it out because i have some long product names in my DB.

 

I forgot to comment out 1 thing in the missing_image.php

 

 ('. substr($missing_images['products_model'],0,1) . ')'

 

I made my own group system and the first letter of the modelname is my group selection so delete that piece of code.

 

sorry for that :(

Edited by Druide

Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×