-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3438cd9
Showing
23 changed files
with
1,412 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"pluginName":"Order Notes","pluginDescription":"Order notes for Commerce","pluginVersion":"2.0.0","pluginAuthorName":"Superbig","pluginVendorName":"superbig","pluginAuthorUrl":"https://superbig.co","pluginAuthorGithub":"sjelfull","codeComments":"","pluginComponents":["controllers","models","records","services","settings","variables"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# CRAFT ENVIRONMENT | ||
.env.php | ||
.env.sh | ||
.env | ||
|
||
# COMPOSER | ||
/vendor | ||
|
||
# BUILD FILES | ||
/bower_components/* | ||
/node_modules/* | ||
/build/* | ||
/yarn-error.log | ||
|
||
# MISC FILES | ||
.cache | ||
.DS_Store | ||
.idea | ||
.project | ||
.settings | ||
*.esproj | ||
*.sublime-workspace | ||
*.sublime-project | ||
*.tmproj | ||
*.tmproject | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
config.codekit3 | ||
prepros-6.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Order Notes Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## 2.0.0 - 2018-04-07 | ||
### Added | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# The Craft License | ||
|
||
Copyright © <YOUR_NAME_HERE> | ||
|
||
Permission is hereby granted to any person obtaining a copy of this software | ||
(the “Software”) to use, copy, modify, merge, publish and/or distribute copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
1. **Don’t plagiarize.** The above copyright notice and this license shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
2. **Don’t use the same license on more than one project.** Each licensed copy | ||
of the Software shall be actively installed in no more than one production | ||
environment at a time. | ||
|
||
3. **Don’t mess with the licensing features.** Software features related to | ||
licensing shall not be altered or circumvented in any way, including (but | ||
not limited to) license validation, payment prompts, feature restrictions, | ||
and update eligibility. | ||
|
||
4. **Pay up.** Payment shall be made immediately upon receipt of any notice, | ||
prompt, reminder, or other message indicating that a payment is owed. | ||
|
||
5. **Follow the law.** All use of the Software shall not violate any applicable | ||
law or regulation, nor infringe the rights of any other person or entity. | ||
|
||
Failure to comply with the foregoing conditions will automatically and | ||
immediately result in termination of the permission granted hereby. This | ||
license does not include any right to receive updates to the Software or | ||
technical support. Licensees bear all risk related to the quality and | ||
performance of the Software and any modifications made or obtained to it, | ||
including liability for actual and consequential harm, such as loss or | ||
corruption of data, and any necessary service, repair, or correction. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER | ||
LIABILITY, INCLUDING SPECIAL, INCIDENTAL AND CONSEQUENTIAL DAMAGES, WHETHER IN | ||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Order Notes plugin for Craft CMS 3.x | ||
|
||
Order notes for Commerce | ||
|
||
 | ||
|
||
## Requirements | ||
|
||
This plugin requires Craft CMS 3.0.0-beta.23 or later. | ||
|
||
## Installation | ||
|
||
To install the plugin, follow these instructions. | ||
|
||
1. Open your terminal and go to your Craft project: | ||
|
||
cd /path/to/project | ||
|
||
2. Then tell Composer to load the plugin: | ||
|
||
composer require superbig/craft-ordernotes | ||
|
||
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Order Notes. | ||
|
||
## Order Notes Overview | ||
|
||
The Order Notes plugin will add a section to the Commerce Order details view, where any users with access may add notes. | ||
|
||
## Configuring Order Notes | ||
|
||
Before using the plugin, you should update all the settings values. | ||
|
||
Alternatively you can use the example config file to override the settings: | ||
|
||
```php | ||
<?php | ||
return [ | ||
// Sender Email Address | ||
'notifyEmailFrom' => '', | ||
|
||
// Sender Name | ||
'notifyEmailFromName' => '', | ||
|
||
// HTML email template - will receive order and note as variables | ||
'notifyEmailTemplate' => '', | ||
|
||
// Text email template (defaults to HTML if not set) - will receive order and note as variables | ||
'notifyEmailTemplateText' => '', | ||
|
||
// Email subject - will receive order and note as variables | ||
'notifyEmailSubject' => '', | ||
]; | ||
``` | ||
|
||
## Order Notes Roadmap | ||
|
||
* Add file attachments | ||
|
||
Brought to you by [Superbig](https://superbig.co) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "superbig/craft-ordernotes", | ||
"description": "Order notes for Commerce", | ||
"type": "craft-plugin", | ||
"version": "2.0.0", | ||
"keywords": [ | ||
"craft", | ||
"cms", | ||
"craftcms", | ||
"craft-plugin", | ||
"order notes" | ||
], | ||
"support": { | ||
"docs": "https://github.com/sjelfull/craft-ordernotes/blob/master/README.md", | ||
"issues": "https://github.com/sjelfull/craft-ordernotes/issues" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Superbig", | ||
"homepage": "https://superbig.co" | ||
} | ||
], | ||
"require": { | ||
"craftcms/cms": "^3.0.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"superbig\\ordernotes\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"name": "Order Notes", | ||
"handle": "order-notes", | ||
"hasCpSettings": true, | ||
"hasCpSection": false, | ||
"changelogUrl": "https://raw.githubusercontent.com/sjelfull/craft-ordernotes/master/CHANGELOG.md", | ||
"components": { | ||
"orderNotes": "superbig\\ordernotes\\services\\OrderNotesService" | ||
}, | ||
"class": "superbig\\ordernotes\\OrderNotes" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Update to your order {{ order.number }}<br><br> | ||
|
||
Message from customer service: {{ note.message }}<br><br> | ||
|
||
Thanks,<br> | ||
Customer Service<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?php | ||
/** | ||
* Order Notes plugin for Craft CMS 3.x | ||
* | ||
* Order notes for Commerce | ||
* | ||
* @link https://superbig.co | ||
* @copyright Copyright (c) 2018 Superbig | ||
*/ | ||
|
||
namespace superbig\ordernotes; | ||
|
||
use craft\helpers\UrlHelper; | ||
use superbig\ordernotes\services\OrderNotesService as OrderNotesServiceService; | ||
use superbig\ordernotes\services\OrderNotesService; | ||
use superbig\ordernotes\variables\OrderNotesVariable; | ||
use superbig\ordernotes\models\Settings; | ||
|
||
use Craft; | ||
use craft\base\Plugin; | ||
use craft\services\Plugins; | ||
use craft\events\PluginEvent; | ||
use craft\web\UrlManager; | ||
use craft\web\twig\variables\CraftVariable; | ||
use craft\events\RegisterUrlRulesEvent; | ||
|
||
use yii\base\Event; | ||
|
||
/** | ||
* Class OrderNotes | ||
* | ||
* @author Superbig | ||
* @package OrderNotes | ||
* @since 2.0.0 | ||
* | ||
* @property OrderNotesService $orderNotes | ||
* @method Settings getSettings() | ||
*/ | ||
class OrderNotes extends Plugin | ||
{ | ||
// Static Properties | ||
// ========================================================================= | ||
|
||
/** | ||
* @var OrderNotes | ||
*/ | ||
public static $plugin; | ||
|
||
// Public Properties | ||
// ========================================================================= | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $schemaVersion = '2.0.0'; | ||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function init() | ||
{ | ||
parent::init(); | ||
self::$plugin = $this; | ||
|
||
Craft::$app->getView()->hook('cp.commerce.order.edit', function(&$context) { | ||
if (Craft::$app->getRequest()->getIsCpRequest()) { | ||
$order = $context['order']; | ||
$code = OrderNotes::$plugin->orderNotes->getCode($order); | ||
|
||
return $code; | ||
} | ||
}); | ||
|
||
Event::on( | ||
CraftVariable::class, | ||
CraftVariable::EVENT_INIT, | ||
function(Event $event) { | ||
/** @var CraftVariable $variable */ | ||
$variable = $event->sender; | ||
$variable->set('orderNotes', OrderNotesVariable::class); | ||
} | ||
); | ||
|
||
Event::on( | ||
Plugins::class, | ||
Plugins::EVENT_AFTER_INSTALL_PLUGIN, | ||
function(PluginEvent $event) { | ||
if ($event->plugin === $this && Craft::$app->getRequest()->getIsCpRequest()) { | ||
Craft::$app->getResponse()->redirect(UrlHelper::cpUrl('settings/plugins/order-notes')); | ||
|
||
return Craft::$app->end(); | ||
} | ||
} | ||
); | ||
|
||
Craft::info( | ||
Craft::t( | ||
'order-notes', | ||
'{name} plugin loaded', | ||
['name' => $this->name] | ||
), | ||
__METHOD__ | ||
); | ||
} | ||
|
||
// Protected Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function createSettingsModel() | ||
{ | ||
return new Settings(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function settingsHtml(): string | ||
{ | ||
return Craft::$app->view->renderTemplate( | ||
'order-notes/settings', | ||
[ | ||
'settings' => $this->getSettings(), | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Order Notes plugin for Craft CMS 3.x | ||
* | ||
* Order notes for Commerce | ||
* | ||
* @link https://superbig.co | ||
* @copyright Copyright (c) 2018 Superbig | ||
*/ | ||
|
||
namespace superbig\ordernotes\assetbundles\OrderNotes; | ||
|
||
use Craft; | ||
use craft\web\AssetBundle; | ||
use craft\web\assets\cp\CpAsset; | ||
|
||
/** | ||
* @author Superbig | ||
* @package OrderNotes | ||
* @since 2.0.0 | ||
*/ | ||
class OrderNotesAsset extends AssetBundle | ||
{ | ||
// Public Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function init() | ||
{ | ||
$this->sourcePath = "@superbig/ordernotes/assetbundles/ordernotes/dist"; | ||
|
||
$this->depends = [ | ||
CpAsset::class, | ||
]; | ||
|
||
$this->js = [ | ||
'js/OrderNotes.js', | ||
]; | ||
|
||
$this->css = [ | ||
'css/OrderNotes.css', | ||
]; | ||
|
||
parent::init(); | ||
} | ||
} |
Oops, something went wrong.