Shopping cart

Your cart is currently empty

Your cart is currently empty

Before proceed to checkout you must add some products to your shopping cart. You will find a lot of interesting products on our shop page.

Continue shopping

Offering digital goods online - Amazon does it with eBooks, on Beatport I get the latest music offers and in the AppStore of my smartphone, Apple, Google or Microsoft offer me music and software downloads, at any time and any place. The sales market for download products is booming; after all, the offer is available everywhere and often cheaper than in a shop, which can often only be reached by car.

A trend is emerging and tending strongly towards "digital shopping" and mobile shopping.

Since OXID eShop version 4.6.0 provides the option "intangible products", it is easy to offer 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 done either via the shop administration or, in the case of larger data volumes, with the FTP programme. If the files are transferred via FTP, they must be assigned to the corresponding article in the Shop Administration. You can then purchase the download item in the shop.

Oxid Standard Download Produktmanagement

At first glance, everything seems simple and easy to administer. However, if frequent file changes or updates come into play, such as with web software products, the maintenance and provision of the products with on-board resources can take up a lot of time. Time that is lacking elsewhere. An easier way to provide products must be found.

OXID paid downloads with Git versioning

When software is developed in a team, sooner or later you can't avoid versioning. We at Netensio use the popular free version management system git. Git manages our products as tags (stable versions) on the one hand and the current developer versions on the other. This construct can be found in a similar form in a large part of the OXID developer community. The git community has become very large, many developers version their software and even entire software systems with the free version management.

Let's clarify the situation again. We have a shop system that can accept download products and finished software products are in our version management. So we are looking for a common and convenient way to fetch data from git and turn it into an OXID download product.

OXID / GIT article download module

I 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 in addition to the provision as open source software an option to encrypt .php files with using Ioncube Encoder. I will only go into the encryption of the software very superficially, I am also not yet satisfied with some parts of the module, which is why I am refraining from publishing it at the moment. In this article I prioritise 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 each time to generate a download product from git, I create a Deployment Plan object, a new database table for saved 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 articles.

OXID / GIT Download Artikel Deployment

I deliberately chose to create the profile per article to be able to address external git servers with different users. In principle, any repository on Github could be loaded into the OXID eShop as a download product. The deployment profile also enables 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. The following list shows exactly what this button does:

  • The git tag/branch targeted in the deployment profile is cloned into a temp directory.
  • OXID eShop cleans the cloned directory from git's own directories.
  • The temp directory will be encrypted with Ioncube if desired.
  • The temporary directory gets the oxarticle__oxfile if desired.
  • The directory is moved as a ZIP archive to the folder /out/downloads/uploads.
  • 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 from the module.

Keep OXID / GIT Deployment article up to date

The download product is immediately available in the shop at the end of the process and 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 has been tagged in git, you only have to adjust the tag name in the existing deployment profile in Oxid and you 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 " into a temporary directory specified in the global module settings. The directory is then cleaned according to the deployment rules and populated with the additional data. Once all the data from the deployment profile has been collected, a check is made as to whether encrypted or open source should be transferred to the article object. 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.

Oxid Moduleinstellungen GIT Download-Produkte

If you enjoyed this article or would like to see suggestions, questions or code samples, get in touch via the comments and don't forget to share. See you then!

Further information

Visitors interested in this article have also found useful information on this topic on the following pages.

Related posts

Discover more interesting posts.