zencart默认的获取产品多图的代码在includes\modules\additional_p_w_picpaths.php文件里面,主要的代码在
// Check for additional matching p_w_picpaths $file_extension = $products_p_w_picpath_extension; $products_p_w_picpath_match_array = array(); if ($dir = @dir($products_p_w_picpath_directory)) { while ($file = $dir->read()) { if (!is_dir($products_p_w_picpath_directory . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { // if(preg_match("/" . $products_p_w_picpath_match . "/i", $file) == '1') { if(preg_match("/" . $products_p_w_picpath_base . "/i", $file) == 1) { if ($file != $products_p_w_picpath) { if ($products_p_w_picpath_base . str_replace($products_p_w_picpath_base, '', $file) == $file) { // echo 'I AM A MATCH ' . $file . '<br>'; $p_w_picpaths_array[] = $file; } else { // echo 'I AM NOT A MATCH ' . $file . '<br>'; } } } } } } if (sizeof($p_w_picpaths_array)) { sort($p_w_picpaths_array); } $dir->close(); } 主要根据主图所在的位置目录下面,按主题的文件名来匹配,然后把所有的图片保存在$products_p_w_picpath_match_array数组里面。匹配规则: "/" . $products_p_w_picpath_base . "/i" zencart后台默认没有提供上传多图的功能,但是p_w_picpaths handler插件提供了多图管理的功能。http://www.zencart-bbs.com/read-htm-tid-1410.html