opencart 相关问题

免费的开源购物车系统,用PHP编写,基于MVC架构。不应在此处询问有关第三方扩展,模板或如何在管理中执行操作的问题 - 请使用开发人员的支持,OpenCart支持团队或OpenCart论坛来解决此类问题。

Opencart Journal 主题保存问题

我有一个 OC 3.0.3.8,主题为 Journal 3.1.12。当我在“皮肤”菜单上时,编辑任何内容并单击以保存任何事情。保存按钮只是旋转。其他期刊3菜单...

回答 1 投票 0

Opencart 3 SEO 网址

我是Opencart的初学者,所以我认为我的问题很常见。如何正确配置SEO URL链接?让我解释一下,我配置了主要内容的链接,例如:类别、关于我们、博客、

回答 1 投票 0

插件安装失败

OpenCart 可能有什么问题,因为当我尝试安装插件时,我得到: 警告:array_merge():参数 #1 不是 /home/agroagro/public_html/open/admin/controller/multisel... 中的数组...

回答 1 投票 0

Opencart 4 从网址中删除/产品

我正在尝试将我的网站从 Opencart 2 移动到 Opencart 4 但我的网址有问题,这里我试图从网址中删除 /product,我设法通过更改startup\seo url|rewrite来做到这一点

回答 2 投票 0

opencart 4 扩展 |覆盖家庭控制器问题

祝大家好,我正在尝试为我的网站开发主题作为 OpenCart 4 中的扩展,但是当我尝试覆盖家庭控制器时它根本没有改变,其他控制器已正常更改...

回答 1 投票 0

打开购物车:自定义模块未出现在网站中

我是 Opencart 的新手,我正在尝试实现一个自定义模块。我可以将它们添加到扩展 https://prnt.sc/3zYnLR3_bqM6 中。在主页布局中添加了以下模块来查看...

回答 1 投票 0

从管理端使用前端模型功能

我正在开发 OpenCart 版本 1.5.1.3。在某一阶段,我想在管理端控制器文件中使用前端模型功能。 我可以做什么来实现这个目标?

回答 3 投票 0

如何在opencart 3.0中获取我的产品页面的链接

我只想在 div 标签之间向外部显示我的产品页面的产品链接。 下面的代码仅提供我网站的链接。我是这个主题的初学者请帮助 {% 如果产品 %} ...

回答 1 投票 0

GD 图像模糊 Opencart

我在 Opencart 中进行 GD 图像处理时遇到了这个问题,它在调整大小后会创建非常糟糕的模糊图像。到目前为止我所尝试的一切都没有帮助。 下面是 image.php 的代码 我在 Opencart 中进行 GD 图像处理时遇到了这个问题,它在调整大小后会创建非常糟糕的模糊图像。到目前为止我所尝试的一切都没有帮助。 下面是 image.php 的代码 <?php class Image { private $file; private $image; private $info; public function __construct($file) { if (file_exists($file)) { $this->file = $file; $info = getimagesize($file); $this->info = array( 'width' => $info[0], 'height' => $info[1], 'bits' => $info['bits'], 'mime' => $info['mime'] ); $this->image = $this->create($file); } else { exit('Error: Could not load image ' . $file . '!'); } } private function create($image) { $mime = $this->info['mime']; if ($mime == 'image/gif') { return imagecreatefromgif($image); } elseif ($mime == 'image/png') { return imagecreatefrompng($image); } elseif ($mime == 'image/jpeg') { return imagecreatefromjpeg($image); } } public function save($file, $quality = 100) { $info = pathinfo($file); $extension = strtolower($info['extension']); if (is_resource($this->image)) { if ($extension == 'jpeg' || $extension == 'jpg') { imagejpeg($this->image, $file, $quality); } elseif($extension == 'png') { imagepng($this->image, $file); } elseif($extension == 'gif') { imagegif($this->image, $file); } imagedestroy($this->image); } } /** * * @param width * @param height * @param default char [default, w, h] * default = scale with white space, * w = fill according to width, * h = fill according to height * */ public function resize($width = 0, $height = 0, $default = '') { if (!$this->info['width'] || !$this->info['height']) { return; } $xpos = 0; $ypos = 0; $scale = 1; $scale_w = $width / $this->info['width']; $scale_h = $height / $this->info['height']; if ($default == 'w') { $scale = $scale_w; } elseif ($default == 'h'){ $scale = $scale_h; } else { $scale = min($scale_w, $scale_h); } if ($scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png') { return; } $new_width = (int)($this->info['width'] * $scale); $new_height = (int)($this->info['height'] * $scale); $xpos = (int)(($width - $new_width) / 2); $ypos = (int)(($height - $new_height) / 2); $image_old = $this->image; $this->image = imagecreatetruecolor($width, $height); if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') { imagealphablending($this->image, false); imagesavealpha($this->image, true); $background = imagecolorallocatealpha($this->image, 255, 255, 255, 127); imagecolortransparent($this->image, $background); } else { $background = imagecolorallocate($this->image, 255, 255, 255); } imagefilledrectangle($this->image, 0, 0, $width, $height, $background); imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']); imagedestroy($image_old); $this->info['width'] = $width; $this->info['height'] = $height; } public function watermark($file, $position = 'bottomright') { $watermark = $this->create($file); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); switch($position) { case 'topleft': $watermark_pos_x = 0; $watermark_pos_y = 0; break; case 'topright': $watermark_pos_x = $this->info['width'] - $watermark_width; $watermark_pos_y = 0; break; case 'bottomleft': $watermark_pos_x = 0; $watermark_pos_y = $this->info['height'] - $watermark_height; break; case 'bottomright': $watermark_pos_x = $this->info['width'] - $watermark_width; $watermark_pos_y = $this->info['height'] - $watermark_height; break; } imagecopy($this->image, $watermark, $watermark_pos_x, $watermark_pos_y, 0, 0, 120, 40); imagedestroy($watermark); } public function crop($top_x, $top_y, $bottom_x, $bottom_y) { $image_old = $this->image; $this->image = imagecreatetruecolor($bottom_x - $top_x, $bottom_y - $top_y); imagecopy($this->image, $image_old, 0, 0, $top_x, $top_y, $this->info['width'], $this->info['height']); imagedestroy($image_old); $this->info['width'] = $bottom_x - $top_x; $this->info['height'] = $bottom_y - $top_y; } public function rotate($degree, $color = 'FFFFFF') { $rgb = $this->html2rgb($color); $this->image = imagerotate($this->image, $degree, imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2])); $this->info['width'] = imagesx($this->image); $this->info['height'] = imagesy($this->image); } private function filter($filter) { imagefilter($this->image, $filter); } private function text($text, $x = 0, $y = 0, $size = 5, $color = '000000') { $rgb = $this->html2rgb($color); imagestring($this->image, $size, $x, $y, $text, imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2])); } private function merge($file, $x = 0, $y = 0, $opacity = 100) { $merge = $this->create($file); $merge_width = imagesx($image); $merge_height = imagesy($image); imagecopymerge($this->image, $merge, $x, $y, 0, 0, $merge_width, $merge_height, $opacity); } private function html2rgb($color) { if ($color[0] == '#') { $color = substr($color, 1); } if (strlen($color) == 6) { list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]); } elseif (strlen($color) == 3) { list($r, $g, $b) = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]); } else { return false; } $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); return array($r, $g, $b); } } ?> 正如您所看到的,质量已经设置为 100 ,所以这没有帮助。 我尝试用 resample 替换 resize - 但这没有产生可见的结果。 然而,我发现了这个建议(下面的代码)来锐化图像,不幸的是我不知道如何以及在哪里使用它。特别是因为原始代码处理多种图像类型。请帮忙把它放在正确的地方。 { $matrix = array( array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1), ); $divisor = array_sum(array_map('array_sum', $matrix)); $offset = 0; imageconvolution($image, $matrix, $divisor, $offset); return $image; } 此外,如果您有其他建议来改进此代码,我们将不胜感激!我认为这适用于整个 Opencart 社区,因为这个问题已经讨论过很多次了,但目前还没有发布可行的解决方案。 quality参数仅适用于.jpeg图像。 要锐化图像,您可以在 imageconvolution() 函数中应用 resize() 代码。 public function resize($width = 0, $height = 0, $default = '') { if (!$this->info['width'] || !$this->info['height']) { return; } $xpos = 0; $ypos = 0; $scale = 1; $scale_w = $width / $this->info['width']; $scale_h = $height / $this->info['height']; if ($default == 'w') { $scale = $scale_w; } elseif ($default == 'h') { $scale = $scale_h; } else { $scale = min($scale_w, $scale_h); } if ($scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png') { return; } $new_width = (int)($this->info['width'] * $scale); $new_height = (int)($this->info['height'] * $scale); $xpos = (int)(($width - $new_width) / 2); $ypos = (int)(($height - $new_height) / 2); $image_old = $this->image; $this->image = imagecreatetruecolor($width, $height); if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') { imagealphablending($this->image, false); imagesavealpha($this->image, true); $background = imagecolorallocatealpha($this->image, 255, 255, 255, 127); imagecolortransparent($this->image, $background); } else { $background = imagecolorallocate($this->image, 255, 255, 255); } imagefilledrectangle($this->image, 0, 0, $width, $height, $background); imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']); //Image Sharpening Code $matrix = array( array(0.0, -1.0, 0.0), array(-1.0, 5.0, -1.0), array(0.0, -1.0, 0.0) ); $divisor = array_sum(array_map('array_sum', $matrix)); $offset = 0; imageconvolution($this->image, $matrix, $divisor, $offset); // End Image Sharpening Code imagedestroy($image_old); $this->info['width'] = $width; $this->info['height'] = $height; } 参考资料: 使用 PHP gd 库提高图像质量 http://adamhopkinson.co.uk/blog/2010/08/26/sharpen-an-image-using-php-and-gd/

回答 1 投票 0

如何在 opencart 2 中使用图像子域?

这是我的配置文件。我已更改图像子域,但图像未加载。 这是我的配置文件。我已更改图像子域,但图像无法加载。 <?php // HTTP define('HTTP_SERVER', 'http://www.Yek.com/'); define('HTTP_IMAGE', 'http://img.Yek.com/'); // HTTPS define('HTTPS_SERVER', 'https://www.Yek.com/'); define('HTTPS_IMAGE', 'https://img.Yek.com/'); // DIR define('DIR_APPLICATION', '/home/Yek/public_html/catalog/'); define('DIR_SYSTEM', '/home/Yek/public_html/system/'); define('DIR_DATABASE', '/home/Yek/public_html/system/database/'); define('DIR_LANGUAGE', '/home/Yek/public_html/catalog/language/'); define('DIR_TEMPLATE', '/home/Yek/public_html/catalog/view/theme/'); define('DIR_CONFIG', '/home/Yek/public_html/system/config/'); //define('DIR_IMAGE', '/home/Yek/public_html/image/');//defult For Images/catlog on main host define('DIR_IMAGE', '/home/Yek/public_html/img/image/'); // image/catalog in download host define('DIR_CACHE', '/home/Yek/public_html/system/cache/'); define('DIR_DOWNLOAD', '/home/Yek/public_html/system/download/'); define('DIR_LOGS', '/home/Yek/public_html/system/logs/'); define('DIR_UPLOAD', '/home/Yek/public_html/system/upload/'); define('DIR_MODIFICATION', '/home/Yek/public_html/system/modification/'); // DB .... ?> 这是我的 image.php 。为我编辑? 不知道在哪里编辑此代码............................................ ...................................................... ...................................................... ...................................................... ...................................................... ...................... <?php class ModelToolImage extends Model { public function resize($filename, $width, $height) { if (!is_file(DIR_IMAGE . $filename)) { return; } $extension = pathinfo($filename, PATHINFO_EXTENSION); $old_image = $filename; $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension; if (!is_file(DIR_IMAGE . $new_image) || (filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image))) { $path = ''; $directories = explode('/', dirname(str_replace('../', '', $new_image))); foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!is_dir(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image); if ($width_orig != $width || $height_orig != $height) { $image = new Image(DIR_IMAGE . $old_image); $image->resize($width, $height); $image->save(DIR_IMAGE . $new_image); } else { copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image); } } if ($this->request->server['HTTPS']) { return $this->config->get('config_ssl') . 'image/' . $new_image; } else { return $this->config->get('config_url') . 'image/' . $new_image; } } } 将您的子域指向您的图像目录 在托管控制面板中添加子域时,您必须将其指向您的图像目录。如果您无权访问控制面板,则必须询问管理员。 /catalog/model/tool/image.php 找到 $this->config->get('config_url') 并改变 protected function getImageUrl($new_image) { $parts = explode('/', $new_image); $new_url = implode('/', array_map('rawurlencode', $parts)); if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) { return $this->config->get('config_ssl') . 'image/' . $new_url; } else { return $this->config->get('config_url') . 'image/' . $new_url; } }

回答 2 投票 0

在opencart 3.0.2.0图像管理器中按上传日期对图像进行排序

我想通过修复 PHP 代码或 ocmod 在 Imange Manager Opencart 3.0.2.0 中按日期上传图像进行排序? 任何人都知道如何做到这一点。 非常感谢

回答 1 投票 0

在 opencart4 中集成自定义扩展

我需要在 opencart 4 中进行自定义支付集成,因为该版本的平台已弃用商店的扩展。主要问题是我写的文件无法被

回答 1 投票 0

OpenCart 按批发客户群的批发价格添加到购物车

我正在使用 OpenCart 2.2.0,但我被卡住了。我有两个客户群——常规客户群和批发客户群。如果登录,常规团体客户可以按正常价格将产品添加到购物车,这部分是可以的。但我...

回答 2 投票 0

.htaccess 将一些 Opencart 页面重定向到新域

我在设置从旧网站页面到新域的重定向时遇到问题。 Opencart版本1.5.3.1 我需要为 5-10 个类似格式的页面设置重定向。例如: /index.php?

回答 1 投票 0

如何在管理控制器中加载目录模型

我正在使用Opencart版本2.1.0.1,如何在管理控制器中加载前端模型, 我有一个模型函数,它告诉外部预订 ID 类 ModelShippingParcelled 扩展模型 { ...

回答 4 投票 0

OpenCart 3.0.3.8 无效令牌/Javascript 问题

我正在尝试对 Opencart 安装进行故障排除,该安装在 2023 年 12 月之前一直运行良好。目前,当我选择管理面板左侧的菜单或页面上的选项卡时,我将得到...

回答 1 投票 0

opencart 4 多语言 从 URL 中删除 ?language=

您好,我正在尝试从 opencart 4 中的网址中删除 ?language= exmpale 是我希望 url 从此更改 exmpale.com/en?language=en-gb exmpale.com/fr?language=fr 到 exmpale.com/en 第一阶段...

回答 1 投票 0

将 twig 转换为 tpl

我尝试将twig转换为tpl,以便能够在2,3,0中使用3,0,0付款扩展。 树枝线 我尝试将 twig 转换为 tpl 以便能够在 2,3,0 中使用 3,0,0 付款扩展。 树枝线 <select name="payment_special_mode" class="form-control"> <option value="1" {{ payment_special_mode? 'selected' : '' }}>{{ text_enabled }}</option> <option value="0" {{ payment_special_mode? '' : 'selected' }}>{{ text_disabled }}</option> </select> <select name="payment_special_mode" class="form-control"> <option value="1" {{ payment_special_mode? 'selected' : '' }}>{{ text_enabled }}</option> <option value="0" {{ payment_special_mode? '' : 'selected' }}>{{ text_disabled }}</option> </select> 前往tpl线路 <select name="payment_special_mode" class="form-control"> <?php if ($payment_special_mode) { ?> <option value="1" selected="selected"><?php echo $text_enabled; ?> </option> <option value="0"><?php echo $text_disabled; ?></option> <?php } else { ?> <option value="1"><?php echo $text_enabled; ?></option> <option value="0" selected="selected"><?php echo $text_disabled; ?></option> <?php } ?> </select> 这是正确的吗 是的,我做到了,但没有成功,仍然在管理扩展行中可见,但有文本。用了opencartbot转换器,转换了大部分,但是有4行没有。检查了所有文件和文件夹。 读了很多标题,问了很多论坛,我找不到办法。如果我能以正确的方式将 twig 转换为 tpl,则在 3,0,2 扩展中必须有效。 我还将 user_token 更改为 token,$data['token'] = $this->session->data['token']

回答 0 投票 0

警告:需要加载 GD 扩展才能让 OpenCart 工作

如何解决在远程服务器上安装OpenCart?警告:OpenCart 需要加载 GD 扩展才能工作! 步骤:打开购物车安装中的2(预安装)。

回答 6 投票 0

OpenCart API

实际上,我正在为 OpenCart 开发的网站制作一个 eCom Android 应用程序。因此,我想在 JAVA 中为此创建一个 API (JSON)。 我想知道如何? 还有其他更容易制作的选择吗...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.