Download the PHP package offline/oc-microcart-plugin without Composer

On this page you can find all versions of the php package offline/oc-microcart-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oc-microcart-plugin

oc-microcart-plugin

The OFFLINE.MicroCart plugin aims to provide simple shopping cart and payment features.

This plugin is meant for projects where simple items are sold online (Tickets, Coupons, etc). You will have to implement the "item part" (like a Ticket model) yourself. You can use the plugin as cart and payment solution.

Features

The OFFLINE.MicroCart plugin provides the following features:

It does not provide any of these features:

If you are looking for a fully featured eCommerce solution for October CMS check out OFFLINE.Mall.

Getting up and running

Create your own plugin that extends MicroCart

The MicroCart plugin is meant to be extended by your own plugins. Refer to the official October CMS docs for a list of all extension possibilities.

Backend menu

The plugin does by default not register any backend menu items. You can use the following snippet in your own Plugin.php to use the default orders overview.

Cart component

The plugin does not register any components but it provides you with a Cart base component that you can extend.

Simply register your own component and build from there.

Register your component in your Plugin.php.

Make sure the component extends MicroCart's base component.

To modify validation rules and messages take a look at the getValidationRules, getFieldNames and getValidationMessages methods on the base Cart class.

Copy the default partials from MicroCart's base component to your own component. Modify them as needed.

Updating the cart partials

You can return $this->refreshCart(); from your Cart component's methods to refresh the cart display.

Using payment providers

There are three payment providers supported out-of-the-box:

Run the composer commands beside each provider you plan to use. You can configure the providers via October's backend settings.

Custom payment providers

To register a custom PaymentProvider create a class that extends MicroCart's PaymentProvider class. Check out the existing providers to get some inspiration on how to create your own.

In your Plugin.php register this custom provider by returning them from a registerPaymentProviders method.

Link your model to cart items

The easiest way to link a model to a CartItem is to add a simple belongsTo relationship.

API

Cart

Get the user's cart

Add an item to the cart

Ensure an item is in the cart

Remove an item from the cart

Remove all items with a given code from the cart

Update an item's quantity

Service fees and discounts

Set the kind attribute to either CartItem::KIND_SERVICE or CartItem::KIND_DISCOUNT if the item is a service fee (Shipping, Handling) or a discount. Use the ensure method to make sure it's only added once to the Cart.

Access cart contents

You can access all cart items using the $cart->items relation.

You also have access to filtered list_items, service_fees and discounts properties that only contain the given item types.

Print the customer's address

After a Cart checkout has been successful, you can use the following helpers to get the customer's address as an array or an escaped HTML string.

CartItem

Create an item

Access item information

Money

There is a Money singleton class available to format cents as a string. A microcart_money Twig helper is registered as well.

Change the default money formatter

You can register your own formatter function by adding the following code to your Plugin's register method.

Events

Cart

offline.microcart.cart.beforeAdd

Fired before an item is added to the Cart. It receives the following arguments:

offline.microcart.cart.afterAdd

Fired after an item has been added to the Cart. It receives the following arguments:

offline.microcart.cart.beforeRemove

Fired before an item is removed from the Cart. It receives the following arguments:

offline.microcart.cart.afterRemove

Fired after an item has been removed from the Cart. It receives the following arguments:

offline.microcart.cart.quantityChanged

Fired after the quantity of a cart item has changed.

Checkout

offline.microcart.checkout.succeeded

Fired after a checkout was successful.

offline.microcart.checkout.failed

Fired after a checkout has failed.

offline.microcart.checkout.cancelled

Fired after a checkout has been cancelled.


All versions of oc-microcart-plugin with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.0
league/omnipay Version ^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package offline/oc-microcart-plugin contains the following files

Loading the files please wait ....