Offering digital goods online - Amazon does it with eBooks, on Beatport I get current music offers and in the AppStore of my smartphone Apple, Google, or Microsoft offer me music and software downloads, anytime and anywhere. The sales market for download products is booming, after all, the offer is available everywhere and often cheaper than in a shop, which is often only accessible by car.
A trend is emerging and tends strongly towards "digital shopping" and mobile shopping.
Finally download products in the OXID eShop
Seit OXID eShop version 4.6.0 provides the option "intangible products", it is a light music, eBooks, videos or games, digitally for sale in your own shop. Software can also be sold wonderfully in the shop. The upload of the paid download files is either done by the shop administration or with larger amounts of data with the FTP program. If the files are transferred via FTP, they must be assigned to the corresponding article in the Shop Administration. Then you can purchase the download article in the shop.
At first glance everything seems to be easy and comfortable to administrate. However, if frequent file changes or updates are involved, as is the case with web software products for example, the maintenance and provision of the products with on-board tools can take a lot of time. Time that is missing elsewhere. An easier way to provide products must be found.
OXID Pay Downloads with Git Versioning
When software is developed in a team, sooner or later there is no getting around versioning. We at Netensio use the popular free version control system git. Git manages our products as tags (stable versions) and the current developer versions. This construct can be found in a similar form in the majority of the OXID developer community. The git community has become very large in the meantime, many developers version their software and even entire software systems with the free version control.
Verdeutlichen we will take another look at the situation. We have a shop system that can accept download products and finished software products are available in our version control system. So we are looking for a common and comfortable way to get data from git and convert it to an OXID download product.
OXID / GIT article download module
I have decided to integrate it as an OXID module extension. The existing functionality should not be affected by my module in any way and I need an option to encrypt .php files with the Ioncube Encoder in addition to the open source software. The encryption of the software I will only go into very superficially, I am not satisfied with some parts of the module and therefore I do not publish it yet. In this article I will prioritize the checkout of the git tag and the transfer to OXID as ZIP archive.
Damit To generate a download product from git you don't have to enter the repository URL and the git user login every time, I create a deployment plan object, a new database table for stored deployment profiles and an OXID admin view including the corresponding template. A Deployment Profile is a set of saved settings that are needed to generate a download product from git. The following screenshot shows the input mask of the admin tab for creating a git deployment profile for OXID products.
Ich has chosen to create the profile per article to be able to access external git servers with different users. In principle, any repository on Github could be downloaded as a product into the OXID eShop. The deployment profile also allows the activation of the previously mentioned Ioncube Encoder. However, we ignore this for the time being. If we have created a deployment profile for the article, we can start our deployment process by clicking on Get Repo Data. What exactly this button does is shown in the following table:
- The git tag/branch in the deployment profile is cloned into a temp directory
- OXID eShop cleans the cloned directory from git's own directories
- The temporary directory can be encrypted with Ioncube if desired
- The temporary directory can contain the oxarticle__oxfile
- The directory is moved as a ZIP archive to the /out/downloads/uploads folder
- The zip file is processed as a new download product file for the article and saved as a download product hash.
- The Zip file in the folder out/downloads/uploads is removed by the module
Keep OXID / GIT Deployment article up to date
The download product is available in the shop immediately after the process is finished and is attached to the article, just as if the zip file had been uploaded manually. The nice thing about this solution is that as soon as a new product release is tagged in git, you only have to adjust the tag name in the existing deployment profile in Oxid and can deploy the current git tag as a download product.
What happens when you click on: "Get repo data
The deployment process performs a simple "git clone -b " to a temporary directory specified in the global module settings. The directory is then cleaned and populated with the additional data according to the deployment rules. Once all data has been collected from the deployment profile, the system checks whether the article object should be encrypted or open source. After the transfer to the oxide article, the temporary directories and data are removed to save storage space. The following screenshot gives you an overview of the module settings in Oxid.
If you liked this article or you want to see suggestions, questions or code samples, please feel free to post comments and don't forget to share. See you!