Plugin First Upload

parent 790cb726
<?php namespace Firestarter\Shop;
use Backend;
use Controller;
use System\Classes\PluginBase;
/**
* Shop Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'firestarter.shop::lang.plugin.name',
'description' => 'firestarter.shop::lang.plugin.description',
'author' => 'Firestarter',
'icon' => 'icon-shopping-cart'
];
}
public function registerComponents()
{
return [
'Firestarter\Shop\Components\Products' => 'shopProducts',
'Firestarter\Shop\Components\Product' => 'shopProduct',
];
}
public function registerMailTemplates()
{
return [
'firestarter.shop::mail.license' => 'Шаблон письма с лицензией на цифровый товар',
];
}
public function registerNavigation()
{
return [
'shop' => [
'label' => 'firestarter.shop::lang.shop.menu_label',
'url' => Backend::url('firestarter/shop/products'),
'icon' => 'icon-shopping-cart',
'permissions' => ['firestarter.shop.*'],
'order' => 500,
'sideMenu' => [
'products' => [
'label' => 'firestarter.shop::lang.shop.products',
'icon' => 'icon-copy',
'url' => Backend::url('firestarter/shop/products'),
'permissions' => ['firestarter.shop.access_products'],
],
'categories' => [
'label' => 'firestarter.shop::lang.shop.categories',
'icon' => 'icon-copy',
'url' => Backend::url('firestarter/shop/cats'),
'permissions' => ['firestarter.shop.access_categories'],
],
'vendors' => [
'label' => 'firestarter.shop::lang.shop.vendors',
'icon' => 'icon-copy',
'url' => Backend::url('firestarter/shop/vendors'),
'permissions' => ['firestarter.shop.access_categories'],
],
'currencies' => [
'label' => 'firestarter.shop::lang.shop.currencies',
'icon' => 'icon-copy',
'url' => Backend::url('firestarter/shop/currencies'),
'permissions' => ['firestarter.shop.access_coupons'],
],
'orders' => [
'label' => 'firestarter.shop::lang.shop.orders',
'icon' => 'icon-copy',
'url' => Backend::url('firestarter/shop/orders'),
'permissions' => ['firestarter.shop.access_orders'],
],
'coupons' => [
'label' => 'firestarter.shop::lang.shop.coupons',
'icon' => 'icon-copy',
'url' => Backend::url('firestarter/shop/coupons'),
'permissions' => ['firestarter.shop.access_coupons'],
],
]
]
];
}
public function registerSettings()
{
return [
'settings' => [
'label' => 'firestarter.shop::lang.shop.settings',
'description' => 'firestarter.shop::lang.shop.settings_description',
'category' => 'Shop',
'icon' => 'icon-credit-card',
'class' => 'Firestarter\Shop\Models\Settings',
'order' => 500,
],
];
}
}
{\rtf1}
\ No newline at end of file
<?php namespace Firestarter\Shop\Components;
use Input;
use Validator;
use Cms\Classes\ComponentBase;
use Firestarter\Shop\Models\Product as shopProduct;
use Firestarter\Shop\Models\Coupon as Coupon;
use Firestarter\Shop\Models\Currency as Currency;
use Firestarter\Shop\Models\Settings as Settings;
class Product extends ComponentBase
{
public $product;
public $currencies;
public $settings;
public function componentDetails()
{
return [
'name' => 'Product Component',
'description' => 'One product page.'
];
}
public function defineProperties()
{
return [
'idParam' => [
'title' => 'Slug',
'default' => ':slug',
'type' => 'string',
],
];
}
public function onRun()
{
/**
Добавляю фотораму стили и код в страницу товара
*/
$this->addCss('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css');
$this->addJs('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.min.js');
/**
*/
$this->settings = Settings::instance();
$this->currencies = $this->page['currencies'] = Currency::get()->toArray();
$this->product = $this->page['product'] = $this->loadProduct();
/**
Переопределяю мета теги
*/
$this->page->meta_description = mb_substr(strip_tags($this->product->description),0,255,'UTF-8');
$this->page->title = $this->product->name.' '.$this->product->model;
}
public function onChangeCarrency()
{
$data = Input::all();
$rules = [
'user_name' => 'required',
'user_email' => 'required|email',
'user_coupon'=>'coupon'
];
$messages = [
'required' => ' Поле :attribute обязательное для заполнения',
'email' => 'Почта должна соответствовать adress@site.domain',
'coupon'=>'Такого купона нет или уже использвется'
];
Validator::extend('coupon', function($attribute, $value, $parameters)
{
$product_id = $this->propertyOrParam('idParam');
/**
$value, позможно, нужно защитить, хз))
*/
return $this->loadCouponByValue($value);
});
$validation = Validator::make($data, $rules, $messages);
if ($validation->fails())
{
/**
Валидация не пройдена
*/
$this->page['errors'] = $validation->messages()->all();
}else{
/**
Валидация пройдена
*/
$this->page['user'] = $data;
$this->page['product'] = $this->loadProduct();
$this->page['coupon'] = $this->loadCouponByValue($data['user_coupon']);
$this->page['settings'] = Settings::instance();
$this->page['currencies'] = Currency::get()->keyBy('id')->toArray();
}
}
protected function loadCouponByValue($value)
{
$product_id = $this->param('id');
/**
$value, позможно, нужно защитить, хз))
*/
return Coupon::where('product_id', '=', $product_id)->where('value', '=', $value)->first();
}
protected function loadProduct()
{
$product_id = $this->param('id');
$product = shopProduct::find($product_id);
if(!$product)
return $this->controller->run('404');
return $product;
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Components;
use Cms\Classes\ComponentBase;
use Firestarter\Shop\Models\Product as Product;
use Firestarter\Shop\Models\Currency as Currency;
class Products extends ComponentBase
{
public $products;
public $currencies;
public function componentDetails()
{
return [
'name' => 'Products Component',
'description' => 'Echo list of products to page'
];
}
public function defineProperties()
{
return [];
}
public function onRun()
{
$this->currencies = $this->page['currencies'] = Currency::get()->toArray();
$this->products = $this->page['products'] = Product::get()->toArray();
}
}
\ No newline at end of file
{% set settings = __SELF__.settings %}
{% set currencies = __SELF__.currencies %}
{% set product = __SELF__.product %}
<div class="page-header">
<h2>{{product.name}}<small> {{product.model}}</small></h2>
</div>
<div class="row">
<div class="col-lg-6">
<p>{{product.description|raw}}</p>
</div>
<div class="col-lg-6">
<div
class="fotorama"
data-nav="thumbs"
data-allowfullscreen="true"
>
{% for image in product.featured_images %}
<img src="{{image.path}}" alt="{{product.name}}">
{% endfor %}
</div>
<br>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Стоимость лицензии:</h3>
</div>
<div class="panel-body">
<div class="form-group">
<table class="table table-bordered">
<tbody>
{% for currency in currencies %}
<tr>
<td>
{{currency.name}}
</td>
<td>
<strong>{{product.price*currency.value}} {{currency.sign}}</strong>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<br>
<div id="cart" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Оформить лицензию:</h3>
</div>
{% if not product.is_manual_sale %}
<div class="panel-body" id="result">
<form class="form-horizontal"
data-request="{{__SELF__}}::onChangeCarrency"
data-request-update="'{{__SELF__}}::payments':'#result'"
>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">Имя:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="user_name" id="inputPassword3">
<p class="help-block">На которое оформляется лицензия</p>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Email:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="user_email" id="inputEmail3">
<p class="help-block">На которую оформляется лицензия и поддержка</p>
</div>
</div>
<div class="form-group has-success">
<label class="col-sm-2 control-label" for="inputSuccess1">Купон:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="user_coupon" id="inputSuccess1">
<p class="help-block">На скидку, если есть.</p>
</div>
</div>
<button class="btn btn-primary pull-right" type="submit">
Перейти к оплате
</button>
</form>
</div>
{% else %}
<div class="panel-body" id="result">
Оплатите:<br/>
<p class="text-danger"><strong>Внимание!</strong> Оплата ТОЛЬКО на эти реквизиты дает гарантию на получение продукта и оказания технической поддержки.</p>
{% if settings.wmz_is_active %}
<strong>{{product.price*currencies[settings.wmz_carrency-1].value}} {{currencies[settings.wmz_carrency-1].sign}}</strong> на <strong>{{settings.wmz_purse}}</strong> или<hr><br>
{% endif %}
{% if settings.wmr_is_active %}
<strong>{{product.price*currencies[settings.wmr_carrency-1].value}} {{currencies[settings.wmr_carrency-1].sign}}</strong> на <strong>{{settings.wmr_purse}}</strong> или<hr><br>
{% endif %}
{% if settings.wmu_is_active %}
<strong>{{product.price*currencies[settings.wmu_carrency-1].value}} {{currencies[settings.wmu_carrency-1].sign}}</strong> на <strong>{{settings.wmu_purse}}</strong> или<hr><br>
{% endif %}
{% if settings.yad_is_active %}
<strong>{{product.price*currencies[settings.yad_carrency-1].value}} {{currencies[settings.yad_carrency-1].sign}}</strong> на <strong>{{settings.yad_purse}}</strong> <hr>
{% endif %}
Указав в примечании:<br>
"<strong>Оплата за {{product.name}} {{product.model}}, для пользователя EMAIL(тут ваша почта для обновлений и поддержки)</strong>"<br>
В течении 12 часов, для вас будет подотовлена копия, и сброшена на указаную почту, но ТОЛЬКО после поступления платежа.
<p class="text-danger"><strong>Внимание!</strong> При малейшем подозрении или сомнении, напишите мне на почту.</p>
</div>
{% endif %}
</div>
</div>
</div>
{% if errors is not empty %}
{% for error in errors %}
<p class="text-danger">
{{error}}
</p><br/>
{% endfor %}
<a class="btn btn-danger pull-right" onclick="location.reload();" >Назад</a>
{% else %}
<p>Выберите нужную валюту, чтобы произвести оплату:</p>
<div class="row">
{% if settings.wmz_is_active %}
<div class="col-md-3">
<form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="SHOP_USER_PRODUCT_ID" value="{{product.id}}">
<input type="hidden" name="SHOP_USER_NAME" value="{{user.user_name}}">
<input type="hidden" name="SHOP_USER_EMAIL" value="{{user.user_email}}">
<input type="hidden" name="LMI_PAYMENT_DESC" value="">
<input type="hidden" name="LMI_SIM_MODE" value="0">
<input type="hidden" name="LMI_PAYMENT_NO" value="0">
<input type="hidden" name="LMI_PAYEE_PURSE" value="{{settings.wmz_purse}}">
{% if coupon.discount %}
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="{{(product.price - product.price*coupon.discount/100)*currencies[settings.wmz_carrency].value}}">
<input type="hidden" name="SHOP_USER_COUPON" value="{{coupon.value}}">
{% else %}
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="{{product.price*currencies[settings.wmz_carrency].value}}">
{% endif %}
<input type="image" src="{{ 'assets/images/payments/wm_wmz.png'|theme }}" alt="Оплатить WMZ">
</form>
</div>
{% endif %}
{% if settings.wmr_is_active %}
<div class="col-md-3">
<!-- wmr -->
<form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="SHOP_USER_PRODUCT_ID" value="{{product.id}}">
<input type="hidden" name="SHOP_USER_NAME" value="{{user.user_name}}">
<input type="hidden" name="SHOP_USER_EMAIL" value="{{user.user_email}}">
<input type="hidden" name="LMI_PAYMENT_DESC" value="">
<input type="hidden" name="LMI_SIM_MODE" value="0">
<input type="hidden" name="LMI_PAYMENT_NO" value="0">
<input type="hidden" name="LMI_PAYEE_PURSE" value="{{settings.wmr_purse}}">
{% if coupon.discount %}
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="{{(product.price - product.price*coupon.discount/100)*currencies[settings.wmr_carrency].value}}">
<input type="hidden" name="SHOP_USER_COUPON_ID" value="{{coupon.value}}">
{% else %}
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="{{product.price*currencies[settings.wmr_carrency].value}}">
{% endif %}
<input type="image" src="{{ 'assets/images/payments/wm_wmr.png'|theme }}" alt="Оплатить WMR">
</form>
</div>
{% endif %}
{% if settings.wmu_is_active %}
<div class="col-md-3">
<!-- wmu -->
<form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="SHOP_USER_PRODUCT_ID" value="{{product.id}}">
<input type="hidden" name="SHOP_USER_NAME" value="{{user.user_name}}">
<input type="hidden" name="SHOP_USER_EMAIL" value="{{user.user_email}}">
<input type="hidden" name="LMI_PAYMENT_DESC" value="">
<input type="hidden" name="LMI_SIM_MODE" value="0">
<input type="hidden" name="LMI_PAYMENT_NO" value="0">
<input type="hidden" name="LMI_PAYEE_PURSE" value="{{settings.wmu_purse}}">
{% if coupon.discount %}
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="{{(product.price - product.price*coupon.discount/100)*currencies[settings.wmu_carrency].value}}">
<input type="hidden" name="SHOP_USER_COUPON_ID" value="{{coupon.value}}">
{% else %}
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="{{product.price*currencies[settings.wmu_carrency].value}}">
{% endif %}
</form>
</div>
{% endif %}
{% if settings.yad_is_active %}
<div class="col-md-3">
<!-- yandex.money -->
<form method="POST" action="https://money.yandex.ru/quickpay/confirm.xml">
<input type="hidden" name="label" value="">
<input type="hidden" name="quickpay-form" value="shop">
<input type="hidden" name="referer" value="">
<input type="hidden" name="is-inner-form" value="true">
<input type="hidden" name="receiver" value="41001911531267">
<input class="sum_rur" type="hidden" name="sum" value="">
<input class="comment" type="hidden" name="targets" value="">
<input type="image" src="{{ 'assets/images/payments/yandex.png'|theme }}" alt="Оплатить Yandex.Деньгами">
</form>
</div>
{% endif %}
{% if settings.qiwi_is_active %}
<div class="col-md-3">
<!-- qiwi -->
<form method="GET" action="https://w.qiwi.com/order/external/create.action">
<!--input type="hidden" name="txn_id" value="777"--><!-- используйте это поле для передачи уникального идентификатора заказа/платежа в вашей системе -->
<input type="hidden" name="to" id="idto">
<input type="hidden" name="currency" value="RUB">
<input type="hidden" name="from" value="252145">
<input class="sum_rur" type="hidden" name="summ" value="">
<input class="comment" type="hidden" name="com" value="">
<!--input type="submit" value="QIWI"-->
</form>
</div>
{% endif %}
</div>
{% endif %}
\ No newline at end of file
{% set products = __SELF__.products %}
{% set currencies = __SELF__.currencies %}
<h4>Магазинчик:</h4>
<ul class="list-inline">
{% for product in products %}
<li>
<h4><i class="icon-shopping-cart"></i> <a href="product/{{ product.id }}">{{ product.name }} {{product.model}}</a></h4>
<span><strong>Цена:</strong></span>
<ul class="list-unstyled">
{% for currency in currencies %}
<li>{{currency.value * product.price }} {{currency.name}}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
<hr/>
\ No newline at end of file
<?php namespace Firestarter\Shop\Controllers;
use Flash;
use BackendMenu;
use Backend\Classes\Controller;
use Firestarter\Shop\Models\Category;
use System\Classes\SettingsManager;
/**
* Channels Back-end Controller
*/
class Cats extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController',
'Backend.Behaviors.RelationController'
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public $relationConfig = 'config_relation.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Firestarter.Shop', 'shop', 'cats');
}
public function index_onDelete()
{
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
foreach ($checkedIds as $channelId) {
if (!$channel = Category::find($channelId))
continue;
$channel->delete();
}
Flash::success('Successfully deleted those categories.');
}
return $this->listRefresh();
}
public function reorder()
{
$this->pageTitle = e(trans('firestarter.shop::lang.shop.category_reorder'));
$toolbarConfig = $this->makeConfig();
$toolbarConfig->buttons = '~/plugins/firestarter/shop/controllers/cats/_reorder_toolbar.htm';
$this->vars['toolbar'] = $this->makeWidget('Backend\Widgets\Toolbar', $toolbarConfig);
$this->vars['records'] = Category::make()->getEagerRoot();
}
public function reorder_onMove()
{
$sourceNode = Category::find(post('sourceNode'));
$targetNode = post('targetNode') ? Category::find(post('targetNode')) : null;
if ($sourceNode == $targetNode)
return;
switch (post('position')) {
case 'before': $sourceNode->moveBefore($targetNode); break;
case 'after': $sourceNode->moveAfter($targetNode); break;
case 'child': $sourceNode->makeChildOf($targetNode); break;
default: $sourceNode->makeRoot(); break;
}
// $this->vars['records'] = Category::make()->getEagerRoot();
// return ['#reorderRecords' => $this->makePartial('reorder_records')];
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Controllers;
use BackendMenu;
use Backend\Classes\Controller;
/**
* Coupons Back-end Controller
*/
class Coupons extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController'
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Firestarter.Shop', 'shop', 'coupons');
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Controllers;
use BackendMenu;
use Backend\Classes\Controller;
/**
* Currencies Back-end Controller
*/
class Currencies extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController'
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Firestarter.Shop', 'shop', 'currencies');
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Controllers;
use BackendMenu;
use Backend\Classes\Controller;
/**
* Orders Back-end Controller
*/
class Orders extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController'
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Firestarter.Shop', 'shop', 'orders');
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Controllers;
use BackendMenu;
use Backend\Classes\Controller;
/**
* Products Back-end Controller
*/
class Products extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController'
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public $requiredPermissions = ['firestarter.shop.access_products'];
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Firestarter.Shop', 'shop', 'products');
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Controllers;
use BackendMenu;
use Backend\Classes\Controller;
/**
* Vendors Back-end Controller
*/
class Vendors extends Controller
{
public $implement = [
'Backend.Behaviors.FormController',
'Backend.Behaviors.ListController'
];
public $formConfig = 'config_form.yaml';
public $listConfig = 'config_list.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Firestarter.Shop', 'shop', 'vendors');
}
}
\ No newline at end of file
<div data-control="toolbar">
<a
href="<?= Backend::url('firestarter/shop/cats/create') ?>"
class="btn btn-primary oc-icon-plus">
<?= e(trans('firestarter.shop::lang.shop.new_cat')) ?>
</a>
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"
onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked')
})"
data-request="onDelete"
data-request-confirm="<?= e(trans('firestarter.shop::lang.shop.sure')) ?>"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-stripe-load-indicator>
<?= e(trans('firestarter.shop::lang.shop.delete')) ?>
</button>
<a
href="<?= Backend::url('firestarter/shop/cats/reorder') ?>"
class="btn btn-default oc-icon-bars">
<?= e(trans('firestarter.shop::lang.shop.manage')) ?>
</a>
</div>
\ No newline at end of file
<?php foreach ($records as $record): ?>
<li data-record-id="<?= $record->id ?>">
<div class="record">
<a href="javascript:;" class="move"></a>
<span><?= $record->title ?></span>
</div>
<ol>
<?php if ($record->children): ?>
<?= $this->makePartial('reorder_records', ['records' => $record->children]) ?>
<?php endif ?>
</ol>
</li>
<?php endforeach ?>
\ No newline at end of file
<div data-control="toolbar">
<a href="<?= Backend::url('firestarter/shop/cats') ?>" class="btn btn-primary oc-icon-caret-left"><?= e(trans('firestarter.shop::lang.shop.return')) ?></a>
</div>
\ No newline at end of file
# ===================================
# Form Behavior Config
# ===================================
# Record name
name: firestarter.shop::lang.shop.category_name
# Model Form Field configuration
form: ~/plugins/firestarter/shop/models/category/fields.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Category
# Default redirect location
defaultRedirect: firestarter/shop/cats
# Create page
create:
title: firestarter.shop::lang.shop.category_create
redirect: firestarter/shop/cats/update/:id
redirectClose: firestarter/shop/cats
# Update page
update:
title: firestarter.shop::lang.shop.category_update
redirect: firestarter/shop/cats
redirectClose: firestarter/shop/cats
# Preview page
preview:
title: firestarter.shop::lang.shop.category_preview
\ No newline at end of file
# ===================================
# List Behavior Config
# ===================================
# Model List Column configuration
list: ~/plugins/firestarter/shop/models/category/columns.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Category
# List Title
title: rainlab.forum::lang.channels.manage
# Link URL for each record
recordUrl: firestarter/shop/cats/update/:id
# Message to display if the list is empty
noRecordsMessage: backend::lang.list.no_records
# Records to display per page
recordsPerPage: 20
# Display checkboxes next to each record
showCheckboxes: true
showTree: true
# Toolbar widget configuration
toolbar:
# Partial for toolbar buttons
buttons: list_toolbar
# Search widget configuration
search:
prompt: backend::lang.list.search_prompt
products:
label: Categories Line Product
view:
list: $/firestarter/shop/models/product/columns.yaml
toolbarButtons: create|delete
manage:
form: $/firestarter/shop/models/product/fields.yaml
recordsPerPage: 10
\ No newline at end of file
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/cats') ?>"><?= e(trans('firestarter.shop::lang.shop.category_name')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('firestarter.shop::lang.shop.category_creating')) ?>"
class="btn btn-primary">
<?= e(trans('firestarter.shop::lang.shop.category_create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('firestarter.shop::lang.shop.category_creating')) ?>"
class="btn btn-default">
<?= e(trans('firestarter.shop::lang.shop.category_createnclose')) ?>
</button>
<span class="btn-text">
<?= e(trans('firestarter.shop::lang.shop.or')) ?> <a href="<?= Backend::url('firestarter/shop/cats') ?>"><?= e(trans('firestarter.shop::lang.shop.category_cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/cats') ?>" class="btn btn-default"><?= e(trans('firestarter.shop::lang.shop.returnlist')) ?></a></p>
<?php endif ?>
<?= $this->listRender() ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/cats') ?>"><?= e(trans('firestarter.shop::lang.shop.category_name')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="layout-item stretch layout-column">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/cats') ?>" class="btn btn-default"><?= e(trans('firestarter.shop::lang.shop.category_returnlist')) ?></a></p>
<?php endif ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('rainlab/forum/channels') ?>"><?= e(trans('firestarter.shop::lang.shop.category_name')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>
<?= $toolbar->render() ?>
<div
id="reorderTreeList"
class="control-treelist"
data-control="treelist"
data-handle="a.move"
data-stripe-load-indicator>
<ol id="reorderRecords">
<?= $this->makePartial('reorder_records', ['records' => $records]) ?>
</ol>
</div>
<script>
/*
* Post back source and target nodes IDs and the move positioning.
*/
$('#reorderTreeList').on('move.oc.treelist', function(ev, data){
var
$el,
$item = data.item,
moveData = { sourceNode: $item.data('recordId'), position: 'root', targetNode: 0 }
if (($el = $item.next()) && $el.length) moveData.position = 'before'
else if (($el = $item.prev()) && $el.length) moveData.position = 'after'
else if (($el = $item.parents('li:first')) && $el.length) moveData.position = 'child'
if ($el.length) moveData.targetNode = $el.data('recordId')
$('#reorderTreeList').request('onMove', {
data: moveData
})
})
</script>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/cats') ?>"><?= e(trans('firestarter.shop::lang.shop.category_name')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('firestarter.shop::lang.shop.category_saving')) ?>"
class="btn btn-primary">
<?= e(trans('firestarter.shop::lang.shop.category_save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('firestarter.shop::lang.shop.category_saving')) ?>"
class="btn btn-default">
<?= e(trans('firestarter.shop::lang.shop.category_savenclose')) ?>
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('firestarter.shop::lang.shop.category_deleting')) ?>"
data-request-confirm="<?= e(trans('firestarter.shop::lang.shop.category_really')) ?>">
</button>
<span class="btn-text">
<?= e(trans('firestarter.shop::lang.shop.or')) ?> <a href="<?= Backend::url('firestarter/shop/cats') ?>"><?= e(trans('firestarter.shop::lang.shop.category_cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/cats') ?>" class="btn btn-default"><?= e(trans('firestarter.shop::lang.shop.category_returnlist')) ?></a></p>
<?php endif ?>
<div data-control="toolbar">
<a href="<?= Backend::url('firestarter/shop/coupons/create') ?>" class="btn btn-primary oc-icon-plus">New Coupon</a>
</div>
\ No newline at end of file
# ===================================
# Form Behavior Config
# ===================================
# Record name
name: Coupon
# Model Form Field configuration
form: $/firestarter/shop/models/coupon/fields.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Coupon
# Default redirect location
defaultRedirect: firestarter/shop/coupons
# Create page
create:
title: Create Coupon
redirect: firestarter/shop/coupons/update/:id
redirectClose: firestarter/shop/coupons
# Update page
update:
title: Edit Coupon
redirect: firestarter/shop/coupons
redirectClose: firestarter/shop/coupons
# Preview page
preview:
title: Preview Coupon
\ No newline at end of file
# ===================================
# List Behavior Config
# ===================================
# Model List Column configuration
list: $/firestarter/shop/models/coupon/columns.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Coupon
# List Title
title: Manage Coupons
# Link URL for each record
recordUrl: firestarter/shop/coupons/update/:id
# Message to display if the list is empty
noRecordsMessage: backend::lang.list.no_records
# Records to display per page
recordsPerPage: 20
# Displays the list column set up button
showSetup: true
# Displays the sorting link on each column
showSorting: true
# Default sorting column
# defaultSort:
# column: created_at
# direction: desc
# Display checkboxes next to each record
# showCheckboxes: true
# Toolbar widget configuration
toolbar:
# Partial for toolbar buttons
buttons: list_toolbar
# Search widget configuration
search:
prompt: backend::lang.list.search_prompt
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/coupons') ?>">Coupons</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Coupon..."
class="btn btn-primary">
Create
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Coupon..."
class="btn btn-default">
Create and Close
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/coupons') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/coupons') ?>" class="btn btn-default">Return to coupons list</a></p>
<?php endif ?>
\ No newline at end of file
<?= $this->listRender() ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/coupons') ?>">Coupons</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="layout-item stretch layout-column form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/coupons') ?>" class="btn btn-default">Return to coupons list</a></p>
<?php endif ?>
\ No newline at end of file
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/coupons') ?>">Coupons</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Coupon..."
class="btn btn-primary">
<u>S</u>ave
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Coupon..."
class="btn btn-default">
Save and Close
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="Deleting Coupon..."
data-request-confirm="Do you really want to delete this coupon?">
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/coupons') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/coupons') ?>" class="btn btn-default">Return to coupons list</a></p>
<?php endif ?>
\ No newline at end of file
<div data-control="toolbar">
<a href="<?= Backend::url('firestarter/shop/currencies/create') ?>" class="btn btn-primary oc-icon-plus">New Currency</a>
</div>
\ No newline at end of file
# ===================================
# Form Behavior Config
# ===================================
# Record name
name: Currency
# Model Form Field configuration
form: $/firestarter/shop/models/currency/fields.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Currency
# Default redirect location
defaultRedirect: firestarter/shop/currencies
# Create page
create:
title: Create Currency
redirect: firestarter/shop/currencies/update/:id
redirectClose: firestarter/shop/currencies
# Update page
update:
title: Edit Currency
redirect: firestarter/shop/currencies
redirectClose: firestarter/shop/currencies
# Preview page
preview:
title: Preview Currency
\ No newline at end of file
# ===================================
# List Behavior Config
# ===================================
# Model List Column configuration
list: $/firestarter/shop/models/currency/columns.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Currency
# List Title
title: Manage Currencies
# Link URL for each record
recordUrl: firestarter/shop/currencies/update/:id
# Message to display if the list is empty
noRecordsMessage: backend::lang.list.no_records
# Records to display per page
recordsPerPage: 20
# Displays the list column set up button
showSetup: true
# Displays the sorting link on each column
showSorting: true
# Default sorting column
# defaultSort:
# column: created_at
# direction: desc
# Display checkboxes next to each record
# showCheckboxes: true
# Toolbar widget configuration
toolbar:
# Partial for toolbar buttons
buttons: list_toolbar
# Search widget configuration
search:
prompt: backend::lang.list.search_prompt
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/currencies') ?>">Currencies</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Currency..."
class="btn btn-primary">
Create
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Currency..."
class="btn btn-default">
Create and Close
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/currencies') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/currencies') ?>" class="btn btn-default">Return to currencies list</a></p>
<?php endif ?>
\ No newline at end of file
<?= $this->listRender() ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/currencies') ?>">Currencies</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="layout-item stretch layout-column form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/currencies') ?>" class="btn btn-default">Return to currencies list</a></p>
<?php endif ?>
\ No newline at end of file
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/currencies') ?>">Currencies</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Currency..."
class="btn btn-primary">
<u>S</u>ave
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Currency..."
class="btn btn-default">
Save and Close
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="Deleting Currency..."
data-request-confirm="Do you really want to delete this currency?">
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/currencies') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/currencies') ?>" class="btn btn-default">Return to currencies list</a></p>
<?php endif ?>
\ No newline at end of file
<div data-control="toolbar">
<a href="<?= Backend::url('firestarter/shop/orders/create') ?>" class="btn btn-primary oc-icon-plus">New Order</a>
</div>
\ No newline at end of file
# ===================================
# Form Behavior Config
# ===================================
# Record name
name: Order
# Model Form Field configuration
form: $/firestarter/shop/models/order/fields.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Order
# Default redirect location
defaultRedirect: firestarter/shop/orders
# Create page
create:
title: Create Order
redirect: firestarter/shop/orders/update/:id
redirectClose: firestarter/shop/orders
# Update page
update:
title: Edit Order
redirect: firestarter/shop/orders
redirectClose: firestarter/shop/orders
# Preview page
preview:
title: Preview Order
\ No newline at end of file
# ===================================
# List Behavior Config
# ===================================
# Model List Column configuration
list: $/firestarter/shop/models/order/columns.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Order
# List Title
title: Manage Orders
# Link URL for each record
recordUrl: firestarter/shop/orders/update/:id
# Message to display if the list is empty
noRecordsMessage: backend::lang.list.no_records
# Records to display per page
recordsPerPage: 20
# Displays the list column set up button
showSetup: true
# Displays the sorting link on each column
showSorting: true
# Default sorting column
# defaultSort:
# column: created_at
# direction: desc
# Display checkboxes next to each record
# showCheckboxes: true
# Toolbar widget configuration
toolbar:
# Partial for toolbar buttons
buttons: list_toolbar
# Search widget configuration
search:
prompt: backend::lang.list.search_prompt
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/orders') ?>">Orders</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Order..."
class="btn btn-primary">
Create
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Order..."
class="btn btn-default">
Create and Close
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/orders') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/orders') ?>" class="btn btn-default">Return to orders list</a></p>
<?php endif ?>
\ No newline at end of file
<?= $this->listRender() ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/orders') ?>">Orders</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="layout-item stretch layout-column form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/orders') ?>" class="btn btn-default">Return to orders list</a></p>
<?php endif ?>
\ No newline at end of file
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/orders') ?>">Orders</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Order..."
class="btn btn-primary">
<u>S</u>ave
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Order..."
class="btn btn-default">
Save and Close
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="Deleting Order..."
data-request-confirm="Do you really want to delete this order?">
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/orders') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/orders') ?>" class="btn btn-default">Return to orders list</a></p>
<?php endif ?>
\ No newline at end of file
<div data-control="toolbar">
<a href="<?= Backend::url('firestarter/shop/products/create') ?>" class="btn btn-primary oc-icon-plus"><?php echo Lang::get('firestarter.shop::lang.shop.new_product');?></a>
</div>
\ No newline at end of file
# ===================================
# Form Behavior Config
# ===================================
# Record name
name: Product
# Model Form Field configuration
form: $/firestarter/shop/models/product/fields.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Product
# Default redirect location
defaultRedirect: firestarter/shop/products
# Create page
create:
title: Create Product
redirect: firestarter/shop/products/update/:id
redirectClose: firestarter/shop/products
# Update page
update:
title: Edit Product
redirect: firestarter/shop/products
redirectClose: firestarter/shop/products
# Preview page
preview:
title: Preview Product
\ No newline at end of file
# ===================================
# List Behavior Config
# ===================================
# Model List Column configuration
list: $/firestarter/shop/models/product/columns.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Product
# List Title
title: Manage Products
# Link URL for each record
recordUrl: firestarter/shop/products/update/:id
# Message to display if the list is empty
noRecordsMessage: backend::lang.list.no_records
# Records to display per page
recordsPerPage: 20
# Displays the list column set up button
showSetup: true
# Displays the sorting link on each column
showSorting: true
# Default sorting column
# defaultSort:
# column: created_at
# direction: desc
# Display checkboxes next to each record
# showCheckboxes: true
# Toolbar widget configuration
toolbar:
# Partial for toolbar buttons
buttons: list_toolbar
# Search widget configuration
search:
prompt: backend::lang.list.search_prompt
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/products') ?>"><?php echo Lang::get('firestarter.shop::lang.shop.products');?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Product..."
class="btn btn-primary">
Create
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Product..."
class="btn btn-default">
Create and Close
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/products') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/products') ?>" class="btn btn-default">Return to products list</a></p>
<?php endif ?>
\ No newline at end of file
<?= $this->listRender() ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/products') ?>"><?php echo Lang::get('firestarter.shop::lang.shop.products');?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="layout-item stretch layout-column form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/products') ?>" class="btn btn-default">Return to products list</a></p>
<?php endif ?>
\ No newline at end of file
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/products') ?>"><?php echo Lang::get('firestarter.shop::lang.shop.products');?></a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class'=>'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Product..."
class="btn btn-primary">
<u>S</u>ave
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Product..."
class="btn btn-default">
Save and Close
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="Deleting Product..."
data-request-confirm="Do you really want to delete this product?">
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/products') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/products') ?>" class="btn btn-default">Return to products list</a></p>
<?php endif ?>
\ No newline at end of file
<div data-control="toolbar">
<a
href="<?= Backend::url('firestarter/shop/vendors/create') ?>"
class="btn btn-primary oc-icon-plus">
New Vendor
</a>
</div>
\ No newline at end of file
# ===================================
# Form Behavior Config
# ===================================
# Record name
name: Vendor
# Model Form Field configuration
form: $/firestarter/shop/models/vendor/fields.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Vendor
# Default redirect location
defaultRedirect: firestarter/shop/vendors
# Create page
create:
title: Create Vendor
redirect: firestarter/shop/vendors/update/:id
redirectClose: firestarter/shop/vendors
# Update page
update:
title: Edit Vendor
redirect: firestarter/shop/vendors
redirectClose: firestarter/shop/vendors
# Preview page
preview:
title: Preview Vendor
\ No newline at end of file
# ===================================
# List Behavior Config
# ===================================
# Model List Column configuration
list: $/firestarter/shop/models/vendor/columns.yaml
# Model Class name
modelClass: Firestarter\Shop\Models\Vendor
# List Title
title: Manage Vendors
# Link URL for each record
recordUrl: firestarter/shop/vendors/update/:id
# Message to display if the list is empty
noRecordsMessage: backend::lang.list.no_records
# Records to display per page
recordsPerPage: 20
# Displays the list column set up button
showSetup: true
# Displays the sorting link on each column
showSorting: true
# Default sorting column
# defaultSort:
# column: created_at
# direction: desc
# Display checkboxes next to each record
# showCheckboxes: true
# Toolbar widget configuration
toolbar:
# Partial for toolbar buttons
buttons: list_toolbar
# Search widget configuration
search:
prompt: backend::lang.list.search_prompt
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/vendors') ?>">Vendors</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Creating Vendor..."
class="btn btn-primary">
Create
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Creating Vendor..."
class="btn btn-default">
Create and Close
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/vendors') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/vendors') ?>" class="btn btn-default">Return to vendors list</a></p>
<?php endif ?>
\ No newline at end of file
<?= $this->listRender() ?>
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/vendors') ?>">Vendors</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/vendors') ?>" class="btn btn-default">Return to vendors list</a></p>
<?php endif ?>
\ No newline at end of file
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('firestarter/shop/vendors') ?>">Vendors</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="Saving Vendor..."
class="btn btn-primary">
<u>S</u>ave
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="Saving Vendor..."
class="btn btn-default">
Save and Close
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="Deleting Vendor..."
data-request-confirm="Do you really want to delete this vendor?">
</button>
<span class="btn-text">
or <a href="<?= Backend::url('firestarter/shop/vendors') ?>">Cancel</a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<p><a href="<?= Backend::url('firestarter/shop/vendors') ?>" class="btn btn-default">Return to vendors list</a></p>
<?php endif ?>
\ No newline at end of file
<?php
return [
'plugin' => [
'name' => 'Shop',
'description' => 'Shop plugin for October CMS',
],
'shop' => [
'menu_label' => 'Shop',
'products'=>'Products'
],
];
\ No newline at end of file
<?php
return [
'plugin' => [
'name' => 'Магазин',
'description' => 'Плагин магазина для October CMS'
],
'shop' => [
'additional' => 'Дополнительная информация',
'additional_comment'=>'Дополнительная информация, высылаеться вместе с товаром',
'menu_label' => 'Магазин',
'products'=>'Товары',
'product_main'=>'Главная информация',
'product_additional'=>'Дополнительная информация',
'product_options'=>'Вараинты товара',
'product_taxonomy'=>'Таксономия',
'product_active'=>'Доступность',
'product'=>'Товар',
'product_id'=>'id товара',
'product_id_description'=>'id товара Описание',
'products_per_page'=>'Товаров на страницу',
'products_per_page_validation'=>'Товаров на страницу валидация',
'digital_product'=>'Цифровой товар',
'name'=>'Название товара',
'new_product' =>'Новый товар',
'name_placeholder'=>'Слон',
'model'=>'Модель товара',
'model_placeholder'=>'Необыкновенный',
'is_manual_sale'=>'Продажа вручнйю?',
'is_manual_sale_placeholder'=>'Буду продавать в ручном режиме',
'description'=>'Описание товара',
'short_description'=>'Краткое описание',
'price'=>'Цена',
'featured_images'=>'Изображения',
'orders'=>'Заказы',
'user_name'=>'Имя пользователя',
'user_name_placeholder'=>'Вася',
'email'=>'Почта пользователя',
'email_placeholder'=>'vasya@mail.ru',
'coupons'=>'Купоны',
'coupon'=>'Купон',
'value'=>'Код скидки',
'discount'=>'% Скидки',
'discount_placeholder'=>'20%',
'value_placeholder'=>'HGTS-HDTS-HSTS-AEJJ',
'is_used'=>'Уже использован?',
'currencies'=>'Валюты',
'currency_value'=>'Значение валюты',
'currency_value_placeholder'=>'1.0000',
'currency_name'=>'Название валюты',
'currency_name_placeholder'=>'WMZ',
'currency_sign'=>'Знак',
'currency_sign_placeholder'=>'$',
'new_cat'=>'Новая категория',
'delete'=>'Удалить категорию',
'categories'=>'Категории',
'category_create'=>'Создать категорию',
'category_update'=>'Обновить категорию',
'category_preview'=>'Предпросмотр категории',
'category_reorder'=>'Изменить вложеность',
'category_save'=>'Сохранить категорию',
'category_returnlist'=>'Назад в список категорий',
'category_createnclose'=>'Создать категорию и закрыть',
'category_savenclose'=>'Сохранить категорию и закрыть',
'category_creating'=>'Создание категории',
'category_saving'=>'Сохранение категории',
'category_deleting'=>'Удаление категории',
'category_cancel'=>'Отмена',
'or'=>'или',
'category_name'=>'Управление категориями',
'manage'=>'Управлять вложеностью',
'return'=>'Назад к категориям',
'sure'=>'Вы уверены?',
'category_really'=>'Действительно?',
'vendors'=>'Производители',
'is_default'=>'По умолчанию?',
'settings'=>'Настройки магазина',
'settings_description'=>'Настройки валют и т.д',
'shop_product'=>'Страница товара',
'shop_product_description'=>'Страница товара описание'
],
];
\ No newline at end of file
<?php namespace Firestarter\Shop\Models;
use Model;
use ApplicationException;
/**
* Channel Model
*/
class Category extends Model
{
use \October\Rain\Database\Traits\Sluggable;
use \October\Rain\Database\Traits\Validation;
use \October\Rain\Database\Traits\NestedTree;
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
/**
* @var boolean Channel has new posts for member, set by ChannelWatch model
*/
public $hasNew = true;
/**
* @var string The database table used by the model.
*/
public $table = 'firestarter_shop_categories';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = ['title', 'description', 'parent_id'];
/**
* @var array The attributes that should be visible in arrays.
*/
protected $visible = ['title', 'description'];
/**
* @var array Validation rules
*/
public $rules = [
'title' => 'required'
];
/**
* @var array Auto generated slug
*/
protected $slugs = ['slug' => 'title'];
/**
* @var array Relations
*/
public $hasMany = [
'products' => ['Firestarter\Shop\Models\Product']
];
/**
* @var array Attributes that support translation, if available.
*/
public $translatable = ['title', 'description'];
/**
* Apply embed code to channel.
*/
// public function scopeForEmbed($query, $channel, $code)
// {
// return $query
// ->where('embed_code', $code)
// ->where('parent_id', $channel->id);
// }
// /**
// * Auto creates a channel based on embed code and a parent channel
// * @param string $code Embed code
// * @param string $parentChannel Channel to create the topic in
// * @param string $title Title for the channel (if created)
// * @return self
// */
// public static function createForEmbed($code, $parentChannel, $title = null)
// {
// $channel = self::forEmbed($parentChannel, $code)->first();
// if (!$channel) {
// $channel = new self;
// $channel->title = $title;
// $channel->embed_code = $code;
// $channel->parent = $parentChannel;
// $channel->save();
// }
// return $channel;
// }
// /**
// * Rebuilds the statistics for the channel
// * @return void
// */
// public function rebuildStats()
// {
// $this->count_topics = $this->topics()->count();
// $this->count_posts = $this->topics()->sum('count_posts');
// return $this;
// }
// /**
// * Filters if the channel should be visible on the front-end.
// */
// public function scopeIsVisible($query)
// {
// return $query->where('is_hidden', '<>', true);
// }
// public function afterDelete()
// {
// foreach ($this->topics as $topic)
// $topic->delete();
// }
/**
* Sets the "url" attribute with a URL to this object
* @param string $pageName
* @param Cms\Classes\Controller $controller
*/
public function setUrl($pageName, $controller)
{
$params = [
'id' => $this->id,
'slug' => $this->slug,
];
return $this->url = $controller->pageUrl($pageName, $params);
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Models;
use Model;
use Firestarter\Shop\Models\Product as Product;
/**
* Coupon Model
*/
class Coupon extends Model
{
use \October\Rain\Database\Traits\Validation;
public $rules = [
'value' => 'required',
'product_id' => 'required|numeric',
'discount' => 'required|numeric|min:0|max:100',
];
/**
* @var string The database table used by the model.
*/
public $table = 'firestarter_shop_coupons';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
/**
* @var array Relations
*/
public $hasOne = [];
public $hasMany = [];
public $belongsTo = [];
public $belongsToMany = [];
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = [];
public $attachMany = [];
public function getProductIdOptions()
{
return Product::lists('name', 'id');
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Models;
use Model;
/**
* Currency Model
*/
class Currency extends Model
{
use \October\Rain\Database\Traits\Validation;
public $rules = [
'name' => 'required',
'value' => 'required|numeric|min:0,0001|max:10000.9999',
];
/**
* @var string The database table used by the model.
*/
public $table = 'firestarter_shop_currencies';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
/**
* @var array Relations
*/
public $hasOne = [];
public $hasMany = [];
public $belongsTo = [];
public $belongsToMany = [];
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = [];
public $attachMany = [];
public function beforeSave()
{
if($this->is_default){
Currency::where('is_default', '=', 1)->update(array('is_default' => 0));
$this->value = 1.0000;
}
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Models;
use Model;
use October\Rain\Support\ValidationException;
use Firestarter\Shop\Models\Product as Product;
use Firestarter\Shop\Models\Coupon as Coupon;
/**
* Order Model
*/
class Order extends Model
{
use \October\Rain\Database\Traits\Validation;
public $rules = [
'email' => 'required|email',
'product_id' => 'required|numeric'
];
/**
* @var string The database table used by the model.
*/
public $table = 'firestarter_shop_orders';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
/**
* @var array Relations
*/
public $hasOne = [];
public $hasMany = [];
public $belongsTo = [];
public $belongsToMany = [];
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = [];
public $attachMany = [];
public function getProductIdOptions()
{
return Product::lists('name', 'id');
}
public function getCouponIdOptions()
{
return Coupon::lists('value', 'id');
}
public function afterValidate()
{
/**
А что если купон не соответствует своему товару
*/
if($this->coupon_id)
{
$coupon = Coupon::where('id', '=', $this->coupon_id)->where('product_id', '=', $this->product_id)->first();
if($coupon==null)
{
throw new ValidationException([
'coupon_id' => 'Купон на скидку не соответствует своему товару',
]);
}
}
}
public function afterSave()
{
/**
Отмечаю купон как использованый
*/
Coupon::where('id', '=', $this->coupon_id)->where('product_id', '=', $this->product_id)->update(array('is_used' => $this->coupon_id));
}
public function afterDelete()
{
/**
Удаляю купон если удалили заказ с этим купоном
*/
Coupon::where('id', '=', $this->coupon_id)->where('product_id', '=', $this->product_id)->delete();
}
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Models;
use Model;
/**
* Product Model
*/
class Product extends Model
{
use \October\Rain\Database\Traits\Validation;
public $rules = [
'name' => 'required',
'slug'=>'required|unique:firestarter_shop_vendors',
'price' => 'required'
];
/**
* @var string The database table used by the model.
*/
public $table = 'firestarter_shop_products';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
protected $jsonable = ['options'];
protected $slugs = ['slug' => 'name'];
/**
* @var array Relations
*/
public $hasOne = [];
public $hasMany = [];
public $belongsTo = [
'vendor' => ['Firestarter\Shop\Models\Vendor'],
];
public $belongsToMany = [
'categories' => ['Firestarter\Shop\Models\Category', 'table' => 'firestarter_shop_products_categories']
];
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = ['digital_product' => ['System\Models\File']];
public $attachMany = ['featured_images' => ['System\Models\File']];
}
\ No newline at end of file
<?php namespace Firestarter\Shop\Models;
use Model;
use Firestarter\Shop\Models\Currency as Currency;
class Settings extends Model {
public $implement = ['System.Behaviors.SettingsModel'];
public $settingsCode = 'firestarter_shop_settings';
public $settingsFields = 'fields.yaml';
public function getCurrenciesList()
{
return Currency::lists('name', 'id');
}
public function getWmzCarrencyOptions()
{
return $this->getCurrenciesList();
}
public function getWmrCarrencyOptions()
{
return $this->getCurrenciesList();
}
public function getWmuCarrencyOptions()
{
return $this->getCurrenciesList();
}
public function getWmeCarrencyOptions()
{
return $this->getCurrenciesList();
}
public function getYadCarrencyOptions()
{
return $this->getCurrenciesList();
}
}
<?php namespace Firestarter\Shop\Models;
use Model;
/**
* Vendor Model
*/
class Vendor extends Model
{
use \October\Rain\Database\Traits\Validation;
public $rules = [
'name' => 'required',
'slug'=>'required|unique:firestarter_shop_vendors'
];
/**
* @var string The database table used by the model.
*/
public $table = 'firestarter_shop_vendors';
/**
* @var array Guarded fields
*/
protected $guarded = ['*'];
/**
* @var array Fillable fields
*/
protected $fillable = [];
protected $slugs = ['slug' => 'name'];
/**
* @var array Relations
*/
public $hasOne = [];
public $hasMany = [
'products' => ['Firestarter\Shop\Models\Product', 'order' => 'created_at']
];
public $belongsTo = [];
public $belongsToMany = [];
public $morphTo = [];
public $morphOne = [];
public $morphMany = [];
public $attachOne = ['logo' => ['System\Models\File']];
public $attachMany = [];
}
\ No newline at end of file
# ===================================
# List Column Definitions
# ===================================
columns:
title:
label: rainlab.forum::lang.data.title
searchable: true
description:
label: rainlab.forum::lang.data.desc
searchable: true
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
fields:
parent:
label: rainlab.forum::lang.data.parent
type: relation
nameFrom: title
emptyOption: rainlab.forum::lang.data.noparent
title:
label: rainlab.forum::lang.data.title
span: left
slug:
label: rainlab.forum::lang.data.slug
span: right
preset: title
description:
label: rainlab.forum::lang.data.desc
type: textarea
size: tiny
\ No newline at end of file
# ===================================
# List Column Definitions
# ===================================
columns:
value:
label: firestarter.shop::lang.shop.value
type: text
searchable: true
discount:
label: firestarter.shop::lang.shop.discount
type: text
searchable: true
is_used:
label: firestarter.shop::lang.shop.is_used
type: switch
searchable: true
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
fields:
value:
label: firestarter.shop::lang.shop.value
span: left
placeholder: firestarter.shop::lang.shop.value_placeholder
product_id:
label: firestarter.shop::lang.shop.product
span: right
type: dropdown
placeholder: firestarter.shop::lang.shop.product
discount:
label: firestarter.shop::lang.shop.discount
span: left
type: number
placeholder: firestarter.shop::lang.shop.discount_placeholder
is_used:
label: firestarter.shop::lang.shop.is_used
span: right
type: checkbox
default: false
# ===================================
# List Column Definitions
# ===================================
columns:
name:
label: firestarter.shop::lang.shop.currency_name
type: text
searchable: true
value:
label: firestarter.shop::lang.shop.currency_value
type: text
searchable: true
is_default:
label: firestarter.shop::lang.shop.is_default
type: switch
searchable: true
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
fields:
name:
label: firestarter.shop::lang.shop.currency_name
span: left
placeholder: firestarter.shop::lang.shop.currency_name_placeholder
value:
label: firestarter.shop::lang.shop.currency_value
span: right
placeholder: firestarter.shop::lang.shop.currency_value_placeholder
sign:
label: firestarter.shop::lang.shop.currency_sign
span: left
placeholder: firestarter.shop::lang.shop.currency_sign_placeholder
is_default:
label: firestarter.shop::lang.shop.is_default
span: right
type: checkbox
default: false
# ===================================
# List Column Definitions
# ===================================
columns:
user_name:
label: firestarter.shop::lang.shop.user_name
type: text
searchable: true
email:
label: firestarter.shop::lang.shop.email
type: text
searchable: true
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
fields:
user_name:
label: firestarter.shop::lang.shop.user_name
span: left
placeholder: firestarter.shop::lang.shop.user_name_placeholder
email:
label: firestarter.shop::lang.shop.email
span: right
placeholder: firestarter.shop::lang.shop.email_placeholder
product_id:
label: firestarter.shop::lang.shop.product
span: left
type: dropdown
placeholder: firestarter.shop::lang.shop.product
coupon_id:
label: firestarter.shop::lang.shop.coupon
span: right
type: dropdown
placeholder: firestarter.shop::lang.shop.coupon
# ===================================
# List Column Definitions
# ===================================
columns:
name:
label: firestarter.shop::lang.shop.name
type: text
searchable: true
model:
label: firestarter.shop::lang.shop.model
type: text
searchable: true
slug:
label: URL
type: text
price:
label: firestarter.shop::lang.shop.price
type: number
searchable: true
is_recommended:
label: Рекомендован
type: switch
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
fields:
product_info:
label: firestarter.shop::lang.shop.product_main
type: section
name:
label: firestarter.shop::lang.shop.name
span: left
placeholder: firestarter.shop::lang.shop.name_placeholder
slug:
label: URL
preset:
field: name
type: url
span: right
model:
label: firestarter.shop::lang.shop.model
span: left
placeholder: firestarter.shop::lang.shop.model_placeholder
price:
label: firestarter.shop::lang.shop.price
span: right
articul:
label: Артикул
span: left
product_options:
label: firestarter.shop::lang.shop.product_options
type: section
options:
type: repeater
prompt: Добавить вариант товара
form:
fields:
option_articul:
label: Артикул
type: text
span: left
option_name:
label: Название варианта
type: text
span: right
option_price:
label: Цена
type: text
span: left
option_old_price:
label: Старая Цена
type: text
span: right
option_count:
label: Количество
type: text
span: left
product_taxonomy:
label: firestarter.shop::lang.shop.product_taxonomy
type: section
categories:
label: Отображать в категориях
type: relation
nameFrom: title
span: left
vendor:
label: Производитель
type: relation
nameFrom: name
span: right
product_active:
label: firestarter.shop::lang.shop.product_active
type: section
is_active:
label: Товар в продаже
type: switch
span: left
is_digital:
label: Товар цифровой
type: switch
span: right
digital_product:
label: firestarter.shop::lang.shop.digital_product
type: fileupload
mode: file
span: right
is_recommended:
label: Товар рекоменедуем
type: switch
span: left
available_at:
label: Будет доступен
type: datepicker
mode: datetime
span: left
product_additional:
label: firestarter.shop::lang.shop.product_additional
type: section
short_description:
label: firestarter.shop::lang.shop.short_description
type: richeditor
span: left
featured_images:
label: firestarter.shop::lang.shop.featured_images
type: fileupload
mode: image
imageWidth: 200
imageHeight: 200
span: right
description:
label: firestarter.shop::lang.shop.description
type: richeditor
span: left
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
tabs:
fields:
wmz_is_active:
label: Активна
type: checkbox
default: false
tab: WMZ
wmz_carrency:
label: Валюта для кошелька
type: dropdown
tab: WMZ
wmz_purse:
label: WMZ кошелек
tab: WMZ
wmz_secret_key:
label: WMZ секретный ключ
tab: WMZ
wmr_is_active:
label: Активна
type: checkbox
default: false
tab: WMR
wmr_carrency:
label: Валюта для кошелька
type: dropdown
tab: WMR
wmr_purse:
label: WMR кошелек
tab: WMR
wmr_secret_key:
label: WMR секретный ключ
tab: WMR
wmu_is_active:
label: Активна
type: checkbox
default: false
tab: WMU
wmu_carrency:
label: Валюта для кошелька
type: dropdown
tab: WMU
wmu_purse:
label: WMU кошелек
tab: WMU
wmu_secret_key:
label: WMU секретный ключ
tab: WMU
wme_is_active:
label: Активна
type: checkbox
default: false
tab: WME
wme_carrency:
label: Валюта для кошелька
type: dropdown
tab: WME
wme_purse:
label: WME кошелек
tab: WME
wme_secret_key:
label: WME секретный ключ
tab: WME
yad_is_active:
label: Активна
type: checkbox
default: false
tab: YaD
yad_carrency:
label: Валюта для кошелька
type: dropdown
tab: YaD
yad_purse:
label: Yandex.Деньги кошелек
tab: YaD
yad_secret_key:
label: Yandex.Деньги "секрет"
tab: YaD
\ No newline at end of file
# ===================================
# List Column Definitions
# ===================================
columns:
name:
label: Vendor Name
type: text
slug:
label: Vendor Slug
type: text
\ No newline at end of file
# ===================================
# Form Field Definitions
# ===================================
fields:
name:
label: vendor name
type: text
span: left
slug:
label: URL
preset:
field: name
type: url
span: right
description:
type: richeditor
size: huge
logo:
label: Logotype
type: fileupload
mode: image
imageHeight: 240
imageWidth: 320
\ No newline at end of file
<?php
use Firestarter\Shop\Models\Product as Product;
use Firestarter\Shop\Models\Coupon as Coupon;
use Firestarter\Shop\Models\Order as Order;
use Firestarter\Shop\Models\Currency as Currency;
use Firestarter\Shop\Models\Settings as Settings;
Route::group(['prefix' => 'license'], function()
{
Route::get('order/webmoney/wmz', function()
{
/**
Нужны все валюты
*/
$currencies = Currency::get()->keyBy('id')->toArray();
/**
Это предварительный запрос?
*/
if(post('LMI_PREREQUEST')==1)
{
/**
Есть ли такой товар в базе?
*/
if(!$product = Product::find(post('SHOP_USER_PRODUCT_ID'))->toArray());
{
die("ERROR: НЕТ ТАКОГО ТОВАРА");
};
/**
Строка с пользователем?
*/
if(!post('SHOP_USER_NAME') OR post('SHOP_USER_NAME')=='')
{
die("ERROR: НЕ УКАЗАН ПОЛЬЗОВАТЕЛЬ");
};
/**
Строка с почтой?
*/
if(!post('SHOP_USER_EMAIL') OR post('SHOP_USER_EMAIL')=='')
{
die("ERROR: НЕ УКАЗАН EMAIL");
};
/**
Кошелек верный?
*/
if(post('LMI_PAYEE_PURSE')=='' OR post('LMI_PAYEE_PURSE')!==Settings::get('wmz_purse'))
{
die("ERROR: НЕВЕРНЫЙ КОШЕЛЕК ПОЛУЧАТЕЛЯ ".post('LMI_PAYEE_PURSE'));
};
/**
Проверка наличия купона в форме и расчет цены:
*/
if(post('SHOP_USER_COUPON'))
{
if(!$coupon = Coupon::where('product_id', '=', post('SHOP_USER_PRODUCT_ID'))->where('value', '=', post('SHOP_USER_COUPON'))->first()->toArray())
{
die("ERROR: У ДАНОГО ТОВАРА НЕТ ТАКОГО КУПОНА");
}
/**
{{(product.price - product.price*coupon.discount/100)*currencies[settings.wmz_carrency].value}}
*/
$price = ($product['price'] - $product['price']*$coupon['discount']/100)*$currencies[Settings::get('wmz_carrency')]['value'];
}
else
{
/**
{{product.price*currencies[settings.wmz_carrency].value}}
*/
$price = $product['price']*$currencies[Settings::get('wmz_carrency')]['value'];
};
/**
Проверка цены:
*/
if(post('LMI_PAYMENT_AMOUNT')=='' OR post('LMI_PAYMENT_AMOUNT')!==$price)
{
die("ERROR: НЕВЕРНАЯ СУММА");
};
/**
Все нормально - выводим YES
*/
die("YES");
}
/**
ЕСЛИ НЕТ LMI_PREREQUEST, СЛЕДОВАТЕЛЬНО ЭТО ФОРМА ОПОВЕЩЕНИЯ О ПЛАТЕЖЕ
*/
else
{
/**
Ключ
*/
$secret_key=Settings::get('wmz_secret_key');
/**
Клеим строку
*/
$common_string =
post('LMI_PAYEE_PURSE').
post('LMI_PAYMENT_AMOUNT').
post('LMI_PAYMENT_NO').
post('LMI_MODE').
post('LMI_SYS_INVS_NO').
post('LMI_SYS_TRANS_NO').
post('LMI_SYS_TRANS_DATE').
$secret_key.
post('LMI_PAYER_PURSE').
post('LMI_PAYER_WM');
/**
Шифруем полученную строку в SHA256 и переводим ее в верхний регистр
*/
$hash = strtoupper(hash("sha256",$common_string));
/**
Прерываем работу скрипта, если контрольные суммы не совпадают
*/
if($hash!==post('LMI_HASH'))
{
exit;
}
/**
Создаем заказ
*/
if(post('SHOP_USER_COUPON'))
{
$coupon = Coupon::where('product_id', '=', post('SHOP_USER_PRODUCT_ID'))->where('value', '=', post('SHOP_USER_COUPON'))->first()->toArray();
$coupon_id = $coupon['id'];
}
else
{
$coupon_id = 0;
}
/**
*/
$post = new Order;
$post->product_id = post('SHOP_USER_PRODUCT_ID');
$post->coupon_id = $coupon_id;
$post->user_name = post('SHOP_USER_NAME');
$post->email = post('SHOP_USER_EMAIL');
$post->save();
/**
Добавляю инфу по пользователю в массив товара
*/
$product['user_name'] = post('SHOP_USER_NAME');
$product['user_email'] = post('SHOP_USER_EMAIL');
/**
Отправляем софт клиенту
*/
Mail::sendTo(post('SHOP_USER_EMAIL'), 'firestarter.shop::mail.license', $product);
return Redirect::to('/');
}
});
});
\ No newline at end of file
<?php namespace Firestarter\Shop\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateCategoriesTable extends Migration
{
public function up()
{
if (!Schema::hasTable('firestarter_shop_categories'))
{
Schema::create('firestarter_shop_categories', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->integer('parent_id')->unsigned()->index()->nullable();
$table->string('title')->nullable();
$table->string('slug')->index()->unique();
$table->string('description')->nullable();
$table->integer('nest_left')->nullable();
$table->integer('nest_right')->nullable();
$table->integer('nest_depth')->nullable();
$table->integer('count_products')->default(0);
$table->timestamps();
});
}
if (!Schema::hasTable('firestarter_shop_products_categories'))
{
Schema::create('firestarter_shop_products_categories', function($table)
{
$table->engine = 'InnoDB';
$table->integer('product_id')->unsigned();
$table->integer('category_id')->unsigned();
$table->primary(['product_id', 'category_id']);
});
}
}
public function down()
{
if (Schema::hasTable('firestarter_shop_categories'))
{
Schema::drop('firestarter_shop_categories');
}
if (Schema::hasTable('firestarter_shop_products_categories'))
{
Schema::drop('firestarter_shop_products_categories');
}
}
}
<?php namespace Firestarter\Shop\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateCouponsTable extends Migration
{
public function up()
{
if (!Schema::hasTable('firestarter_shop_coupons'))
{
Schema::create('firestarter_shop_coupons', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('value');
$table->smallInteger('discount')->default(0);
$table->integer('product_id')->nullable();
$table->boolean('is_used')->default(false);
$table->timestamps();
});
}
}
public function down()
{
if (Schema::hasTable('firestarter_shop_coupons'))
{
Schema::drop('firestarter_shop_coupons');
}
}
}
<?php namespace Firestarter\Shop\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateCurrenciesTable extends Migration
{
public function up()
{
if (!Schema::hasTable('firestarter_shop_currencies'))
{
Schema::create('firestarter_shop_currencies', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('name')->nullable();
$table->string('sign')->nullable();
$table->decimal('value', 15, 4);
$table->boolean('is_default')->default(false);
$table->timestamps();
});
}
}
public function down()
{
if (Schema::hasTable('firestarter_shop_currencies'))
{
Schema::drop('firestarter_shop_currencies');
}
}
}
<?php namespace Firestarter\Shop\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateOrdersTable extends Migration
{
public function up()
{
if (!Schema::hasTable('firestarter_shop_orders'))
{
Schema::create('firestarter_shop_orders', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->integer('product_id')->nullable();
$table->integer('coupon_id')->nullable();
$table->string('user_name')->nullable();
$table->string('email')->nullable();
$table->timestamps();
});
}
}
public function down()
{
if (Schema::hasTable('firestarter_shop_orders'))
{
Schema::drop('firestarter_shop_orders');
}
}
}
<?php namespace Firestarter\Shop\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateProductsTable extends Migration
{
public function up()
{
if (!Schema::hasTable('firestarter_shop_products'))
{
Schema::create('firestarter_shop_products', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('name')->nullable();
$table->string('slug')->index()->unique();
$table->string('model')->nullable();
$table->string('articul')->nullable();
$table->text('short_description')->nullable();
$table->text('description')->nullable();
$table->json('options');
$table->integer('vendor_id')->nullable();
$table->boolean('is_active')->default(true);
$table->boolean('is_recommended')->default(false);
$table->boolean('is_digital')->default(false);
$table->decimal('price', 15, 4);
$table->timestamp('available_at');
$table->timestamps();
});
}
}
public function down()
{
if (Schema::hasTable('firestarter_shop_products'))
{
Schema::dropIfExists('firestarter_shop_products');
}
}
}
<?php namespace Firestarter\Shop\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateVendorsTable extends Migration
{
public function up()
{
if (!Schema::hasTable('firestarter_shop_vendors'))
{
Schema::create('firestarter_shop_vendors', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('name')->nullable();
$table->string('slug')->index()->unique();
$table->text('description')->nullable();
$table->timestamps();
});
}
}
public function down()
{
if (Schema::hasTable('firestarter_shop_vendors'))
{
Schema::dropIfExists('firestarter_shop_vendors');
}
}
}
1.0.1: First version of Shop
1.0.2:
- Create Firestarter Shop Product table
- create_products_table.php
- create_orders_table.php
- create_coupons_table.php
- create_currencies_table.php
1.0.3:
- Create Firestarter Shop Categories table
- create_categories_table.php
1.0.4:
- Create Firestarter Shop Vendors table
- create_vendors_table.php
\ No newline at end of file
subject = "Лицензия на программный продукт {{ user_name }}"
==
<p>Приветствую, Вас <b>{{ user_name }}</b> !</p>
<p>Лицензия и поддержка на продукт {{ name }} {{ model }} выдана на <b>{{ user_email }} </b>.</p>
</br>
<p>Скачать <b>{{ name }} {{ model }}</b>:</p>
<p>{{ digital_product.path | app }} :</p>
</br>
{% if additional is not empty %}
<p><b>Дополнительная информация:</b></p>
<p>{{ additional }}</p>
{% endif %}
<p>
<b>Хочу напомнить еще несколько моментов:</b></br>
<ul>
<li>1) Скрипт будет поддерживаться и обновляться до тех пор, пока он нужен будет Вам, в первую очередь.</li>
<li>2) Скрипт будет поддерживаться о обновляться до "слива" его в паблик. Прошу понять меня правильно.</li>
<li>3) Но почта, ася(494812124) и форум ifirestarter.ru - всегда открыты для предложений и пожеланий.</li>
</ul>
</p>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment