搜索
开启辅助访问 切换到宽版

QQ登录

只需一步,快速开始

扫一扫,访问微社区

注册 找回密码
查看: 12106|回复: 9
打印 上一主题 下一主题

OpenCart 1.5.1.x 产品批量上传 导出工具

[复制链接]
楼主
发表于 2012-3-22 14:21:44 | 显示全部楼层
本帖最后由 ﹎.Up 于 2012-3-22 14:34 编辑
sl17951 发表于 2012-3-22 03:30
PHP Fatal Error:  Call to undefined method PHPExcel_Reader_CSV::setReadDataOnly() in *************** ...


这个问题主要是因为使用 windows 虚拟主机 的原因造成的,windows下禁用了 一些php函数 导致程序运行错误,

解决方法如下: (我没有windows主机测试,应该可以解决,大家试试如果不行在问我)

找到文件:

\opencart\admin\model\tool\export.php

找到

function upload( $filename ) {
....中间省略
}

把这段替换为:
  1. function upload( $filename ) {
  2.                 global $config;
  3.                 global $log;
  4.                 $config = $this->config;
  5.                 $log = $this->log;
  6.                 set_error_handler('error_handler_for_export',E_ALL);
  7.                 register_shutdown_function('fatal_error_shutdown_handler_for_export');
  8.                 $database =& $this->db;
  9.                 ini_set("memory_limit","512M");
  10.                 ini_set("max_execution_time",180);
  11.                 //set_time_limit( 60 );
  12.                 //chdir( '../system/PHPExcel' );
  13.                 require_once( '../system/PHPExcel/Classes/PHPExcel.php' );
  14.                 //chdir( '../../admin' );
  15.                 $inputFileType = PHPExcel_IOFactory::identify($filename);
  16.                 $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  17.                 $objReader->setReadDataOnly(true);
  18.                 $reader = $objReader->load($filename);
  19.                 $ok = $this->validateUpload( $reader );
  20.                 if (!$ok) {
  21.                         return FALSE;
  22.                 }
  23.                 $this->clearCache();
  24.                 $ok = $this->uploadImages( $reader, $database );
  25.                 if (!$ok) {
  26.                         return FALSE;
  27.                 }
  28.                 $ok = $this->uploadCategories( $reader, $database );
  29.                 if (!$ok) {
  30.                         return FALSE;
  31.                 }
  32.                 $ok = $this->uploadProducts( $reader, $database );
  33.                 if (!$ok) {
  34.                         return FALSE;
  35.                 }
  36.                 $ok = $this->uploadOptions( $reader, $database );
  37.                 if (!$ok) {
  38.                         return FALSE;
  39.                 }
  40.                 $ok = $this->uploadAttributes( $reader, $database );
  41.                 if (!$ok) {
  42.                         return FALSE;
  43.                 }
  44.                 $ok = $this->uploadSpecials( $reader, $database );
  45.                 if (!$ok) {
  46.                         return FALSE;
  47.                 }
  48.                 $ok = $this->uploadDiscounts( $reader, $database );
  49.                 if (!$ok) {
  50.                         return FALSE;
  51.                 }
  52.                 //chdir( '../../..' );
  53.                 return $ok;
  54.         }
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

QQ|手机版|OpenCart - 中文官方网站 ( 蜀ICP备09033774号|人工智能

GMT+8, 2024-5-2 13:36 , Processed in 0.056839 second(s), 21 queries , Gzip On.

快速回复 返回顶部 返回列表