ZenCart-各个版本需要的PHP运行环境

运行Zen Cart的服务器要求

https://docs.zen-cart.com/user/first_steps/server_requirements/

PHP Version

包括v1.5.8的未来版本将需要PHP 7.1.3+

始终建议使用最新版本的Zen Cart,以实现最大兼容性

Zen Cart v1.5.7 is designed for PHP 5.6 through PHP 7.4
Zen Cart v1.5.6 is designed for PHP 5.5 through PHP 7.3
Zen Cart v1.5.5 is designed for PHP 5.5 up to PHP 7.1
Zen Cart v1.5.4 is designed for PHP 5.5 and PHP 5.6


Zen Cart v1.5.3 is compatible with PHP 5.3.7 thru PHP 5.6
Zen Cart v1.5.2 is compatible with PHP 5.3.7 thru PHP 5.6 (or PHP 5.2.14 with weakened security)
Zen Cart v1.5.1 is compatible with PHP 5.2.14 thru PHP 5.3.x.
Zen Cart v1.5.0 is compatible with PHP 5.2.14 thru PHP 5.3.x.
Zen Cart v1.3.9 series is compatible with PHP 5.2.10 thru PHP 5.3.x.
Zen Cart v1.3.7-v1.3.8a are compatible with PHP 4.3.2 thru PHP 5.2.x, but not PHP 5.3.
Zen Cart v1.2.x through v1.3.6 are compatible with PHP 4.3.2 – 4.4.x. They are NOT compatible with PHP 5.

ZenCart插件-收集汇总一些常用的插件

Changed Files

按更改日期顺序显示在Zen Cart安装中已更改的文件。

https://www.zen-cart.com/downloads.php?do=file&id=2193

Database I/O Manager (DbIo)

数据库I / O管理器(DbIo)提供了一个界面,供您的Zen Cart管理员使用.CSV文件作为界面从数据库导入和导出信息。

https://www.zen-cart.com/downloads.php?do=file&id=2091

View Schema

使用“查看模式”,您可以从管理面板中查看购物车的数据库模式(而不必打开phpMyAdmin或其他工具)。

https://www.zen-cart.com/downloads.php?do=file&id=2270

插件总库

https://www.zen-cart.com/downloads.php

ZenCart-开发环境搭建PSR-2 formatting代码格式

ZenCart官方文档中明确指明了,代码的风格

https://docs.zen-cart.com/dev/developer_environment/

为Zen Cart编写PHP代码不需要特别特殊的环境

支持PHP的IDE很有用。
我们使用PhpStorm。
如果您的编辑者遵循.editorconfig标准,该标准为代码文件设置了格式标准,那么这会很有帮助。

LAMP堆栈对于运行本地开发人员存储很有用。 常见的选项包括XAMPP,WAMP / MAMP,甚至Laravel Valet

Code Formatting

Line-endings in the github repo are (or are expected to be) LF.

Zen Cart usesPSR-2 formatting standards for “new” code.

Coding Standards

https://docs.zen-cart.com/dev/contributing/coding_standards/

PSR-2: Coding Style Guide

https://www.php-fig.org/psr/psr-2/

phpstorm .editorconfig

https://learnku.com/articles/24174

https://editorconfig.org/

这个.editorconfig可以在zencart git项目中找到它

ZenCart-$db查询之后的数据结构

代码如下

D:\wamp\www\ZenCart\includes\functions\extra_functions\functions_vtscommon.php:56:
class queryFactoryResult#69 (10) {
  public $EOF =>bool(false)
  public $cursor => int(0)
  public $fields =>
  array(8) {
    'products_id' =>
    string(1) "1"
    'products_image' =>
    string(37) "20180420-RB/201804201144211220111.jpg"
    'products_tax_class_id' =>
    string(1) "0"
    'products_name' =>
    string(37) "Ray-Ban Aviator Classic Gold , RB3025"
    'products_date_added' =>
    string(19) "2019-04-24 12:32:17"
    'products_price' =>
    string(8) "203.0000"
    'products_type' =>
    string(1) "1"
    'master_categories_id' =>
    string(1) "1"
  }
  public $is_cached =>
  bool(true)
  public $result =>
  array(6) {
    [0] =>
    array(8) {
      'products_id' =>
      string(1) "1"
      'products_image' =>
      string(37) "20180420-RB/201804201144211220111.jpg"
      'products_tax_class_id' =>
      string(1) "0"
      'products_name' =>
      string(37) "Ray-Ban Aviator Classic Gold , RB3025"
      'products_date_added' =>
      string(19) "2019-04-24 12:32:17"
      'products_price' =>
      string(8) "203.0000"
      'products_type' =>
      string(1) "1"
      'master_categories_id' =>
      string(1) "1"
    }
    [1] =>
    array(8) {
      'products_id' =>
      string(1) "2"
      'products_image' =>
      string(36) "20180420-RB/20180420114420205068.jpg"
      'products_tax_class_id' =>
      string(1) "0"
      'products_name' =>
      string(38) "Ray-Ban Aviator Gradient Gold , RB3025"
      'products_date_added' =>
      string(19) "2019-04-24 12:32:17"
      'products_price' =>
      string(8) "168.0000"
      'products_type' =>
      string(1) "1"
      'master_categories_id' =>
      string(1) "1"
    }
    [2] =>
    array(8) {
      'products_id' =>
      string(1) "3"
      'products_image' =>
      string(36) "20180420-RB/20180420114420901099.jpg"
      'products_tax_class_id' =>
      string(1) "0"
      'products_name' =>
      string(38) "Ray-Ban Aviator Evolve Silver , RB3025"
      'products_date_added' =>
      string(19) "2019-04-24 12:32:17"
      'products_price' =>
      string(8) "183.0000"
      'products_type' =>
      string(1) "1"
      'master_categories_id' =>
      string(1) "1"
    }
    [3] =>
    array(8) {
      'products_id' =>
      string(1) "4"
      'products_image' =>
      string(36) "20180420-RB/20180420114419796045.jpg"
      'products_tax_class_id' =>
      string(1) "0"
      'products_name' =>
      string(33) "Ray-Ban Outdoorsman Gold , RB3030"
      'products_date_added' =>
      string(19) "2019-04-24 12:32:17"
      'products_price' =>
      string(8) "153.0000"
      'products_type' =>
      string(1) "1"
      'master_categories_id' =>
      string(1) "1"
    }
    [4] =>
    array(8) {
      'products_id' =>
      string(1) "5"
      'products_image' =>
      string(37) "20180420-RB/201804201144215330131.jpg"
      'products_tax_class_id' =>
      string(1) "0"
      'products_name' =>
      string(58) "Ray-Ban Outdoorsman Craft Gold ,Polarized Lenses - RB3422Q"
      'products_date_added' =>
      string(19) "2019-04-24 12:32:17"
      'products_price' =>
      string(8) "243.0000"
      'products_type' =>
      string(1) "1"
      'master_categories_id' =>
      string(1) "1"
    }
    [5] =>
    array(8) {
      'products_id' =>
      string(1) "6"
      'products_image' =>
      string(37) "20180420-RB/201804201144210790109.jpg"
      'products_tax_class_id' =>
      string(1) "0"
      'products_name' =>
      string(41) "Ray-Ban Outdoorsman Craft Black , RB3422Q"
      'products_date_added' =>
      string(19) "2019-04-24 12:32:17"
      'products_price' =>
      string(8) "193.0000"
      'products_type' =>
      string(1) "1"
      'master_categories_id' =>
      string(1) "1"
    }
  }
  public $result_random =>
  NULL
  public $limit =>
  int(6)
  public $resource =>
  class mysqli_result#70 (5) {
    public $current_field =>
    int(0)
    public $field_count =>
    int(8)
    public $lengths =>
    array(8) {
      [0] =>
      int(1)
      [1] =>
      int(37)
      [2] =>
      int(1)
      [3] =>
      int(41)
      [4] =>
      int(19)
      [5] =>
      int(8)
      [6] =>
      int(1)
      [7] =>
      int(1)
    }
    public $num_rows =>
    int(6)
    public $type =>
    int(0)
  }
  public $link =>
  class mysqli#7 (19) {
    public $affected_rows =>
    int(6)
    public $client_info =>
    string(79) "mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $"
    public $client_version =>
    int(50011)
    public $connect_errno =>
    int(0)
    public $connect_error =>
    NULL
    public $errno =>
    int(0)
    public $error =>
    string(0) ""
    public $error_list =>
    array(0) {
    }
    public $field_count =>
    int(8)
    public $host_info =>
    string(20) "localhost via TCP/IP"
    public $info =>
    NULL
    public $insert_id =>
    int(0)
    public $server_info =>
    string(6) "5.7.19"
    public $server_version =>
    int(50719)
    public $stat =>
    string(135) "Uptime: 1598  Threads: 1  Questions: 604  Slow queries: 0  Opens: 388  Flush tables: 1  Open tables: 381  Queries per second avg: 0.377"
    public $sqlstate =>
    string(5) "00000"
    public $protocol_version =>
    int(10)
    public $thread_id =>
    int(12)
    public $warning_count =>
    int(0)
  }
  public $sql_query =>
  string(512) "SELECT distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                           p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from products p, products_description pd 
                           where p.products_id = pd.products_id 
                           and pd.language_id = '1' 
                           and p.products_status = 1 and p.products_custom_attributes = 1 order by pd.products_id asc LIMIT 6"
}

ZenCart-memcached使用笔记-配合PHP使用

启动
启动失败原因
需要以管理员的身份运行cmd
C:\memcached-amd64\memcached.exe -m 1024

512表示512M,1024表示1G

配置PHP扩展
使用x86版本哦
D:\wamp\bin\php\php5.6.31\ext\php_memcache.dll

Telnet操作使用因为输入法

C:\memcached-amd64\memcached.exe -d install
C:\memcached-amd64\memcached.exe -d start

命令
stats

ZenCart–覆盖系统 在ZenCart中可以被覆盖重写的地方有哪些?

在ZenCart中可以被覆盖重写的地方有

语言模块

第一处 如果修改english.php的文件
includes/languages/english.php
includes/languages/CUSTOM/english.php

第二处
includes/languages/english/*.php
includes/languages/english/CUSTOM/*.php

第三处
includes/languages/english/html_includes/*.php includes/languages/english/html_includes/CUSTOM/*.php
includes/languages/english/html_includes/responsive_classic/*.php

第四处
includes/languages/english/extra_definitions/*.php
includes/languages/english/extra_definitions/responsive_classic/product_free_shipping.php

还有三个模块
includes/languages/english/modules/order_total
includes/languages/english/modules/payment
includes/languages/english/modules/shipping
以上几个地方 已经将语言部分完全重写了

仔细观察就可以发现,你想修改这些文件,你就需要单独建一个 你主题的文件夹,存放你重写覆盖的文件

模板模块的重写

includes/templates/template_default/templates/*.php
includes/templates/CUSTOM/templates/*.php

includes/modules/sideboxes/*.php
includes/modules/sideboxes/CUSTOM/*.php

includes/modules/*.php
includes/modules/responsive_classic/*.php

以上只是列出了一些,仔细观察,在ZenCart中如果找到带有classic的就表示可以重写

ZenCart-开启关闭gzip,响应头对比,有什么变化

开启Gizip,响应头如下

HTTP/1.1 200 OK
Date: Wed, 25 Dec 2019 02:22:38 GMT
Server: Apache/2.4.41 (Win64) PHP/7.3.12
X-Powered-By: PHP/7.3.12
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 508
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8


$request_type:NONSSL<br />$PHP_SELF:/ZenCart156cDev/default.php<br />$extra_datafiles_directory:E:/wamp64/www/ZenCart156cDev/includes/extra_datafiles/<br />$ws_extra_datafiles_directory:includes/extra_datafiles/<br />Array
(
    [0] => includes/classes/observers/auto.downloads_via_aws.php
    [1] => includes/classes/observers/auto.downloads_via_redirect.php
    [2] => includes/classes/observers/auto.downloads_via_streaming.php
    [3] => includes/classes/observers/auto.downloads_via_url.php
)
<br />

注意:Vary: Accept-Encoding

关闭之后,响应头如下

HTTP/1.1 200 OK
Date: Wed, 25 Dec 2019 02:19:20 GMT
Server: Apache/2.4.41 (Win64) PHP/7.3.12
X-Powered-By: PHP/7.3.12
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Length: 508
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8


$request_type:NONSSL<br />$PHP_SELF:/ZenCart156cDev/default.php<br />$extra_datafiles_directory:E:/wamp64/www/ZenCart156cDev/includes/extra_datafiles/<br />$ws_extra_datafiles_directory:includes/extra_datafiles/<br />Array
(
    [0] => includes/classes/observers/auto.downloads_via_aws.php
    [1] => includes/classes/observers/auto.downloads_via_redirect.php
    [2] => includes/classes/observers/auto.downloads_via_streaming.php
    [3] => includes/classes/observers/auto.downloads_via_url.php
)
<br />