website logo
⌘K
Introduction
PORTAL
Agency Whitelabelling
PAGES
Pages - Accessing Page Data
Pagination Layouts
Page Templates
FORMS
Form Confirmation Pages
Adding a Progress Bar
Adding Custom CSS To Show Form Submit Process
Dynamic Content in Workflow and Autoresponder Emails
How to output Custom Field Set fields in a Form's Custom Layout
Custom JavaScript Validation for Forms
File Upload Previews
FAQ
CATEGORIES
Filtering WebApps and Modules by Categories
Outputting Categories on WebApp / Module / eCommerce Layouts
Outputting Category Fields in any Location
Category Detail Layouts
FAQ
COMPANY INFORMATION
Company Information
SITE SEARCH
Site Search
PUBLIC API/ZAPIER
Zapier - Formatting arrays correctly
Public API/Zapier Changelog
MODULES
Module Marketplace
Building Custom Modules
Siteglide Modules
Front-end Submit Modules
DATA STRUCTURES
Automations
Creating WebApps from the CLI
Field Types
WEBAPPS
Front-end Submit WebApps
Layouts
Search and Filtering
Understanding Custom Field Names and IDs
FAQ
CRM
User Details
User Secure Zones
Storing User's Favourite WebApp / Module Items
User's Form Submissions (Cases)
How Users Edit their Email and Password Front End
Editing a User's CRM record Front End with Custom Field Sets
CLI
Introducing Siteglide CLI
CLI Changelog
Secure Zones with CLI
Page Templates with Siteglide CLI
Pages with Siteglide CLI
Includes with Siteglide CLI
Managing Email Templates
Migrate - Manual Form setup
Migrate - Convert existing Forms
Liquid
Accessing Assets
Liquid Dot Notation
Using WebApp Collections- Tutorial
Using the current_user object with Secure Zones
Preventing Duplicate Content with Query Parameters- Canonical URL and Robots.txt
FAQ
GraphQL
Tutorial Overview
About GraphQL
Tutorial 1- Your First Query
Tutorial 2 - Pagination
Tutorial 3 - Filtering the Results
Tutorial 3 - Answers to the First Filtering Challenge
Tutorial 4 - Advanced Filtering
Tutorial 4 - Challenge Answers
Tutorial 5 - Using Liquid to run GraphQL queries on your Site
Tutorial 6 - Variables
Tutorial 6 - Answers to the Variables Challenge
Tutorial 7 - Sorting
Tutorial 8 - Building a Liquid API GET Endpoint Page powered by GraphQL queries
Best Practice and Performance
Module/WebApp Caching
Getting Started with Liquid Caching - to Reduce Server Response time and Improve Performance
Includes
ecommerce/checkout_standard
Frequently Asked Questions
Using Liquid Logic to Check if a field exists, or is empty on the Front End
How do I learn more about Liquid?
How to setup a multi domain start page
Docs powered by archbee 
13min

How to Sell Digital Products

In this article I'll explain how you can use our Media Download and eCommerce Modules to sell digital products

Prerequisites

  • You have installed the Secure Zone Module's latest version
  • You have installed the Media Downloads and eCommerce Modules
  • You have created Products.
  • You have followed our document on Cart, Checkout and Orders Flow with the Secure Zone Module

Introduction

In this article, I'll explain how you can datasource to a Media Download Item to a Product- allowing the Product to be downloaded after it has been purchased.

To ensure that the Media Download can only be accessed after the Product has been purchased we'll output it within a User Orders Layout.

Create a Media Download Item

Firstly, let's create our downloadable Product, to do this we'll create a new Media Download Item, you'll need to repeat this step for every product that can be downloaded. We'll be using an image for this example, but you can use any file type that the Media Download Module supports:

Document image

Add Datasource Field to your Products

Now we've added our downloadable product, let's Datasource it to the Product it is related to, we'll need to add a new Custom Field to our Products- to do this go to: eCommerce > Products > Edit Module Structure. Then add a new field and set the type to 'Datasource (Single item)':

Document image

Finally, let's link each of our Media Download items to the Products they're associated with, to do this head to eCommerce > Products > Your product > Custom Fields. You should see a dropdown containing all the Media Download items, select the one that matches your Product:

Document image

Output the Media Download link within your User Orders layout

Now we've got everything needed for our Products to be downloadable, let's output the download somewhere it can only be accessed after being purchased. Locate the `user_orders` layout within the Secure Zone Module: Code Editor > Modules > Module_5 (Secure Zones) > user_orders. Within this layout we'll have access to the `orders` object, containing all of the User's previous purchases, this should also contain a order_products (old) or order_products_flat (new) object (depending on your eCommerce Module version) within each order. This contains information about the Product purchased, we'll have access to the Media Download Item ID from here.

We can output the Products data like so

HTML
|

However, we just need the Media Download Item ID which can be outputted like so, if you have other Custom Fields you'll need to replace 'product_1' with the field name

HTML
|

If there are multiple Products in one Order, we'll need to create an array of the Media Download Item IDs for each Product, we'll nest another loop within the loop above over {{orders}} - here's how this would look:

HTML
|

So no we've assigned all of our Media Download IDs to 'media_download_id'- we'll use this within the 'item_ids' parameter on our Media Download Layout include:

HTML
|

Now, locate your Media Download layouts- these can be found under: Code Editor > Modules > Module_17 (Media Downloads). From here you can either use an existing layout or copy the default layout structure to create your own (ensure you've added a 'list' folder within the folder for your layout, the 'list' folder should then contain item and wrapper layouts). We'll only need to include the Media Download Items within the 'wrapper' file, here's how this looks:

HTML
|

Then within the 'item' layout, we'll add an anchor to allow the items to be downloaded- we'll also output the name of the Media Download Item as the anchor's text: <p><a href="{{this['url']}}">{{this['name']}}</a></p>

Updated 07 Dec 2021
Did this page help you?
Yes
No
UP NEXT
How can I change the Detail View for Products based on their category?
Docs powered by archbee 
TABLE OF CONTENTS
Introduction
Create a Media Download Item
Add Datasource Field to your Products
Output the Media Download link within your User Orders layout