Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  FriendlyName: MyPlugin
SystemName: MyCompany.MyPlugin
Group: Analytics
Version: 1.00
MinAppVersion: 2.1.1
Author: My Company
DisplayOrder: 1
FileName: MyCompany.MyPlugin.dll
ResourceRootKey: Plugins.MyCompany.MyPlugin

 


Configuration values

  • FriendlyName: is the name of the plugin that will be displayed if the plugin hasn't yet been installed, hence the resource for the friendly name can't be displayed
  • SystemName: Unique name to identify the plugin within the system
  • Group: Name of the group in which the plugin should be displayed. Available group names are Admin, Marketing, Payment, Shipping, Tax, Analytics, CMS, Media, SEO, Data, Globalization, Api, Mobile, Social, Security, Developer, Sales, Design, and Misc
  • Version: Version of the plugin
  • MinAppVersion: Minimum SmartStore.NET version in which the plugin can be executed
  • Author: Author name
  • DisplayOrder: Order in which the plugin should be displayed
  • FileName: Name of the dll.  The convention for this name is Companyname.Pluginname (e.g. SmartStore.PayPal). The name you've defined here should also be defined in the project settings of your plugin Plugin Project > Properties > Application > Assemblyname, and it should be the standardnamespace  Plugin Project > Properties > Application > Standardnamespace
  • ResourceRootKey: Default resource key
  • Url: The URL where the plugin can be obtained. If you're providing the plugin in the SmartStore Community Marketplace, you should place the Marketplace detail view of your plugin here. This way, the users of your plugin can visit it directly form the plugin management area of the backend of SmartStore.NET, and can stay updated or write comments regarding the plugin in the marketplace.

...

Your Plugin settings have to be derived from the ISettings class so that they can be saved and retrieved from the setting service of SmartStore.NET. Your setting class should contain all the values that the shop admin needs to configure your plugin. You can choose to provide either global settings for all configured stores in a multi-store environment or settings that can be set individually for a store. Therefore, you must implement the store scope configuration view.

 


Code Block
languagexml
@Html.Action("StoreScopeConfiguration", "Setting", new { area = "Admin" })

This will render the following control to your configuration view.

 


If you implement a configuration option where users have to enter a simple string, you can simply use SettingEditorFor in your configuration view.

...

This will render your controls as they appear in the following screen, so that users can define if they want to override the settings for a certain store.

 


In the POST-ActionResult of the configuration view that will be launched when a user clicks the Save button, shop-dependent settings should be stored as follows:

...

Code Block
languagec#
_localizationService.ImportPluginResourcesFromXml(this.PluginDescriptor);

 


and delete them during uninstall with

Code Block
languagec#
_localizationService.DeleteLocaleStringResources(PluginDescriptor.ResourceRootKey);

 


You can add the required resources either as direct child nodes of the Language node or as child nodes of another LocalResource node. For a LocalResource node, you can specify the attributes Name and AppenRootKey, which is true by default. The Name attribute defines a unique key of the resource with which you can obtain the resource in your views. The AppendRootKey defines whether the ResourceRootKey, which you have defined in the desciption.txt of your plugin, should be prepended to the Name. If your resources are child nodes of another LocaleResource node, the name will be appended to the name of the parent resource name.

...

Code Block
languagexml
<Language Name="English" IsDefault="false" IsRightToLeft="false">
  <LocaleResource Name="Plugins.Payments.MyPlugin" AppendRootKey="false">
    <Children>
      <LocaleResource Name="ConfigSaveNote">
        <Value>Your settings were successfully saved.</Value>
      </LocaleResource>
		...

 


The setting above can be obtained with the key Plugins.Payments.MyPlugin.ConfigSaveNote. In a view, you can display the resource with @T("Plugins.Payments.MyPlugin.ConfigSaveNote").

...

Info
titleTip

If you don't need providers you can implement the interfaces above also within your plugin.

 


Content

Within the /Content directory, you should place any content you need within your plugin (e.g. css-files, javascript-files, images).

...

The root path is your SmartStore.Web project which contains your plugin. After entering this path, you can read the extensions that are included within. Then, you just need to choose your plugin and an output path and click on Create package

Advanced Topics