Skip to content

Repository files navigation

Selection

This module allows you to create a selection of products or contents of similar themes (Best sellers, Best rated by women, .. for example). The selection will then be displayed as list of those products or contents.

Compatibility

  • To use this module on Thelia 2.3.x, use the tag 1.1.9

Installation

Manually

  • Copy the module into <thelia_root>/local/modules/ directory and be sure that the name of the module is Selection.
  • Activate it in your thelia administration panel

Composer

Add it in your main thelia composer.json file

composer require thelia/selection-module:~1.1.11

Usage

Once activated, a new button called "Selection" will appear in the tool menu on the left sidebar of the admin panel. Clicking on it will redirect you to the list of all the selections you've created so far.

Once on the page with all your selections you may :

  • Create a new selection by clicking on the + button at the top right of the page.
  • Toggle the visibility of your selection (whether people will see it or not) by clicking on the "Online" button in front of the selection you wish to make visible or invisible.
  • Edit an already created selection by clicking on its name or on the cog button then on the pencil button in front of the selection you wish to edit.
  • Delete a selection by clicking on the cog button then on the trash button in front of the selection you wish to delete.

You may then display your selection on your website by calling the selection_list loop.

Hook

This module has a single hook in the back office, adding the Selection button to the tools menu of the sidebar on the left, redirecting to the list of selection.

Loop

[selection_list]

This loop returns a list of selections. You can use it to display the selections you've created in your website.

Input arguments

VariableDescription
idA string containing the IDs of all the selections you wish to display. To get the ID of the current rewritten URL, use : $app->request->get('selection_id') in your template
codeA string containing one or more codes of the selections you wish to display.
exclude_codeA string containing one or more codes of the selections you wish to exclude from the loop results.
titleThe title of the selection you wish to display
visibleWhether your selection will be visible or not. Default : true
positionThe position of the selection you wish to display
excludeA string containing the IDs of all the selections you wish not to display
orderA string with a value inside these values : 'id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'created', 'created_reverse', 'updated', 'updated_reverse', 'random'
return_urlA boolean indicating if we want the url (cf BaseLoop)
without_containerA boolean indicating if we want to display selection that are not inside a container only
container_idThe container id to query only the selections inside that container

Output arguments

VariableDescription
SELECTION_IDThe ID of the current Selection
SELECTION_CODEThe code of the current Selection
SELECTION_TITLEThe title of the current Selection
SELECTION_DESCRIPTIONThe description of the current Selection
SELECTION_CHAPOThe chapo of the current Selection
SELECTION_POSTSCRIPTUMThe postscriptum of the current Selection
SELECTION_VISIBLEWhether the current selection is visible or not
SELECTION_POSITIONThe position of the current selection
SELECTION_URLThe URL of the current selection
SELECTION_CONTAINER_IDThe id of the container associated to the current Selection

Exemple

 {loop name="selection_list" type="selection_list" visible=true id='1,4'}
This selection id : {$SELECTION_ID}
This selection title : {$SELECTION_TITLE}
This selection code : {$SELECTION_CODE}
This selection status : {$SELECTION_VISIBLE}
This selection description : {$SELECTION_DESCRIPTION}
This selection chapo : {$SELECTION_CHAPO}
This selection url : {$SELECTION_URL}
This selection postscriptum : {$SELECTION_POSTSCRIPTUM}
This selection position : {$SELECTION_POSITION}
{/loop}

[selection_image]

This loop returns the images related to a selection.

Input arguments

Input Arguments are extended by Thelia\Core\Templates\Loop\Image

Output arguments

Output Arguments are extended by Thelia\Core\Templates\Loop\Image

Exemple

 {loop type="selection_image" name="selection_image" source="selection" source_id=$SELECTION_ID limit="1" visible="true"}
{/loop}

[selection_container]

This loop returns a list of selections containers. You can use it to display the selections containers you've created in your website.

Input arguments

VariableDescription
idA string containing the IDs of all the selections containers you wish to display. To get the ID of the current rewritten URL, use : $app->request->get('selection_id') in your template
codeA string containing one or more codes of the selection containers you wish to display.
exclude_codeA string containing one or more codes of the selection containers you wish to exclude from the loop results.
selection_idThe selection id to find
need_selection_countboolean indicating if we want to have the number of selection inside this container
titleThe title of the selection you wish to display
visibleWhether your selection will be visible or not. Default : true
positionThe position of the selection you wish to display
excludeA string containing the IDs of all the selections you wish not to display
orderA string with a value inside these values : 'id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'created', 'created_reverse', 'updated', 'updated_reverse', 'random'
return_urlA boolean indicating if we want the url (cf BaseLoop)

Output arguments

VariableDescription
SELECTION_CONTAINER_IDThe ID of the current container
SELECTION_CONTAINER_TITLEThe title of the current container
SELECTION_CONTAINER_CODEThe code of the current container
SELECTION_CONTAINER_DESCRIPTIONThe description of the current container
SELECTION_CONTAINER_CHAPOThe chapo of the current container
SELECTION_CONTAINER_POSTSCRIPTUMThe postscriptum of the current container
SELECTION_CONTAINER_VISIBLEWhether the current container is visible or not
SELECTION_CONTAINER_POSITIONThe position of the current container
SELECTION_CONTAINER_URLThe url of the current container
SELECTION_COUNTThe number of selections in the current container

Exemple

{loop name="selection_container" type="selection_container" visible="*" backend_context="1" lang=$lang_id order=$selection_container_order}
{$SELECTION_CONTAINER_ID}<br>
{loop type="selection_image" name="selection_image" lang="$edit_language_id" source="selection" source_id=$SELECTION_CONTAINER_ID width="70" height="50" resize_mode="borders" limit="1" visible="true"}
<img class="img-thumbnail" src="{$IMAGE_URL nofilter}" href="{url path="admin/selection/container/update/%selectionContainerId" selectionContainerId=$SELECTION_CONTAINER_ID}">
{/loop}
{{$SELECTION_CONTAINER_ID}}<br>
{$SELECTION_CONTAINER_TITLE}<br>
{$SELECTION_CONTAINER_POSITION}<br> {/loop}

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages