📄 csv_confirm.ihtml
字号:
<?php
# This script is a companion to the csv_upload script
# by John Syben (www.webme.co.nz)
#
# After you use the csv_upload script you need to
# FTP your images to the shop_image/product directory
# to match the image names from the csv file.
# This script will get all the image names from the product
# table and check if the images are in the shop_image/product
# folder and report which files are missing.
#
# Simply put this file in the product/html folder
# and make a link to it in the menu.
eval(load_class("vendor","ps_vendor"));
$ps_vendor = new ps_vendor;
$report = "";
// Set path to product image directory
$dir = WEBROOT;
$dir .= $ps_vendor->get_field($ps_vendor_id,"vendor_image_path");
$dir .= "product/";
// Check if directory exists
if (!is_dir($dir)) {
$report = "Directory <B>$dir</B> does not exist!<BR><BR>";
$report .= " Please check the location of your product image directory";
$report .= " and either move it to <B>$dir</B> or change the path in the";
$report .= " \$dir variable in the <B>";
$report .= MODROOT . "product/html/confirm_images.ihtml</B> file.";
}
else { // is_dir
// Get all the image names from the db
$db = new ps_DB;
$q = "SELECT product_thumb_image, product_full_image FROM product";
$db->query($q);
while ($db->next_record()) {
// See if the thumbnail exists
if (!file_exists($dir . $db->f("product_thumb_image"))) {
$report .= $db->f("product_thumb_image") . "<BR>";
}
// See if the full image exists
if (!file_exists($dir . $db->f("product_full_image"))) {
$report .= $db->f("product_full_image") . "<BR>";
}
} // End while
if (!$report) {
$report = "No missing images";
}
else {
$report = "The following product images are missing:<BR>" . $report;
}
} // end is_dir
echo $report;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -