All Projects → pixelandtonic → DigitalProducts

pixelandtonic / DigitalProducts

Licence: MIT license
Sell digital products with Craft Commerce

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to DigitalProducts

Commerce
Fully integrated ecommerce for Craft CMS
Stars: ✭ 144 (+200%)
Mutual labels:  ecommerce, commerce, craftcms, craft-plugin, e-commerce
Vc Storefront
VirtoCommerce Storefront for ASP.NET Core 3.1 repository
Stars: ✭ 122 (+154.17%)
Mutual labels:  ecommerce, commerce, e-commerce
commerce-stripe
Stripe payment gateway for Craft Commerce
Stars: ✭ 21 (-56.25%)
Mutual labels:  craftcms, craft-plugin, craft-commerce
Reaction
Mailchimp Open Commerce is an API-first, headless commerce platform built using Node.js, React, GraphQL. Deployed via Docker and Kubernetes.
Stars: ✭ 11,588 (+24041.67%)
Mutual labels:  ecommerce, commerce, e-commerce
Vc Platform
VirtoCommerce Platform repository
Stars: ✭ 828 (+1625%)
Mutual labels:  ecommerce, commerce, e-commerce
Jet
Jet is an e-commerce framework for Amber / Crystal
Stars: ✭ 18 (-62.5%)
Mutual labels:  ecommerce, commerce, e-commerce
Saleor
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.
Stars: ✭ 14,720 (+30566.67%)
Mutual labels:  ecommerce, commerce, e-commerce
craft.doxter
Markdown editor and parser for Craft CMS
Stars: ✭ 80 (+66.67%)
Mutual labels:  craftcms, craft-plugin, craft2
Ymple Ecommerce
Node js E-commerce Framework powered with Sails.js & Node.js as an Ecommerce Platform Shop Solution
Stars: ✭ 152 (+216.67%)
Mutual labels:  ecommerce, commerce, e-commerce
Next Ecommerce
⚡️ Quantum Ecommerce. Made with Next.js | GraphQL | Apollo Server | Apollo Client | SSR
Stars: ✭ 186 (+287.5%)
Mutual labels:  ecommerce, commerce, e-commerce
store-hours
Manage business hours with Craft CMS.
Stars: ✭ 60 (+25%)
Mutual labels:  craftcms, craft-plugin, craft2
Example Storefront
Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: ✭ 471 (+881.25%)
Mutual labels:  ecommerce, commerce, e-commerce
craft-commerce-widgets
Insightful widgets for Craft CMS Commerce stores
Stars: ✭ 33 (-31.25%)
Mutual labels:  ecommerce, craftcms, craft2
Ever
Ever® - Open-Source Commerce Platform for On-Demand Economy and Digital Marketplaces
Stars: ✭ 980 (+1941.67%)
Mutual labels:  ecommerce, commerce, e-commerce
saleor
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.
Stars: ✭ 15,824 (+32866.67%)
Mutual labels:  ecommerce, commerce, e-commerce
craft-router
A Craft CMS plugin for using URL segments as filtering criteria on an entry query.
Stars: ✭ 21 (-56.25%)
Mutual labels:  craftcms, craft-plugin, craft2
query
Run SQL queries as an admin from the Craft CMS control panel.
Stars: ✭ 14 (-70.83%)
Mutual labels:  craftcms, craft-plugin, craft2
craft.patrol
Patrol simplifies SSL and maintenance routing for sites built with Craft
Stars: ✭ 90 (+87.5%)
Mutual labels:  craftcms, craft-plugin, craft2
Orocommerce
Main OroCommerce package with core functionality.
Stars: ✭ 148 (+208.33%)
Mutual labels:  ecommerce, commerce, e-commerce
Coreshop
CoreShop - Pimcore eCommerce
Stars: ✭ 193 (+302.08%)
Mutual labels:  ecommerce, commerce, e-commerce

Digital Products plugin for Craft Commerce 1.x.

This plugin makes it possible to sell licenses for digital products with Craft Commerce.

Requirements

Digital Products requires Craft CMS 2.6 or later and Craft Commerce 1.1 or later.

Installation

To install Digital Products, copy the digitalproducts/ folder into craft/plugins/, and then go to Settings → Plugins and click the “Install” button next to “Digital Products”.

Configuration

Digital Products gets its own configuration file, located at craft/config/digitalproducts.php. It can have the following config settings:

  • autoAssignLicensesOnUserRegistration (boolean) – Whether licenses should be automatically assigned to newly-registered users if the emails match. (Default is true.)
  • autoAssignUserOnPurchase (boolean) – Whether license should automatically be assigned to existing users if the emails match. (Default is false.)
  • licenseKeyCharacters (string) – The available characters that can be used in license key generation. (Default is all alphanumeric ASCII characters.)
  • licenseKeyLength (integer) – The length of generated license keys. (Default is 24.)
  • requireLoggedInUser (boolean) – Whether a user must be logged in when completing an order with at least one digital product in the cart. (Default is false.)

Plugin Hooks

Digital Products offers a few hooks that enable other plugins to modify its behavior:

  • digitalProducts_modifyLicenseKey – Gives plugins a chance to modify a license key when it’s getting generated.

  • digitalProducts_modifyProductSources – Gives plugins a chance to modify the sources on digital product indexes.

  • digitalProducts_defineAdditionalProductTableAttributes – Gives plugins a chance to add additional available table attributes to digital product indexes.

  • digitalProducts_getProductTableAttributeHtml – Gives plugins a chance to override the HTML of the table cells on digital product indexes.

  • digitalProducts_modifyProductSortableAttributes – Gives plugins a chance to modify the array of sortable attributes on digital product indexes.

  • digitalProducts_modifyLicenseSources – Gives plugins a chance to modify the sources on license indexes.

  • digitalProducts_defineAdditionalLicenseTableAttributes – Gives plugins a chance to add additional available table attributes to license indexes.

  • digitalProducts_getLicenseTableAttributeHtml – Gives plugins a chance to override the HTML of the table cells on license indexes.

  • digitalProducts_modifyLicenseSortableAttributes – Gives plugins a chance to modify the array of sortable attributes on license indexes.

Events

Digital Products offers a few events that other plugins can listen to:

  • digitalProducts_products.onBeforeSaveDigitalProduct – Raised right before a digital product is saved. Passed with params product (the digital product) and isNewProduct (whether it’s new). Event handlers can prevent the digital product from being saved by setting $event->performAction = false.
  • digitalProducts_products.onSaveDigitalProduct – Raised after a digital product is saved. Passed with the param product (the digital product).
  • digitalProducts_products.onBeforeDeleteDigitalProduct – Raised right before a digital product is deleted. Passed with the param product (the digital product). Event handlers can prevent the digital product from being saved by setting $event->performAction = false.
  • digitalProducts_products.onDeleteDigitalProduct – Raised after a digital product is deleted. Passed with the param product (the digital product).
  • digitalProducts_licenses.onBeforeSaveLicense – Raised right before a license is being saved. Passed with params license (the license) and isNewLicense (whether it’s new). Event handlers can prevent the license from being saved by setting $event->performAction = false.
  • digitalProducts_licenses.onSaveLicense – Raised after a license is saved. Passed with the param license (the license).
  • digitalProducts_licenses.onBeforeDeleteLicense - Raised when a license is being deleted. Passed with the param license (the license). Event handlers can prevent the license from being saved by setting $event->performAction = false.
  • digitalProducts_licenses.onDeleteLicense - Raised when a license is deleted. Passed with the param license (the license).

Eager loading

Both licenses and products have several eager-loadable properties

Licenses

  • product - Allows you to eager-load the product associated with the license.
  • order - Allows you to eager-load the order associated with the license, if any.
  • owner - Allows you to eager-load the Craft user that owns the license, if any.

Products

  • isLicensed - Eager-loads whether the product is licensed for the currently logged in Craft User.

Examples

Displaying the licensed product for the currently logged in Craft User.

    {% if currentUser %}
        {% set licenses = craft.digitalProducts.licenses.owner(currentUser).with(['products', 'order']) %}

        <div class="panel panel-default">
        <div class="panel-heading"><h3 class="panel-title">Licenses</h3></div>
        {% if licenses %}
            <table class="table">
                <thead>
                    <tr>
                        <th>Licensed product</th>
                        <th>License date</th>
                        <th>Order</th>
                    </tr>
                </thead>
                <tbody>
                {% for license in licenses %}
                    <tr>
                        <td><a href="{{ license.product.getUrl() }}">{{ license.product.title }}</a></td>
                        <td>{{ license.dateCreated|date('Y-m-d H:i:s') }}</td>
                        <td>
                            {% if license.orderId %}
                                <a href="https://github.com/store/order?number={{ license.order.number }}">Order no. {{ license.orderId }}</a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        {% endif %}
    {% else %}
        <p>Please log in first</p>
    {% endif %}

Checking if currently logged in user is licensed to access a product.

    {% set products = craft.digitalProducts.products({type: 'onlineCourses'}).with(['isLicensed']) %}
    {% if products %}
        <table class="table">
            <thead>
                <tr>
                    <th>Product</th>
                    <th>License status</th>
                </tr>
            </thead>
            <tbody>
                {% for product in products %}
                    <tr>
                        <td>{{ product.title }}</td>
                        <td>
                            {% if product.isLicensed() %}
                                You already own this product.
                            {% else %}
                                <a href="{{ product.getUrl() }}">Get it now!</a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}

Changelog

1.0.5

  • Fixed a bug where digital product prices would sometimes not be saved correctly.

1.0.4

  • Fixed a bug where digital product prices did not display correctly.

1.0.3

  • Added support for a plugin release feed.

1.0.2

  • Fixed bugs.

1.0.1

  • Fixed bugs.

1.0.0

  • Initial release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].