A little proposal about OpenCart.

Source: Internet
Author: User
Tags opencart
A little advice on OpenCart.

OpenCart is an established, open source, free-to-business e-commerce system that recently watch its projects hosted on GitHub and found to be active, with feedback bugs every day.

First of all, it is to support the management of multiple stores in the background, and can be the same product in different stores have different prices; stores can be tied to different domain names. This is a more distinctive place.

But by looking at its code, we found that the changes were small over the years, and there was no evolutionary sense in the division of Code.

A large number of data, such as languages, links, current paths, etc., that should be constructed by the view, are placed in the controller,

Like the front desk login page:

$data[' breadcrumbs ']=Array();        $data[' breadcrumbs '][]=Array(            ' text '=$this->language->get(' Text_home '),            ' href '=$this->url->Link(' Common/home ')        );        $data[' breadcrumbs '][]=Array(            ' text '=$this->language->get(' Text_account '),            ' href '=$this->url->Link(' Account/account ', '', ' SSL ')        );        $data[' breadcrumbs '][]=Array(            ' text '=$this->language->get(' Text_login '),            ' href '=$this->url->Link(' Account/login ', '', ' SSL ')        );        $data[' Heading_title ']=$this->language->get(' Heading_title ');        $data[' Text_new_customer ']=$this->language->get(' Text_new_customer ');        $data[' Text_register ']=$this->language->get(' Text_register ');        $data[' Text_register_account ']=$this->language->get(' Text_register_account ');        $data[' Text_returning_customer ']=$this->language->get(' Text_returning_customer ');        $data[' Text_i_am_returning_customer ']=$this->language->get(' Text_i_am_returning_customer ');        $data[' Text_forgotten ']=$this->language->get(' Text_forgotten ');        $data[' Entry_email ']=$this->language->get(' Entry_email ');        $data[' Entry_password ']=$this->language->get(' Entry_password ');        $data[' Button_continue ']=$this->language->get(' Button_continue ');        $data[' Button_login ']=$this->language->get(' Button_login ');        if (isset($this->error[' Warning '])){$data[' error_warning ']=$this->error[' Warning '];}Else{$data[' error_warning ']='';}$data[' action ']=$this->url->Link(' Account/login ', '', ' SSL ');        $data[' Register ']=$this->url->Link(' Account/register ', '', ' SSL ');        $data[' Forgotten ']=$this->url->Link(' Account/forgotten ', '', ' SSL ');

Quite cumbersome, in fact, under the existing framework features, can be put into the view file.

On the head of the view file:

 $lang = $this->registry->get('language');//加载语言包管理对象$url = $this->registry->get('url');//加载url对象$this->language('common/footer');//载入语言包?>
 
  Class="Container"> class="Row"> <?Phpif ($informations){?>Class="Col-sm-3">

<? PHP echo $lang->get(' text_information '); ?>

      class= "list-unstyled"> < ? PHP foreach($informationsas$information) { ?>
    • " $information[' href '];?>"><? PHP echo $information[' title ']; ?>
    • < ? PHP} ?>
    <?PHP}?>

    In this way the controller does not have to take care of this boring thing, and focus on the business logic and core data calls.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.