3ART Technologies
2020-05-06T14:57:42Z
Can anyone tell me how can i get all the categories through server-side API

Regards
MooreCreative
2020-05-06T15:59:31Z
hmmm, we pull from and work with data in the database all the time... less often through the APIs.

You have already been through the list of Hotcakes API Endpoints?
https://hotcakescommerce...26405-REST-API-Endpoints 

There is a specific one for Categories
https://hotcakescommerce...Endpoints-for-Categories 

And if you're needing some more info, there are these two helpful articles and content from Will
  • https://hotcakescommerce...EST-API-Example-Solution 
    https://hotcakescommerce...REST-or-Server-Side-API- [/list]
  • Will Strohl
    2020-05-07T19:31:19Z
    Great response, Ryan.

    As a general FYI for all readers - It's generally never a good idea to directly query the database for any commercial or open-source application. The database is considered to be part of the core application and is subject to change during an upgrade. It can break the application that you've deployed or even invalidate support.
    Will Strohl, Upendo Ventures
    Hotcakes Cloud  | Get Support  | Code Support 
    Official Cloud & Support provider for Hotcakes
    Will Strohl
    2020-05-07T19:36:27Z
    Oh, and here is the server-side API code to call to get a list of categories:

    var HccApp = HotcakesApplication.Current;
    var allCats = HccApp.CatalogServices.Categories.FindAllSnapshotsPaged(1, 5000);

    You can see an example of that below:

    https://github.com/Hotca...g/Categories.aspx.cs#L73 
    Will Strohl, Upendo Ventures
    Hotcakes Cloud  | Get Support  | Code Support 
    Official Cloud & Support provider for Hotcakes
    3ART Technologies
    2020-05-09T18:52:02Z
    Is it workable for multilanguage portal?
    3ART Technologies
    2020-05-11T02:02:01Z
    Hi,
    I tried the code
    var HccApp = HccAppHelper.InitHccApp();
    var allCats = HccApp.CatalogServices.Categories.FindAllSnapshotsPaged(1, 5000);

    but it's only returning the default language caption and properties, how I will get different language category property like name and rewrite URL
    Will Strohl
    2020-05-12T16:57:40Z
    Hello:

    Can you please provide some more details about what was returned? I'm not sure I understand. Thanks! 🙂
    Will Strohl, Upendo Ventures
    Hotcakes Cloud  | Get Support  | Code Support 
    Official Cloud & Support provider for Hotcakes
    3ART Technologies
    2020-05-12T21:54:51Z
    Hi,
    Thanks for the reply, I have multilanguage portal English and Arabic. Once I called the product through the server-side API, it is returning me the active language product information. (Like if I am in Arabic the Arabic product data I received and When I am in English the English data is receiving).

    But when it comes to categories, whatever the language I selected it's only returning me the English data. I already make sure the translation exists.

    I don't know why this is the behaviour of API. Temporarily I collected data from the database but I want to that with API
    Will Strohl
    2020-05-13T15:23:37Z
    Have you debugged the API call? When you do, please check the code to see if you're specifying the language and also inspect the request to see if the headers are being sent with a language parameter. Even in a threaded context, you should be able to see that by debugging it.
    Will Strohl, Upendo Ventures
    Hotcakes Cloud  | Get Support  | Code Support 
    Official Cloud & Support provider for Hotcakes
    3ART Technologies
    2020-05-13T22:23:48Z
    I found very strange thing :S, Once I tried to deploy the module on the pages which created by HCC wizard, it returning me the correct value, but when i placed the same module in my customer DNN page it is only getting the English URL. In both cases the culture set as ar-SA. I did not get why it is behaving like that.

    The setting is showing me ar-SA in both pages.

    Image problem
    3ART Technologies
    2020-05-13T22:42:25Z
    I sorted out the issue
    I import using Hotcakes.Commerce.Dnn.Web; and then inherit HotcakesModuleBase instead of Dotnetnuke.Entities.Module.PortalModuleBase

    using Hotcakes.Commerce.Dnn.Web;
    public partial class Splash_Categories : HotcakesModuleBase
    solved my problem
    Will Strohl
    2020-05-15T01:49:42Z
    Ah... Yes, the Hotcakes base class extends the DNN PortalModuleBase class. Nice work!
    Will Strohl, Upendo Ventures
    Hotcakes Cloud  | Get Support  | Code Support 
    Official Cloud & Support provider for Hotcakes
    Loading
    • Sign-up for the Hotcakes Community Newsletter: