SF5 Module builder issues

Posted by Community Admin on 04-Aug-2018 12:13

SF5 Module builder issues

All Replies

Posted by Community Admin on 07-Jun-2012 00:00

Hi

 

I have built a custom module using the module builder in Sitefinity 5. The aim of the module is to display a list of files that can be downloaded/viewed. This list has to be filtered by country and category. I can get the filtering to work manually ie. Using the categories widget on the page I can click the links and get the list to display the filtered files. But I need to be able to accomplish the filtering programmatically, that is I need a page to be loaded with files relevant only to the country that the logged in user entered when they registered. Also I need to programmatically build a categories menu based on the list of categories that are present in the classification ie. If I add a new category from the Sitefinity dashboard this category is added to the menu when the page loads.

I have two main problems with accomplishing the above;

  1. When the country classification is built the country is entered in the database in an encoded form ie. 8543679b-aee6-4b5d-a8fd-e01eb6252262. Is it possible to decode this to get the actual county entered?
  2. When a file is added to the content list I need to be able to select the country from a list of 300+ countries, I don’t have the time to enter them manually when I use the module builder. can I create this list programmatically?  

Hope you can help

 

Thanks

 

Dan

Posted by Community Admin on 08-Jun-2012 00:00

You should be able to accomplish this using the TaxonomyManager in the API. This allows you to perform CRUD operations to taxonomies intuitively. For some examples check out the Hierarchical Taxonomy API

you can use this to both retrieve the Title of a category as well as batch process from say an xml file (or the EcommerceConfig countries property)

Hope this is helpful!

Posted by Community Admin on 14-Jun-2012 00:00

Hi

Thanks for your help on this and in another thread. I can now pull out nearly all the data i need. The only thing i am missing is the link to the file uploaded using the custom module. I can get file name, publication date etc but all i can get for the file is;
                Telerik.Sitefinity.Model.ContentLinks.ContentLink[]
How can i resolve this to build a download link to the file?

Hope you can help

Thanks again

Posted by Community Admin on 14-Jun-2012 00:00

Hi Dan,

the data type of media content (such as videos, docs, and images) is always going to be an array of Guid for the IDs of the items, even for a single item.

The best way I've found to do this is with a helper method that uses the API to retrieve that item by ID and then I can get the remaining data (url, title, etc).

For an example, take a look at this post: Retrieving Data From Dynamic Modules Using the Module Builder API specifically the section Binding to Fields

Hope this is helpful!

This thread is closed