Announcement

Collapse
No announcement yet.

Widget: Sort Order Override

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Widget: Sort Order Override

    The Sort Order Override widget allows you to override the default sort order for any filtered section.
    The default sort order for both search and filtering is the one defined as the Default in 'Settings | Search And Filtering Settings | Results | Sort Orders'.

    Installation and Use

    Install the widget as described in ‘Finding and Installing a Widget’.

    Using the Widget

    To change the sort order for any filtered section, go to the Sellerdeck 'Operations' menu and select 'Extensions > Widgets'. This opens the 'Widgets Operations' dialog. Then do the following:
    1. Find 'Sort Order Override' and click the 'Configure' button to the right of it.
    2. Scroll down to the section you want to change, and click the pencil icon in the 'Action' column.
    3. Select the sort order that you want to use for the section.
    4. Click the green tick and then click 'OK'.
    5. Close the dialog and upload.
    If filtering is the default view for the section (Section Details > Filtering) then the sort order will be applied when the page is first opened. If filtering is not the default view, then it will be applied with the first filter.
    Shoppers can change the sort order by selecting a different one in the usual way.

    Disabling and Removing the Widget

    To remove the widget and restore the original behaviour:
    1. Find the entry for the widget in the ‘Widgets’ tab, and click the ‘Installed’ button.
    2. Click ‘Download Backup’ and save the backup file.
    3. Import the backup file using the same method as installing a widget. This will remove the changes made by the widget to the 'Standard Javascript Header Functions' and 'Section Page Body'.
    4. The widget added a new variable 'FilterSectionSortOrder' which must be removed manually:
      • Open the Library ('Design > Library' from the Sellerdeck menu) and select the 'Variables' tab.
      • Scroll down to the 'Section' group and expand it if necessary (click the '[+]' icon).
      • Right-click 'FilterSectionSortOrder', select 'Delete' and then click 'Yes'.
      • Click 'Close' to leave the Library.
    Code Changes

    The widget adds a new variable to the Library and changes two layouts.

    The widget adds a new variable 'FilterSectionSortOrder' to the 'Section' group of the Library. This variable is settable at Site and Section level. The value is modified according to the selection in the 'Operations' dialog of the Widgets extension. It should not be edited directly.

    The widget inserts code into the Standard Javascript Header Functions layout. Immediately after the following line:

    Code:
    var pg_bEnableFilterCount = parseInt("0<actinic:variable name="IsSearchFilterCountsEnabled" />", 10);
    it adds:
    Code:
    //sd.widget.Sort Order OverRide.1.1:BEGIN //sd.widget.Sort Order OverRide.1.1.REPLACED:80b31419f619b169088b99e22b5db272:var pg_sDefaultSortOrder = "<actinic:variable name="SearchSortDefaultOrder" \/>"; var pg_sDefaultSortOrder = "<actinic:block if="%3cactinic%3avariable%20name%3d%22FilterSectionSortOrder%22%20%2f%3e%20%3d%3d%20%22%22" ><actinic:variable name="SearchSortDefaultOrder" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22FilterSectionSortOrder%22%20%2f%3e%20%21%3d%20%22%22" ><actinic:variable name="FilterSectionSortOrder" selectable="false" /></actinic:block>"; //sd.widget.Sort Order OverRide.1.1:END

    In the Section Page Body layout, the widget replaces the 'FilterDefaultInput' variable with the following code

    Code:
    <!--sd.widget.Sort Order OverRide.1.2:BEGIN--> <!--sd.widget.Sort Order OverRide.1.2.REPLACED:f5c77b06f4842919533028d1fbe7a8c7:<actinic:variable name="FilterDefaultInput" \/>--> <actinic:block if="%3cactinic%3avariable%20name%3d%22FilterSectionSortOrder%22%20%2f%3e%20%3d%3d%20%22%22" ></actinic:block> <actinic:block php="true" if="%3cactinic%3avariable%20name%3d%22FilterSectionSortOrder%22%20%2f%3e%20%21%3d%20%22%22" > $sFilterDefaultInput = <<<'FDI' <actinic:variable name="FilterDefaultInput" /> FDI; echo str_replace('<actinic:variable name="SearchSortDefaultOrder" selectable="false" />', '<actinic:variable name="FilterSectionSortOrder" selectable="false" />', $sFilterDefaultInput); </actinic:block> <!--sd.widget.Sort Order OverRide.1.2:END-->
Working...
X