Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Products image verify 2.3 added 1November2011 has bug


dreamwalker

Recommended Posts

file_put_contents()

 

Available only if the PHP version on the server is 5.0 or greater

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 7 months later...

Hi,

 

can anyone please help?

 

I just installed this addon, it appears on backend without problem.

 

However the delete function doesn't work at all.

 

thanks in advance.

 

Lyn

 

Attached the image_veryfiy.php original code as below:

 

<?php
// image_verify.php
//
// Shawn Mulligan, copyright 2011
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Contribution Description
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
//
// Product Image Verify will allow the administrator to verify which products
// in thier online oscommerce catalog that do not have images added and will
// also let you know which products have images added but for some reason the
// the product image can not be found on the server.
//
// Product Image Verify also has a built in automatic caching system which is useful
// for those catalogs that have hundreds to thousands of products.
//
// This contribution was written because of our own needs. We would do an update with a data feed and
// when we would use easy populate. So you had to go through the catalog 1 product at a time to find your
// missing images. This contribution will save you all that time because it does the work for you with 1 click.
//
// We even added the capability to delete a product completely and also to beable to edit the product as well from within
// our contribution. We are planning on updating this contribution to add one more feature which instead of being forwarded
// to the product page to edit, that we will add the image update box so that way you can upload the image without even having to leave
// the Product Image Verify Page.
//
// We feel that we wrote this contribution to the full standards of oscommervce utilizing language files, built in oscommerce functions, etc.
// If you have any questions or concerns please feel free to visit http://ImageVerify.OscommerceContributions.com and we will be able to help
// you out any way shape or form.
//
// You should have received a copy of the GNU General Public License
// along with Barcode USPS Shipping. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// GPLv3 License
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// This file is part of Product Image Verifier
//
// Product Image Verify is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Product Image Verify is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Barcode USPS Shipping. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
require('includes/application_top.php');
require('includes/template_top.php');
?>
<!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" onload="SetFocus();">
<div id="popupcalendar" class="text"></div>
<!-- header //-->
<?php //require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- 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 //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
<td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_IMAGE_SIZE; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
</tr>
<?php



if($sID !="" && file_exists(DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE))
{
$fd = fopen (DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE, "r");
$iv_cache_contents = fread ($fd,filesize (DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE));
fclose ($fd);
$verify_query_raw = "select p.products_id, p.products_image, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and (" . $iv_cache_contents .") order by pd.products_name";
}else{
if(file_exists(DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE))
{
unlink(DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE);
}
$verify_query_raw = "select p.products_id, p.products_image, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id order by pd.products_name";
}
$verify_query = tep_db_query($verify_query_raw);
while ($verify = tep_db_fetch_array($verify_query)) {

if ( ((!$HTTP_GET_VARS['sID']) || ($HTTP_GET_VARS['sID'] == $verify['products_id'])) && (!$sInfo) ) {
$sInfo = new objectInfo($verify);
}
//Checks Status of all 3 image sizes to make sure it is not blank, null or if file exists so we only print out products with missing images only.
$image_status = 0;
if ($verify['products_image'] != "" && $verify['products_image'] != "NULL")
{
if (file_exists(DIR_FS_CATALOG_IMAGES . $verify['products_image']))
{
$image_status = 1;
}else{
$image_status = 0;
}
}else{
$image_status = 2;
}
if ($image_status != 1)
{
if (file_exists(DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE))
{
file_put_contents(DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE," or pd.products_id = " . $verify['products_id'],FILE_APPEND);
}else{
file_put_contents(DIR_FS_ADMIN . FILENAME_IMAGE_VERIFY_CACHE,"pd.products_id = " . $verify['products_id']);
}
}

if ( (is_object($sInfo)) && ($verify['products_id'] == $sInfo->products_id) && ($image_status != 1)) {
echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_IMAGE_VERIFY, '&sID=' . $sInfo->products_id) . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_IMAGE_VERIFY, '&sID=' . $verify['products_id']) . '\'">' . "\n";
}

if ($image_status != 1)
{
?>
<td class="dataTableContent"><?php echo $verify['products_name']; ?></td>
<td class="dataTableContent" align="left">
<?
}

switch ($image_status)
{
case 0:
echo tep_image(DIR_WS_ICONS . 'ms_error.png', KEY_OK, 20, 20);
break;
case 2:
echo tep_image(DIR_WS_ICONS . 'ms_warning.png', KEY_ERROR, 20, 20);
break;
}





if ($image_status != 1)
{
?>
</td>
<td class="dataTableContent" align="right"><?php if ( (is_object($sInfo)) && ($verify['products_id'] == $sInfo->products_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_IMAGE_VERIFY, 'page=' . $HTTP_GET_VARS['page'] . '&sID=' . $verify['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
</tr>
<?php
}
}
?>

</table></td>
<?php

$heading = array();
$contents = array();

if($sID =="")
{
$heading[] = array('text' => '<b><center>PLEASE CLICK ON PRODUCT ROW<BR>FOR MORE OPTIONS</center></b>');
}else{
$heading[] = array('text' => '<b><center>' . $sInfo->products_name. '</center></b>');
}
$contents[] = array('text' => '' . tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', 3));
if($sID !="")
{
$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '&pID=' . $sInfo->products_id . '&action=new_product') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, '&pID=' . $sInfo->products_id . '&action=delete_product') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
$contents[] = array('text' => '' . tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', 3));
}

$contents[] = array('text' => '' . tep_image(DIR_WS_ICONS . 'ms_error.png', '', 20, 20) . KEY_ERROR);
$contents[] = array('text' => '' . tep_image(DIR_WS_ICONS . 'ms_warning.png', '', 20, 20) . KEY_NOT_USED);
$contents[] = array('text' => '' . tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', 3));
$contents[] = array('text' => DELETE_WARNING);
$contents[] = array('text' => '' . tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', 3));
$contents[] = array('text' => EDIT_WARNING);
$contents[] = array('text' => '' . tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', 3));


if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo ' <td width="25%" valign="top">' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' </td>' . "\n";
}
?>
</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'); ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...