The needed information to run the plugin is stored in the following table:
- ProductId (product id)
- ProhibitedCountryCodes (JSON formatted list of strings containing country codes where the product can’t be sold)
- Language (language id)
The record associated to a product will be created on first use (reading or updating) if it doesn’t exist.
Public product interface
The public product page modified to reflect the tariff modality (free / shareware / paid) associated with downloadable products.
The displayed title, the short description and the description, the ones corresponding to the current language. A link to display the original version proposed for texts which haven’t been written in the current language (based on the ProductExt.Language field). E.g.: «Read the original version (spanish)». The original version is displayed using an Ajax filed div, in order to make texts not appear in the HTML code.
For legal reason, some downloadable products can not be sold (and even browsed) in some countries.The ProhibitedCountryCodes field is contains a JSON formatted list of country codes (strings) where the product can’t be sold. If this list isn't blank and if it's valid (from a JSON point of view) a synchronous call to the Freegeoip.net service is performed with a 3 sec. timeout, ex.: http://freegeoip.net/json/user_ip If the response is usable, the IP address of the user and the associated country code will be stored in the application cache to be reused for a period of 24h. If the country code associated with the IP is part of the list contained in ProhibitedCountryCodes, a page containing a message explaining that the product can not be accessed from the country from which the user is viewing the site will be displayed and a message will be added to the nopCommerce log file.
If the product is free, the "Add to cart" button is replaced by a link allowing to download directly the product. The link activation open of a modal pop-up surrounded by a translucent background, displaying:
- A link to close the pop-up
- A combo box displaying a text license (multilingual resource)
- A link to refuse the terms of download and close the pop-up
- A link to accept the terms of download and download the file.
If the user isn’t logged in, he or she will be redirected toward the register/login page after that user will be returned to the product page with the modal pop-up open and accessible. The download of the file will be viewed as a regular paid sale - with a zero price - causing all needed activity files updates and all necessary events firings.
If the product is shareware, the link "Add to cart" will be replaced by a download link like the one described above (only the license text, stored in a different resource, will vary) and below which a "Pay" button allowing the user to pay the displayed price will be added (the process will be identical to the paid file case).
Other products variant
The shopping cart process stay the same.