Packages
40
Downloads
10 059
Автор дополнения
Packages
40
Downloads
10 059
Version 2.1.3-beta
Release date 11.17.2017
Downloads 782
Views 90
Warning! This package requires MODX not less than 2.3 !
The component implements the following functional: a favorites list, adding / removing resources to favorites, forming a favorites list



  • work with any resources
  • work with any users

The main difference from earlier versions — the work without any snippets, you just need to initialize the script.
Interactive examples are here.


Basic


You can use msFavorites anywhere on the page. To do this, you need to connect the snippet
msFavorites.initialize, specify the required call parameters for the required elements.

data-msfavorites-mode — operation mode,
list — favorites list, this mode deletes the favorite item
data-data-list — favorites list, for example default
data-data-id — processed resource identifier


Features


The favorites list works for all users. For authorized users, the user id serves as an identifier, session id for an unauthorized. A flag temporary is assigned to selected anonymous users, the creation mark is placed, and you can also set the life interval (number of days).





msFavorites connecting


Insert a call to the snippet msFavorites.initialize in a convenient place on the site template.


[[!msFavorites.initialize]]


msFavorites settings


The main settings for msFavorites are System Settings -> msFavorites



front_css — styles of the frontend
front_js — frontend scripts
clear_temporary — clear temporary lists


FAV lists


You can use the msFavorites.ids snippet to get a list of resources in your favorites.



[[!msFavorites.ids?&list=`default`]]

list — list of favorites name

The snippet also specifies placeholders of the form
[[!+msfavorite.list.default]]
			[[!+msfavorite.total.default]]

msfavorite.list.default — list of resources in the selected default
msfavorite.total.default — total number of resources in the selected default



Examples


Example 1
Setting:
— you want to display a list of favorites
— to add a resource from the favorites list default
— to display the total number counter in favorites

Call:
<div id="pdopage">
			<div class="rows">
			[[!pdoPage?
			&parents=`0`
			&element=`msProducts`
			&tpl=`@INLINE
			<a class="msfavorites"
			data-click
			data-data-id="[[+id]]"
			data-data-list="default">
			<i class="msfavorites-icon-heart"></i>
			</a>
			<span class="msfavorites-total" data-data-list="default">0</span>
			[[+pagetitle]]
			`
			&ajaxMode=`default`
			]]
			</div>
			[[!+page.nav]]
			</div>

Result:





Example 2
Setting:
— you want to display a list of favorites
— to delete a resource from the favorites list default
— to display the total number counter in favorites

Call:
<div id="pdopage">
			<div class="rows">
			[[!pdoPage?
			&parents=`0`
			&element=`msProducts`
			&resources=`[[!msFavorites.ids]]`
			&tpl=`@INLINE
			<div class="msfavorites-parent">
			<a class="msfavorites"
			data-click
			data-data-id="[[+id]]"
			data-data-list="default"
			data-msfavorites-mode="list">
			<i class="msfavorites-icon-heart"></i>
			</a>
			<span class="msfavorites-total" data-data-list="default">0</span>
			[[+pagetitle]]
			</div>
			`
			&ajaxMode=`default`
			]]
			</div>
			[[!+page.nav]]
			</div>

Result:


2.1.3 beta (17.11.2017)

  • Add "getFavoritesOutput" [msFavorites]
  • Add "totalUser" selector [js]

2.1.2 beta (24.10.2017)

  • Change "msFavoritesMultipleProcessor" processor

2.1.1 beta (19.10.2017)

  • Change "methodActions" [js]

2.1.0 beta (19.10.2017)

  • Add "msFavoritesOnBeforeProcessFavorites", "msFavoritesOnProcessFavorites" event

2.0.15-beta (04.10.2017)

  • Improved "methodActions" [js]

2.0.14-beta (14.09.2017)

  • Change "prepareResponse" [msFavorites]

2.0.13-beta (14.09.2017)

  • Change "initialize,runProcessor" [msFavorites]

2.0.12-beta (10.09.2017)

  • Fix "processAction" [js]

2.0.11-beta (07.09.2017)

  • Add "actionFormSubmit, actionFormChange" [js]

2.0.10-beta (07.09.2017)

  • Add "clear" [js]

2.0.9-beta (21.08.2017)

  • Add "sortby" [getFavorites]

2.0.8-beta (31.07.2017)

  • Add "totalAll" selector [js]

2.0.7-beta (17.07.2017)

  • Fix "updateFavorites" [js]
  • Add "PROCESS_ACTION" event [js]

2.0.6-beta (21.06.2017)

  • Fix "description" snippet

2.0.5-beta (21.06.2017)

  • Fix "window load" [js]

2.0.4-beta (07.06.2017)

  • Add style for "load, add, remove" [css]

2.0.3-beta (04.06.2017)

  • Remove "OnWebLogin" event

2.0.2-beta (31.05.2017)

  • Fix "getFavorites" [msFavorites]

2.0.1-beta (26.05.2017)

  • Add "reload page" to list

2.0.0-beta (23.05.2017)

  • Initial

msFavorites 1.1.10 (28.11.2016)

  • Add "msfavorites_action" trigger [js]

msFavorites 1.1.8 (25.11.2016)

  • Add "parseChunk" method

msFavorites 1.1.7 (24.11.2016)

  • Add "getChunk" method

msFavorites 1.1.6 (21.04.2016)

  • Reformate code
  • Add "ModPNotify"

msFavorites 1.1.5 (31.01.2016)

  • Fix favorites for multiple lists

msFavorites 1.1.4 (28.01.2016)

  • Fix delete and unpublish favorites

msFavorites 1.1.2 - 1.1.3

  • Fix favorites link

msFavorites 1.1.1

  • Add EN lexicon

msFavorites 1.1.0

  • Full refactoring. Only a fresh installation.

msFavorites 1.0.1 (21.09.15)

  • Improved default javascript. Now you can use html tags in add\remove links.

msFavorites 1.0.0 (18.09.15)

Improved installation script for MODX 2.4.

msFavorites 0.0.9 (17.02.15)

  • add the favorites panel (by Lev V.)

msFavorites 0.0.8 (19.01.15)

  • add snippet msfGetCount

msFavorites 0.0.7

  • add properties
  • add snippet msfProducts

0.0.6-beta (27.10.2014):

  • fix mysql.schema.xml
  • fix count in favorites list