Download the PHP package mothership-ec/cog-mothership-commerce without Composer
On this page you can find all versions of the php package mothership-ec/cog-mothership-commerce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mothership-ec/cog-mothership-commerce
More information about mothership-ec/cog-mothership-commerce
Files in mothership-ec/cog-mothership-commerce
Package cog-mothership-commerce
Short Description Cog module for commerce building blocks in Mothership
License GPL-3.0+
Homepage http://mothership.ec
Informations about the package cog-mothership-commerce
Mothership Commerce
The Message\Mothership\Commerce
Cogule provides base commerce functionality for Mothership. This forms part of the building blocks for both ECommerce
and EPOS
.
Installation
Install this package using Composer. The package name is message/cog-mothership-commerce
.
You will need to add Message's private package server to the repositories
key in composer.json
:
{
"repositories": [
{
"type": "composer",
"url" : "http://packages.message.co.uk"
}
],
"require": {
"message/cog-mothership-commerce": "~4.1"
}
}
Product
A Product object represents a certain product. They provide attributes such as the category and brand as well a prices. Units allow Variants on Products such as "size" and "colour". For this reason, it is usually desirable to use Units over Products when displaying prices to users.
If no prices are provided on a Unit, it will default to the Product prices.
Product\Types
Each product has a Type associated to it. The main use of a Type is to allow different information to be required by different products. For example a MusicProductType
requires an Artist to be provided. Types also allow the "display name" to be set into to a different format.
Types provided for use within the admin panel are set in the IoC as the service product.types
. Only types registered in the service container may be used when creating products.
Product\Price
The product Pricing object is a group of prices (float) mapped against Currency and Locale. Product and Unit objects have a Pricing object which they use when calling getPrice()
, getNetPrice()
etc. This object does the legwork of getting the correct price to display based on currency and locale.
Product\Tax
Product taxes are loaded onto the product using an instance of TaxResolverInterface
. Net and Gross prices are calculated using these tax rates and an instance of TaxStrategyInterface
.
TaxResolver
The TaxResolverInterface
is an interface for a class that will take a token and an Address
and return a TaxCollection
containing all the applicable tax rates for that token/address combination. By default, the TaxResolver
is used. This looks within the tax.yml
file to resolve taxes.
TaxStrategy
Whilst it is possible to implement the interface to provide further tax strategies, realistically there are only two which will be used. These are Tax Inclusive and Tax Exclusive. These are provided within Commerce.
Product\Stock
General
Product\Stock
is responsible for handling stock changes. Every stock change is documented as a stock adjustment(Product\Stock\Movement\Adjustment\Adjustment
). Stock adjustments created within the same action(creating a new order/ adjusting stock levels in one request) are surrounded by a stock movement(Product\Stock\Movement\Movement
), to give them a reason, authorship, etc.
Stock Manager
The stock manager Product\Stock\StockManager
is responsible for creating and saving new stock movements (and adjustments). Please read the detailed readme of Product\Stock
for more information!
Movement Iterator
Also there is an Iterator for stock movements, which allows you to iterate over the stock history and get the stock level at any time before or after a movement. Please read the detailed readme of Product\Stock
for more information!
Product Page Mapper
The commerce package ships with two implementations of the product page mapper: SimpleMapper
and
OptionCriteriaMapper
. By default the SimpleMapper
is aliased to product.page_mapper
.
Configuration
To enable the mapper to correctly relate products to pages you must set the valid values for
product_content.field_name
and product_content.group_name
for product pages. Additionally you should set the valid
page types. You can change these using:
These default to:
- Field Names:
'product'
- Group Names:
null
- Page Types:
'product'
Simple Mapper
The simple mapper just matches a basic product to a page.
Usage
Option Criteria Mapper
The option criteria mapper can additionally apply a filter for a specific product option, for example ['colour' => 'red']
. You can pass any number of options: ['colour' => 'red', 'size' => 'medium']
.
To enable the option criteria mapper you must alias it to the page mapper in your services:
Usage
In addition to the previous methods, you can also call:
Custom Mappers
When writing a custom mapper you should extend AbstractMapper
to ensure compatibility.
Filters
You can optionally pass in filter callbacks that are applied after the results are pulled from the database. Returning false
from the callback will remove the object from the results.
Usage
License
Mothership E-Commerce Copyright (C) 2015 Jamie Freeman
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
All versions of cog-mothership-commerce with dependencies
mothership-ec/cog Version ~4.10
mothership-ec/cog-mothership-user Version ~4.0
mothership-ec/cog-imageresize Version ~2.0
mothership-ec/cog-mothership-file-manager Version ~3.1
mothership-ec/cog-mothership-cp Version ~3.2
mothership-ec/cog-mothership-reports Version ~2.1
domisys/image_barcode2 Version 3.0.0