How to add video to your nopCommerce products

Recently, we released our HTML widget plugin. It’s a very neat feature that allows you to add custom HTML to different parts of nopCommerce – text, images and video. Wait, you cannot add video.

In its recent updates, NopCommerce improved the rich text editor they were using, which was a great move for the user experience. But the implementation has a flaw with Roxyfilemanager – it cannot recognize video files. Fortunately we were able to detect the problem and outline the solution for you. Just add the following code to your RoxyFilemanagerController.cs, build the project and enjoy the video editor!

This method:
protected string GetFileType(string ext)

Should be updated as below:
protected string GetFileType(string ext)
{
string ret = “file”;
ext = ext.ToLower();
if (ext == “.jpg” || ext == “.jpeg” || ext == “.png” || ext == “.gif”)
ret = “image”;
else if (ext == “.swf” || ext == “.flv”)
ret = “flash”;
else if (ext == “.webm” || ext == “.mp4” || ext == “.ogg” || ext == “.mp3” || ext == “.wav”)
ret = “media”;
return ret;
}

This will allow you make full use of the Insert Video feature of Roxy Filemanager (part of TinyMCE) – and no need for video plugins anymore.

Note: this fix applies to nopCommerce 3.7