Change the “Sort By” option of a category with codeChange default category sort order by “in stock”Magento change sort order of selective categories in AdminHow to add custom category product position base on country and sort in Magento 1.9.x?MAGENTO - How to display the category details for editing?Magento2 : How to change sort by option position in sorting optionsChange category product sort order valuesMagento layered navigation attribute option sort by name not positionHow to restore 'sort by position' option for category sortinghow can i sort by using option value not option id value in listing page magento 2?Magento 2 - How to change Mega Menu sort order in store views alphabetical for each store view?
Are some indefinite integrals impossible to compute or just don't exist?
Error with uppercase in titlesec's label field
Applying for mortgage when living together but only one will be on the mortgage
How can flights operated by the same company have such different prices when marketed by another?
Accurately recalling the key - can everyone do it?
How is Sword Coast North governed?
Derivative is just speed of change?
Could flaps be raised upward to serve as spoilers / lift dumpers?
How can a class have multiple methods without breaking the single responsibility principle
The grades of the students in a class
Can I say "Gesundheit" if someone is coughing?
Gold Battle KoTH
What is the most 'environmentally friendly' way to learn to fly?
IBM mainframe classic executable file formats
What's the term for a group of people who enjoy literary works?
Conflict between senior and junior members
Best Ergonomic Design for a handheld ranged weapon
When did J.K. Rowling decide to make Harry and Ginny a couple?
Normally Closed Optoisolators
Please explain the difference in the order of naming Tzelafchad's daughters
Adding a (stair/baby) gate without facing walls
How to gracefully excuse yourself from a meeting due to emergencies such as a restroom break?
How to compare files with diffrent extensions and delete extra files?
How do I safety check that there is no light in Darkroom / Darkbag?
Change the “Sort By” option of a category with code
Change default category sort order by “in stock”Magento change sort order of selective categories in AdminHow to add custom category product position base on country and sort in Magento 1.9.x?MAGENTO - How to display the category details for editing?Magento2 : How to change sort by option position in sorting optionsChange category product sort order valuesMagento layered navigation attribute option sort by name not positionHow to restore 'sort by position' option for category sortinghow can i sort by using option value not option id value in listing page magento 2?Magento 2 - How to change Mega Menu sort order in store views alphabetical for each store view?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to change the Sort By
(Default product sort order in the front end) option that is available in the Catalog -> Manage Categories -> Display Settings
with a php script. I want to set that to position
for all categories.
Is there a way to do that in both Magento 1 and 2 ?
Thanks in advance.
magento2 magento-1.9 category-products
add a comment |
I want to change the Sort By
(Default product sort order in the front end) option that is available in the Catalog -> Manage Categories -> Display Settings
with a php script. I want to set that to position
for all categories.
Is there a way to do that in both Magento 1 and 2 ?
Thanks in advance.
magento2 magento-1.9 category-products
Found the answer for magento 2.$category->setDefaultSortBy('position'); $category->save();
– Shankar Thyagarajan
2 days ago
add a comment |
I want to change the Sort By
(Default product sort order in the front end) option that is available in the Catalog -> Manage Categories -> Display Settings
with a php script. I want to set that to position
for all categories.
Is there a way to do that in both Magento 1 and 2 ?
Thanks in advance.
magento2 magento-1.9 category-products
I want to change the Sort By
(Default product sort order in the front end) option that is available in the Catalog -> Manage Categories -> Display Settings
with a php script. I want to set that to position
for all categories.
Is there a way to do that in both Magento 1 and 2 ?
Thanks in advance.
magento2 magento-1.9 category-products
magento2 magento-1.9 category-products
edited Jul 23 at 11:27
Shankar Thyagarajan
asked Jul 23 at 11:15
Shankar ThyagarajanShankar Thyagarajan
113 bronze badges
113 bronze badges
Found the answer for magento 2.$category->setDefaultSortBy('position'); $category->save();
– Shankar Thyagarajan
2 days ago
add a comment |
Found the answer for magento 2.$category->setDefaultSortBy('position'); $category->save();
– Shankar Thyagarajan
2 days ago
Found the answer for magento 2.
$category->setDefaultSortBy('position'); $category->save();
– Shankar Thyagarajan
2 days ago
Found the answer for magento 2.
$category->setDefaultSortBy('position'); $category->save();
– Shankar Thyagarajan
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
Best way to do change setting from System Configuration.
Magento has a system configuration field where you can set Default product sort order
Position for all Category.
For magento2,Please go to admin Store>Configuration>Catalog>Catalog>StoreFrontend
And Select your desire default sorting field from their and Save the configuration.
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
NO need. Check"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282998%2fchange-the-sort-by-option-of-a-category-with-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Best way to do change setting from System Configuration.
Magento has a system configuration field where you can set Default product sort order
Position for all Category.
For magento2,Please go to admin Store>Configuration>Catalog>Catalog>StoreFrontend
And Select your desire default sorting field from their and Save the configuration.
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
NO need. Check"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
add a comment |
Best way to do change setting from System Configuration.
Magento has a system configuration field where you can set Default product sort order
Position for all Category.
For magento2,Please go to admin Store>Configuration>Catalog>Catalog>StoreFrontend
And Select your desire default sorting field from their and Save the configuration.
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
NO need. Check"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
add a comment |
Best way to do change setting from System Configuration.
Magento has a system configuration field where you can set Default product sort order
Position for all Category.
For magento2,Please go to admin Store>Configuration>Catalog>Catalog>StoreFrontend
And Select your desire default sorting field from their and Save the configuration.
Best way to do change setting from System Configuration.
Magento has a system configuration field where you can set Default product sort order
Position for all Category.
For magento2,Please go to admin Store>Configuration>Catalog>Catalog>StoreFrontend
And Select your desire default sorting field from their and Save the configuration.
answered Jul 23 at 11:50
Amit Bera♦Amit Bera
62.7k16 gold badges84 silver badges183 bronze badges
62.7k16 gold badges84 silver badges183 bronze badges
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
NO need. Check"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
add a comment |
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
NO need. Check"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
Thanks. If I do this, will I be able to check that "Use config value" checkbox through code?
– Shankar Thyagarajan
Jul 24 at 8:25
NO need. Check
"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
NO need. Check
"Use config value" checkbox through code
– Amit Bera♦
Jul 24 at 8:58
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282998%2fchange-the-sort-by-option-of-a-category-with-code%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Found the answer for magento 2.
$category->setDefaultSortBy('position'); $category->save();
– Shankar Thyagarajan
2 days ago