Opencart的优点:
免费开源,精致小巧,但该有的功能都有,五脏俱全,适合产品数量少于5万的电商网站。由英国人Daniel Kerr 个人开发,世界各地的爱好者在围绕opencart开发出很多插件和模板。比如,语言类的,货币类的,模块类的,支付类的,不一而足。
后台也非常的简洁明了,功能强大,对于初学者来说非常容易上手,对于大多数经验丰富的网店经营者来说,OpenCart 的后台管理功能也基本能满足其需求。OpenCart可以说是最适合国内用户建设外贸网店的程序!
从程序开发的角度来看,opencart就是完美!基于MVC+Language 结构,基本上和你用ThinkPhp开发没有什么区别。而插件的开发,是类似php框架里面的Module模块化开发,总之就是赞!
参考 《用免费的OpenCart快速搭建符合亚马逊品牌备案要求的独立网站》
值得说的opencart:
数据结构
- attribute, attribute group
- cart, option
- option like attr
- product + option = product_option_id
- product_option_id => option value + 价格 + 库存
文件结构
system -> startup ->engine+helper ->framework ->Registry +(config+request+db+session+cache+url+language+event+Response) + library= $route->dispatch(ACTION),
$response->output
catalog类别路由
http://www.liangopencart.net/index.php?route=product/category&path=59_107_120
MVC-L结构
Model层: 单纯sql,需要熟悉数据结构
View层: 基于swig模板引擎,
{{ column_left }}
{% if column_left and column_right %}
Controller层:
举例:product/category,先加载必要模型model,加载必要栏目controller,加载语言,然后把数据Data输出到模板。
$this->load->language('product/category');
$this->load->model('catalog/category');
$this->request->get['sort']
$html = $this->load->controller('common/column_left');
$this->response->setOutput($this->load->view('product/category', $data));
Language,语言层:
可以网上下载各种语言包,也可以自己手动翻译。
基于 extention 的插件开发:
举例:支付插件CpMy
catalog前台开发:
$this->model_checkout_order->addOrderHistory
get product,order, user info 做 支付参数
admin后台开发:
同catalog, 增删改查为主
功能模块理解:
- 商品模块
- 购物车模块
- cart 数据库
- 购物流程
- 订单模块
- 优惠活动
- 用户模块
- 支付模块