Advanced content manager extension for Magento®
- a powerful CMS

Layout Update XML

If you wish to prepend or append text to your list and wish to translate your list, we suggest to create a dedicated content type. e.g: “List of news”, composed with a wysiwyg editor and the following layout xml.

Otherwise, you can simply use a CMS → Pages and use the following layout xml in the corresponding textarea.

Information:

You can use these methods to build your layout in XML

Method Arguments  
setTitle title title of the content list
setCtType identifier content type's name (identifier)
Note that you can pass an array of identifiers
setCtId id content type's id
setPager boolean  0: disable 1: enable
setPagerPosition  position allows 0 (top), 1 (bottom), 2 (top & bottom)
setLimitPerPage limit integer
setLimitDisplay limit interger
setOrderField order: attribute’s id attribute's id
setSortOrder order  allows ASC or DESC

 

Attributes to show

To define which attributes you want to display, use the method addAttributeToShow with 2 arguments: attribute and params. Params is an array and its values will change depending on the attribute.

example:

<action method="addAttributeToShow">
      <argument name="attribute" xsi:type="string">title</argument>
      <argument name="params" xsi:type="array">
      <item name="has_link" xsi:type="string">1</item> </argument>
</action>

addAttributeToShow 
 attribute   attribute code (custom field identifier)
 params (array) label value of the label
   label_type 0 (hide label) 1 (show above) 2 (show belove) 3 (show inline)
   html_label_tag HTML tag of the element
   html_tag HTML tag of the container
  html_id HTML id of the container
  html_class HTML class of the container
  has_link: boolean defines if the element is set as a link (1) or not (0) 
 For the field type "file" only
 type file_filename_without
file_filename_with
file_custom_label

 name of the file without extension
name of the file with extension
custom label

 extra   (if type = file_custom_label) label of the file  
 For the field type "image" only
 type image_cropped
image_original
cropped  image 
original size image
 width integer,  width of the image in pixels
 height integer,  height of the image in pixels
 link boolean, link to original image  
 For the field type "date" only
 type date_short 
date_medium 
date_long 

short date
standard date format
complete date

 For the field type "datetime" only
 type date_time_short (short date)
date_time_medium (standard date format)
date_time_long (complete date)
short date
standard date format
complete date
   For the field type "product" only 
 type product_name
product_name_image
product_name_price
product_name_image_price
product_all
 name of the product
image and name of the products
name and price of the product
name, image and price of the product
display the product as it appears in the theme
   For the field type "category" only 
 type  category_name  displays the name of the category
For the field type "content" only 
type content_name_linked
content_name
display the title with links to the contents
shows the title of the content
For the field type "attribute" only
 type attribute_list_values
attribute_list_titles
attribute_comma_values
attribute_comma_titles
List of the value of the attributes
List of the title of the attributes
displays the value of the attributes one after the other
displays the title of the attributs one after the other
   For the field type "checkbox" only 
 type  checkbox_list_values
checkbox_list_titles
checkbox_comma_values
checkbox_comma_titles
 show values as a list
shows title as list
shows values one after another
shows titles one after another
   For the field type "multiple" only 
 type multiple_list_values
multiple_list_titles
multiple_comma_values
multiple_comma_titles
show values as a list
shows title as list
shows values one after another
shows titles one after another
   For the field type "radio" only 
 type  radio_select_value
radio_select_title
 shows the value
shows the title
   For the field type "drop_down" only 
type drop_select_value
drop_select_title
shows the value
shows the title

 

Attribute to filter

You can sort attributes with filters. Use the following method addAttributeToFilter with the 3 parameters : attribute, condition, value

example: 

<action method="addAttributeToFilter">
  <argument name="attribute" xsi:type="string">promote</argument>
  <argument name="condition" xsi:type="string">eq</argument>
  <argument name="value" xsi:type="string">1</argument>
</action>

addAttributeToFilter
attribute  attribute's identifier
condition mathematical operator
value value to compare

Add link


Add a link from the list to your content. 
With "position" you can place the link before or after

example:

<action method="addLink">   
<argument name="label" xsi:type="string">Read more</argument>
  <argument name="position" xsi:type="string">bottom</argument> </action>

addLink 
 label  link's label
position top
bottom

Add specific path to redirect where, on the filter links

When you click on the filter of your choice, you will be redirect to the specific path you have configured for.

example:

<action method="setFilterDirect">    
    <argument name="direct" xsi:type="string">my-direct-url</argument>
</action>

setFilterDirect 
 direct  filter direct url

Example:

See the example below:

<referenceContainer name="content">
  <block class="Blackbird\ContentManager\Block\Content\Widget\ContentList" name="content_type_identifier_list" >
    <action method="setTitle">
      <argument name="title" xsi:type="string">My Title</argument>
    </action>
    <action method="setCtType">
      <argument name="type" xsi:type="string">content_type_identifier</argument>
    </action>
    <action method="setPager">
      <argument name="pager" xsi:type="boolean">true</argument>
    </action>
    <action method="setPagerPosition">
      <argument name="pager" xsi:type="string">1</argument>
    </action>
     <action method="setLimitPerPage">
      <argument name="limit_per_page" xsi:type="string">5</argument>
    </action>
    <action method="setLimitDisplay">
      <argument name="limit_display" xsi:type="string">10</argument>
    </action>
     <action method="setOrderField">
      <argument name="order_field" xsi:type="string">attribute_code</argument>
     </action>
     <action method="setSortOrder">
      <argument name="sort_order" xsi:type="string">ASC</argument>
    </action>
     <action method="addAttributeToShow">
      <argument name="attribute" xsi:type="string">title</argument>
      <argument name="params" xsi:type="array">
      <item name="has_link" xsi:type="string">1</item> </argument>
    </action>
    <action method="addAttributeToShow">
      <argument name="attribute" xsi:type="string">description</argument>
    </action>
    <action method="addAttributeToShow">
      <argument name="attribute" xsi:type="string">image</argument>
      <argument name="params" xsi:type="array">
      <item name="width" xsi:type="string">100</item>
      <item name="height" xsi:type="string">100</item>
      <item name="has_link" xsi:type="string">1</item>
      </argument>
     </action>
     <action method="addLink">
      <argument name="label" xsi:type="string">Read more</argument>
      <argument name="position" xsi:type="string">bottom</argument>
     </action>
  </block>
</referenceContainer>

100%
OpenSource

60 days
free support

Unlimited
updates

Made for developers
and webmasters

14 days money
back guarantee

Made by Magento
certified developers