OFFLINE-GmbH / oc-snipcartshop-plugin

Ecommerce solution for October CMS using snipcart.com as a backend
MIT License
11 stars 4 forks source link
e-commerce octobercms octobercms-plugin snipcart

oc-snipcartshop-plugin

This plugin is no longer maintained!

If you use Snipcart with October feel free to form this repo.


Ecommerce solution for October CMS using snipcart.com as a backend.

Demo: https://snipcart.offline.swiss

Please note: this plugin is not affiliated with Snipcart directly. It simply provides an easy way to use the third-party e-commerce service with October CMS. Therefore, Snipcart-specific questions may need to be directly put through Snipcart's support. We'll provide support for plugin-specific questions, and plugin maintenance.

Features

Quickstart

  1. Create an account on snipcart.com
  2. Add the snipcartshopDependencies component to your layouts. This component includes all needed js and css files from the snipcart servers. jQuery can be included optionally as well.
  3. If you are using Rainlab.StaticPages, add a new menu entry of the type all shop categories to your navigation.
  4. Create a page and add the products component to it's markup. If you want to filter the product category by url parameter don't forget to select "Get category from url" as category filter option. Give it a url like /category/:slug* (don't forget the star if you want to use subcategories). Select this page in the plugin's backend settings under category page.
  5. Create a page and add the product component to it's markup. Give it a url like /product/:slug. Select this page in the plugin's backend settings under product page.
  6. Setup at least one currency in the plugin's backend settings. Set up the same currencies in your Snipcart dashboard under Account / Regional Settings.
  7. If you are using discounts, make sure to set up Task scheduling for your October installation. This way the discount usage stats will get updated every hour.
  8. Create a public and a private API key in your Snipcart dashboard under Account / Credentials. Paste both keys in the respective input field in the plugin's backend settings.
  9. Copy your custom webhook URL from the plugin's backend settings (under API and webhooks). Set the URL as Webhooks URL in your Snipcart dashboard under Account / Webhooks

Custom currency format

Starting with version 1.0.32 you are able to specify a custom currency format in the backend settings. The code you provide is parsed as a Twig template so all the functionality of Twig is available.

If you do not enter a specific format the following will be used

{{ currency }} {{ price|number_format(2, '.', '\'') }}

The following variables are available

Variable Description Example value
price The full price of the product as float 1500.40
integers The price without decimals 1500
decimals Only the decimals of the price 40
currency The currency code you specified above EUR
product The product model this price is from. A full model instance

These are a few example usages:

{{ currency }} {{ price|number_format(2, '.', '\'') }}

-> EUR 1'200.40
<span class="integers">{{ integers }}</span>    
<span class="separator">,</span>    
<span class="decimals">{{ decimals }}</span>    
<span class="currency">{{ currency }}</span>  

-> 1200,40 EUR
{{ price|number_format(2, '.', '\'') }} {{ currency }} 

{% if (product.taxable) %}
    (VAT included)
{% else %}
    (VAT excluded)
{% endif %}

-> 1200,40 EUR (VAT included)