OXID / GIT download products

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.

Since Oxid eShop version 4.6.0 provides the option “immaterial 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 paid download files is either done by the shop administration or, in case of larger amounts of data, with the FTP programme. 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.


Oxid Standard Download Product Management

At first glance everything seems to be easy and comfortable to administer. 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 management 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 system.

Let us clarify the situation once again. We have a shop system which can accept download products and finished software products are in our version management. 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 oxide 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 a ZIP archive.

To avoid having 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. By a deployment profile I mean a saved set of 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.


OXID / GIT Download Article Deployment

I have deliberately chosen the profiling per article to be able to address external git servers with different users. In principle, any repository on github could be downloaded as a download product into the Oxidshop. The deployment profile also allows the activation of the previously mentioned Ioncube Encoder. However, we ignore this for the time being. Once 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 list:

  • The git tag/branch in the deployment profile will be cloned into a temp directory
  • Oxid cleans the cloned directory from git’s own directories
  • The temporary directory can be encrypted with Ioncube if desired
  • The temporary directory will receive the oxarticle__oxfile on request
  • The directory is moved as a ZIP archive to the folder /out/downloads/uploads
  • The zip file will be 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 from the module

OXID / GIT Deployment Keep article up-to-date

The download product is available in the shop immediately after the end of the process 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, it is checked whether the article object should be encrypted or open source. After the transfer to the Oxid 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.


Oxid Module Settings GIT Download Products

If you liked this article or if you want to see suggestions, questions or code samples, please contact us via the comments and don’t forget to share. See you then!