How can I limit the number of products to be displayed on home page?

1 month ago
nopcommerce 4/50

\Vews\Home\Index.cshtml
@await Component.InvokeAsync("Widget", new { widgetZone = PublicWidgetZones.HomepageBeforeProducts })
        @await Component.InvokeAsync("HomepageProducts")


how can i allow displaying only 5 products on home page?

all products are displayed on home page by default
1 month ago
Unfortunately there is no such settings to control it. You have to ensure by yourself that ShowOnHomepage is enable only on 5 products.
1 month ago
The admin Product edit page has a setting "Show on home page".  If selected, it will show without limitation.  You need to manually unselect it.  (Or, you can use SQL to UPDATE as needed.)
1 month ago
Mahbubur Rahman wrote:
Unfortunately there is no such settings to control it. You have to ensure by yourself that ShowOnHomepage is enable only on 5 products.


ok, thanks. i found solution for this one.

can you help me also. how can i display current customer login in _AdminLayout.cshtml?

i'll appreciate it if you'd help me
1 month ago
arthur_shneider wrote:

can you help me also. how can i display current customer login in _AdminLayout.cshtml?

please describe more. do you want to show the total logged-in customer? it's already showing the logged-in customer's full name & avatar at _AdminLayout.cshtml.
1 month ago
Rashed Khan wrote:

can you help me also. how can i display current customer login in _AdminLayout.cshtml?
please describe more. do you want to show the total logged-in customer? it's already showing the logged-in customer's full name & avatar at _AdminLayout.cshtml.


no, i just want to show current customer login on Admin side on _AdminLayout.cshtml (on the very top)

like this
current logged user's login: agoodguy

i use this for showing user id

@{
int user_id = (await iWorkContext.GetCurrentCustomerAsync()).Id;
}

then in body i use @user_id


it works fine

i need the same like this but for login
1 month ago
Rashed Khan wrote:

can you help me also. how can i display current customer login in _AdminLayout.cshtml?
please describe more. do you want to show the total logged-in customer? it's already showing the logged-in customer's full name & avatar at _AdminLayout.cshtml.


can you help me please?
1 month ago
arthur_shneider wrote:

can you help me please?

Please describe more what do you mean by for login ?
1 month ago
Rashed Khan wrote:

can you help me please?
Please describe more what do you mean by for login ?


sorry, i gues i had to use the word username instead of login :) that's why you didn't understand me. sorry, it's my mistake)

go here: https://admin-demo.nopcommerce.com/Admin/Setting/CustomerUser
then: Customer settings
then go to tab: Account
'Usernames' enabled

this is login
1 month ago
you can use @currentCustomer.Username at _AdminLayout.cshtml