Skip to content

Commit

Permalink
Simple Commerce v6 (#188)
Browse files Browse the repository at this point in the history
* Widgets

* Handle should be value.

* Update default product blueprints

Related: duncanmcclean/simple-commerce#986

* New namespace

* Update package namespace
  • Loading branch information
duncanmcclean authored Feb 11, 2024
1 parent d115cfc commit b7777cd
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 27 deletions.
2 changes: 1 addition & 1 deletion app/Tags/JsonRegions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Tags;

use DoubleThreeDigital\SimpleCommerce\Regions;
use DuncanMcClean\SimpleCommerce\Regions;
use Statamic\Tags\Tags;

class JsonRegions extends Tags
Expand Down
20 changes: 10 additions & 10 deletions config/simple-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

'shipping' => [
'methods' => [
\DoubleThreeDigital\SimpleCommerce\Shipping\FreeShipping::class => [],
\DuncanMcClean\SimpleCommerce\Shipping\FreeShipping::class => [],
],
],
],
Expand All @@ -39,11 +39,11 @@
*/

'gateways' => [
\DoubleThreeDigital\SimpleCommerce\Gateways\Builtin\DummyGateway::class => [
\DuncanMcClean\SimpleCommerce\Gateways\Builtin\DummyGateway::class => [
'display' => 'Card',
],

// \DoubleThreeDigital\SimpleCommerce\Gateways\Builtin\StripeGateway::class => [
// \DuncanMcClean\SimpleCommerce\Gateways\Builtin\StripeGateway::class => [
// 'key' => env('STRIPE_KEY'),
// 'secret' => env('STRIPE_SECRET'),
// ],
Expand All @@ -64,17 +64,17 @@

'notifications' => [
'order_paid' => [
// \DoubleThreeDigital\SimpleCommerce\Notifications\CustomerOrderPaid::class => [
// \DuncanMcClean\SimpleCommerce\Notifications\CustomerOrderPaid::class => [
// 'to' => 'customer',
// ],

// \DoubleThreeDigital\SimpleCommerce\Notifications\BackOfficeOrderPaid::class => [
// \DuncanMcClean\SimpleCommerce\Notifications\BackOfficeOrderPaid::class => [
// 'to' => '[email protected]',
// ],
],

'order_shipped' => [
// \DoubleThreeDigital\SimpleCommerce\Notifications\CustomerOrderShipped::class => [
// \DuncanMcClean\SimpleCommerce\Notifications\CustomerOrderShipped::class => [
// 'to' => 'customer',
// ],
],
Expand Down Expand Up @@ -117,7 +117,7 @@
|
*/

'tax_engine' => \DoubleThreeDigital\SimpleCommerce\Tax\BasicTaxEngine::class,
'tax_engine' => \DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine::class,

'tax_engine_config' => [
// Basic Engine
Expand Down Expand Up @@ -156,17 +156,17 @@

'content' => [
'customers' => [
'repository' => \DoubleThreeDigital\SimpleCommerce\Customers\EntryCustomerRepository::class,
'repository' => \DuncanMcClean\SimpleCommerce\Customers\EntryCustomerRepository::class,
'collection' => 'customers',
],

'orders' => [
'repository' => \DoubleThreeDigital\SimpleCommerce\Orders\EntryOrderRepository::class,
'repository' => \DuncanMcClean\SimpleCommerce\Orders\EntryOrderRepository::class,
'collection' => 'orders',
],

'products' => [
'repository' => \DoubleThreeDigital\SimpleCommerce\Products\EntryProductRepository::class,
'repository' => \DuncanMcClean\SimpleCommerce\Products\EntryProductRepository::class,
'collection' => 'products',
],
],
Expand Down
159 changes: 159 additions & 0 deletions config/statamic/cp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Control Panel
|--------------------------------------------------------------------------
|
| Whether the Control Panel should be enabled, and through what route.
|
*/

'enabled' => env('CP_ENABLED', true),

'route' => env('CP_ROUTE', 'cp'),

/*
|--------------------------------------------------------------------------
| Start Page
|--------------------------------------------------------------------------
|
| When a user logs into the Control Panel, they will be taken here.
| For example: "dashboard", "collections/pages", etc.
|
*/

'start_page' => 'dashboard',

/*
|--------------------------------------------------------------------------
| Dashboard Widgets
|--------------------------------------------------------------------------
|
| Here you may define any number of dashboard widgets. You're free to
| use the same widget multiple times in different configurations.
|
*/

'widgets' => [
[
'type' => 'orders_chart',
'width' => 100,
],
[
'type' => 'recent_orders',
'limit' => 5,
'width' => 50,
],
[
'type' => 'top_customers',
'limit' => 5,
'width' => 50,
],
[
'type' => 'low_stock_products',
'limit' => 5,
'width' => 50,
],
],

/*
|--------------------------------------------------------------------------
| Date Format
|--------------------------------------------------------------------------
|
| When a date is encountered throughout the Control Panel, it will be
| rendered in the following format unless overridden in specific
| fields, and so on. Any PHP date variables are permitted.
|
| This takes precedence over the date_format in system.php.
|
| https://www.php.net/manual/en/function.date.php
|
*/

'date_format' => 'Y-m-d',

/*
|--------------------------------------------------------------------------
| Pagination
|--------------------------------------------------------------------------
|
| Here you may define the default pagination size as well as the options
| the user can select on any paginated listing in the Control Panel.
|
*/

'pagination_size' => 50,

'pagination_size_options' => [10, 25, 50, 100, 500],

/*
|--------------------------------------------------------------------------
| Links to Documentation
|--------------------------------------------------------------------------
|
| Show contextual links to documentation throughout the Control Panel.
|
*/

'link_to_docs' => env('STATAMIC_LINK_TO_DOCS', true),

/*
|--------------------------------------------------------------------------
| Support Link
|--------------------------------------------------------------------------
|
| Set the location of the support link in the "Useful Links" header
| dropdown. Use 'false' to remove it entirely.
|
*/

'support_url' => env('STATAMIC_SUPPORT_URL', 'https://statamic.com/support'),

/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Optionally spice up the login and other outside-the-control-panel
| screens. You may choose between "rad" or "business" themes.
|
*/

'theme' => env('STATAMIC_THEME', 'rad'),

/*
|--------------------------------------------------------------------------
| White Labeling
|--------------------------------------------------------------------------
|
| When in Pro Mode you may replace the Statamic name, logo, favicon,
| and add your own CSS to the control panel to match your
| company or client's brand.
|
*/

'custom_cms_name' => env('STATAMIC_CUSTOM_CMS_NAME', 'Statamic'),

'custom_logo_url' => env('STATAMIC_CUSTOM_LOGO_URL', null),

'custom_favicon_url' => env('STATAMIC_CUSTOM_FAVICON_URL', null),

'custom_css_url' => env('STATAMIC_CUSTOM_CSS_URL', null),

/*
|--------------------------------------------------------------------------
| Thumbnails
|--------------------------------------------------------------------------
|
| Here you may define additional CP asset thumbnail presets.
|
*/

'thumbnail_presets' => [
// 'medium' => 800,
],
];
45 changes: 38 additions & 7 deletions resources/blueprints/collections/products/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,42 @@ sections:
always_save: false
sidebar:
display: Sidebar
fields:
sections:
-
handle: slug
field:
type: slug
localizable: true
validate:
- required
fields:
-
handle: product_type
field:
type: button_group
display: 'Product Type'
options:
physical: Physical
digital: Digital
default: physical
-
handle: slug
field:
type: slug
localizable: true
validate:
- required
-
display: 'Digital Product'
fields:
-
handle: downloadable_asset
field:
type: assets
mode: grid
display: 'Downloadable Asset'
container: assets
if:
root.product_type: 'equals digital'
-
handle: download_limit
field:
type: integer
display: 'Download Limit'
instructions: "If you'd like to limit the amount if times this product can be downloaded, set it here. Keep it blank if you'd like it to be unlimited."
if:
root.product_type: 'equals digital'
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ sections:
type: product_variants
icon: product_variants
listable: hidden
option_fields:
-
handle: downloadable_asset
field:
type: assets
mode: grid
display: 'Downloadable Asset'
container: assets
if:
root.product_type: 'equals digital'
-
handle: download_limit
field:
type: integer
display: 'Download Limit'
instructions: "If you'd like to limit the amount if times this product can be downloaded, set it here. Keep it blank if you'd like it to be unlimited."
if:
root.product_type: 'equals digital'
-
handle: photos
field:
Expand Down Expand Up @@ -70,11 +88,22 @@ sections:
always_save: false
sidebar:
display: Sidebar
fields:
sections:
-
handle: slug
field:
type: slug
localizable: true
validate:
- required
fields:
-
handle: product_type
field:
type: button_group
display: 'Product Type'
options:
physical: Physical
digital: Digital
default: physical
-
handle: slug
field:
type: slug
localizable: true
validate:
- required
2 changes: 1 addition & 1 deletion resources/views/checkout/payment.antlers.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2 class="text-gray-900 font-bold text-2xl mb-4">
<div class="grid md:grid-cols-12 gap-6 mb-6">
{{ partial:components/forms/select_field width="100" handle="gateway" display="Payment Method" x-model="gateway" required="true" }}
{{ sc:gateways }}
<option value="{{ class }}" {{ if first }} selected {{ /if }}>{{ display }}</option>
<option value="{{ handle }}" {{ if first }} selected {{ /if }}>{{ display }}</option>
{{ /sc:gateways }}
{{ /partial:components/forms/select_field }}
</div>
Expand Down
3 changes: 2 additions & 1 deletion starter-kit.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export_paths:
- app/Tags/JsonRegions.php
- config/statamic/cp.php
- config/statamic/editions.php
- config/statamic/sites.php
- config/simple-commerce.php
Expand Down Expand Up @@ -28,4 +29,4 @@ export_paths:
- tailwind.config.typography.js
- vite.config.js
dependencies:
doublethreedigital/simple-commerce: "^5.0"
duncanmcclean/simple-commerce: "^6.0"

0 comments on commit b7777cd

Please sign in to comment.