Manage by SKU

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
I've searched the forums to no avail. I'm sure someone has asked this question before too...

I go to Admin/Catalog/Products/Manage Products and it lists the stores inventory. Is there a way to have the products list by SKU instead of product name? It would save me ALOT of time managing my store.
9 years ago
It would require customization.
9 years ago
I'm game... How much customization are we talking about?

I've done quite well at inserting my own additional navigation block on home page and numerous other customizations so far.

I'd love to learn more about using visual studio if need be. Where do I go for answers?

I'm running nopCommerce v3.2.
9 years ago
dv8dug wrote:
I've searched the forums to no avail. I'm sure someone has asked this question before too...

I go to Admin/Catalog/Products/Manage Products and it lists the stores inventory. Is there a way to have the products list by SKU instead of product name? It would save me ALOT of time managing my store.


Hi,

Yes we can change default listing on Admin -> Manage Products.

Product listing is coming with help on stored procedure in NopCommerce Database.

Default sorting is not by name but default sorting is by Paging (Display Order)

Go to NopCommerce Database in Sql Server -> Stored Procedure

Modify Stored Procedure :  ProductLoadAllPaged

Before Change :
--sorting
  SET @sql_orderby = ''  
  IF @OrderBy = 5 /* Name: A to Z */
    SET @sql_orderby = ' p.[Name] ASC'
  ELSE IF @OrderBy = 6 /* Name: Z to A */
    SET @sql_orderby = ' p.[Name] DESC'
  ELSE IF @OrderBy = 10 /* Price: Low to High */
    SET @sql_orderby = ' p.[Price] ASC'
  ELSE IF @OrderBy = 11 /* Price: High to Low */
    SET @sql_orderby = ' p.[Price] DESC'
  ELSE IF @OrderBy = 15 /* creation date */
    SET @sql_orderby = ' p.[CreatedOnUtc] DESC'
  ELSE /* default sorting, 0 (position) */



After Change It will be like :
--sorting
  SET @sql_orderby = ''  
  IF @OrderBy = 5 /* Name: A to Z */
    SET @sql_orderby = ' p.[Name] ASC'
  ELSE IF @OrderBy = 6 /* Name: Z to A */
    SET @sql_orderby = ' p.[Name] DESC'
  ELSE IF @OrderBy = 10 /* Price: Low to High */
    SET @sql_orderby = ' p.[Price] ASC'
  ELSE IF @OrderBy = 11 /* Price: High to Low */
    SET @sql_orderby = ' p.[Price] DESC'
  ELSE IF @OrderBy = 15 /* creation date */
    SET @sql_orderby = ' p.[CreatedOnUtc] DESC'
  ELSE /* default sorting, 0 (position) */
    SET @sql_orderby = ' p.[Sku] DESC'


Change sorting to SET @sql_orderby = ' p.[Sku] DESC' OR SET @sql_orderby = ' p.[Sku] ASC'
as per your requirement.

I hope this will help you in getting listing order by sku on product listing page in admin panel.

Please Note that, This will also affect on listing on other pages on site.

Hope this helps you.
9 years ago
ajaysaksena wrote:

...
After Change It will be like :
--sorting
...
  ELSE /* default sorting, 0 (position) */
    SET @sql_orderby = ' p.[Sku] DESC'


No, you don't want to set it there, because there's a BEGIN END block as part of the ELSE, and it may then get replaced.
9 years ago
New York wrote:

...
After Change It will be like :
--sorting
...
  ELSE /* default sorting, 0 (position) */
    SET @sql_orderby = ' p.[Sku] DESC'


No, you don't want to set it there, because there's a BEGIN END block as part of the ELSE, and it may then get replaced.


So I got busy and haven't had time to do much else besides backup database. What is it you're saying NY? Can I set it inside the ELSE block? I'm not 100% on MySQL obviously... As I read it, these are the variable strings value parameters being set as to the different types of product listing search options...
9 years ago
You could do this
  ELSE /* default sorting */
  BEGIN
    SET @sql_orderby = ' p.[Sku] ASC'

    --category position (display order)
    IF @CategoryIdsCount > 0
    BEGIN
      IF LEN(@sql_orderby) > 0 SET @sql_orderby = @sql_orderby + ', '
      SET @sql_orderby = @sql_orderby + ' pcm.DisplayOrder ASC'
    END
    
    ...

And, if you wanted to, you could get rid of all the inner BEGIN / ENDs and testing LEN(), because you guarantee LEN(@sql_orderby) > 0, because of the first  SET @sql_orderby for Sku
e.g. change
    IF @CategoryIdsCount > 0
    BEGIN
      IF LEN(@sql_orderby) > 0 SET @sql_orderby = @sql_orderby + ', '
      SET @sql_orderby = @sql_orderby + ' pcm.DisplayOrder ASC'
    END
to
    IF @CategoryIdsCount > 0
      SET @sql_orderby = @sql_orderby + ', pcm.DisplayOrder ASC'

(note the leading comma)
7 years ago
Appreciate this advice, this has been driving us nuts for awhile. We do everything by SKU and being sorted by date, etc isn't a real help. Such a simple solution... Thanks!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.