Home php as in catalog.section.list make sorting by "element_sort_field" = & gt; "Uf_sort_f"?

as in catalog.section.list make sorting by “element_sort_field” = & gt; “Uf_sort_f”?

Author

Date

Category

In the admin in the sections created the UF_SORT_F user field. String type,
I can not understand why it does not work out sorting, which did not correctly done or did not finish?

$ sectionlistparams = array (
 "Iblock_type" = & gt; $ arparams ["iblock_type"],
 "Iblock_id" = & gt; $ arparams ["iblock_id"],
 // "Section_ID" = & gt; $ arresult ["section_id"],
 "Section_id" = & gt; $ arparams ["section_id_custom"],
 "Section_code" = & gt; $ arresult ["section_code"],
 "Cache_type" = & gt; $ arparams ["cache_type"],
 "Cache_time" = & gt; $ arparams ["cache_time"],
 "Cache_groups" = & gt; $ arparams ["cache_groups"],
 "Count_elements" = & gt; $ arparams ["section_count_elements"],
 "TOP_DEPTH" = & gt; $ arparams ["section_top_depth"],
 "Section_URL" = & gt; $ arresult ["Folder"]. $ arresult ["section"] ["section"],
 "Section_fields" = & gt; Array ("Detail_PICTURE", ""),
 "Section_user_fields" = & gt; array ('uf_sort_f', 'uf_sort', "uf_show_filter_znaki"),
 "View_mode" = & gt; $ arparams ["sections_view_mode"],
 "Show_parent_name" = & gt; $ arparams ["sections_show_parent_name"],
 "Hide_SECTION_NAME" = & gt; (ISSET ($ arparams ["sections_hide_section_name"])? $ arparams ["sections_hide_section_name"]: "n"),
 "Add_sections_chain" = & gt; (ISset ($ arparams ["add_sections_chain"])? $ arparams ["add_sections_chain"]: ''),
  "Element_sort_field" = & gt; "Uf_sort_f"
);
if ($ SectionListParams ["Count_elements"] === "Y")
{
 $ SectionListParams ["Count_elements_Filter"] = "CNT_ACTIVE";
 if ($ arparams ["hide_not_available"] == "Y")
 {
  $ SectionListParams ["Count_elements_Filter"] = "CNT_AVAILABLE";
 }
}
$ Application- & gt; includecomponent (
 "Bitrix: Catalog.SECTION.LIST",
 "Dorozhnye-Znaki",
 $ SectionListParams,
 $ component,
 Array ("Hide_icons" = & gt; "y")
);

Answer 1

Field element_sort_field This is for the Bitrix: Catalog.SECTION component, because It shows the elements, and sorts, respectively, elements.

A component Bitrix: catalog.section.list shows partitions, and sorting is specified if you see the component code, the Custom_SECTION_SORT parameter. Use like this:

$ sectionlistparams = array (
 "Iblock_type" = & gt; $ arparams ["iblock_type"],
 "Iblock_id" = & gt; $ arparams ["iblock_id"],
 // "Section_ID" = & gt; $ arresult ["section_id"],
 "Section_id" = & gt; $ arparams ["section_id_custom"],
 "Section_code" = & gt; $ arresult ["section_code"],
 "Cache_type" = & gt; $ arparams ["cache_type"],
 "Cache_time" = & gt; $ arparams ["cache_time"],
 "Cache_groups" = & gt; $ arparams ["cache_groups"],
 "Count_elements" = & gt; $ arparams ["section_count_elements"],
 "TOP_DEPTH" = & gt; $ arparams ["section_top_depth"],
 "Section_URL" = & gt; $ arresult ["Folder"]. $ arresult ["section"] ["section"],
 "Section_fields" = & gt; Array ("Detail_PICTURE", ""),
 "Section_user_fields" = & gt; array ('uf_sort_f', 'uf_sort', "uf_show_filter_znaki"),
 "View_mode" = & gt; $ arparams ["sections_view_mode"],
 "Show_parent_name" = & gt; $ arparams ["sections_show_parent_name"],
 "Hide_SECTION_NAME" = & gt; (ISSET ($ arparams ["sections_hide_section_name"])? $ arparams ["sections_hide_section_name"]: "n"),
 "Add_sections_chain" = & gt; (ISset ($ arparams ["add_sections_chain"])? $ arparams ["add_sections_chain"]: ''),
 "Custom_SECTION_SORT" = & gt; Array ("UF_SORT_F" = & gt; "ASC")
);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions