View Single Post
  #10  
Old 08-03-2017, 03:57 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: How to Display Product Attributes in a New Tab

Hi @johngwms,

The high level-purpose of view lists is to allow to extend templates more flexibly.

For instance the main template for displaying product details is:
skins/customer/product/details/page/body.twig

It has a code {{ widget_list('product.details.page') }} instead of something like
Code:
{% include 'other_template.twig' %} {% include 'yet_another_template.twig' %}

If we used the latter approach and some module wanted to put anything into product page, the module would have to completely replace this template and then add its own {% include %}. But what if two modules want to add their own changes to product details page? In this case, only last module changes would be implemented, while other modules' would be disregarded.

Since we use view lists, multiple modules can register their templates in view lists and all these additional templates will be considered when building a page.

Technically, these view lists are lists of templates assigned to a name. And these view lists are stored in xc_view_lists table in DB. When building a page, X-Cart walks through templates and when it finds function {{ widget_list('view_list_name') }}, it pulls all templates and View classes assigned to this view list name and puts them in place of call of {{ widget_list() }}

Hopefully, it all makes more sense now.

Tony


Quote:
Originally Posted by johngwms
Thanks Slava

I think I understand what you are saying, but I still don't understand the high-level purpose of Lists. Are they just an array of data? Are they an XC5 construct or part of one of the OOP methodologies used in XC5?
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote