Created
October 9, 2013 19:58
-
-
Save Fi1osof/6907324 to your computer and use it in GitHub Desktop.
Создаем таблицы и основные записи для пакета Billing
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
<?php | |
$manager = $modx->getManager(); | |
// Создаем таблицы | |
$objects = array( | |
'Order', | |
'OrderProduct', | |
'OrderStatus', | |
'Payment', | |
'Paysystem', | |
); | |
foreach($objects as $name){ | |
$manager->createObjectContainer($name); | |
} | |
// Создаем статусы | |
$statuses = array ( | |
1 => | |
array ( | |
'id' => 1, | |
'status' => 'Новый', | |
'rank' => 1, | |
'comment' => 'Неоформленный заказ еще на стадии наполнения корзины', | |
), | |
2 => | |
array ( | |
'id' => 2, | |
'status' => 'Оформлен', | |
'rank' => 2, | |
'comment' => 'Пользователь оформил заказ', | |
), | |
8 => | |
array ( | |
'id' => 8, | |
'status' => 'Оплачен', | |
'rank' => 3, | |
'comment' => 'Заказ оплачен', | |
), | |
3 => | |
array ( | |
'id' => 3, | |
'status' => 'Принят', | |
'rank' => 4, | |
'comment' => 'Заказ принят менеджером в работу', | |
), | |
4 => | |
array ( | |
'id' => 4, | |
'status' => 'Доставка', | |
'rank' => 5, | |
'comment' => 'Заказ в процессе доставки', | |
), | |
5 => | |
array ( | |
'id' => 5, | |
'status' => 'Доставлен', | |
'rank' => 6, | |
'comment' => 'Заказ доставлен', | |
), | |
6 => | |
array ( | |
'id' => 6, | |
'status' => 'Выполнен', | |
'rank' => 7, | |
'comment' => 'Заказ выполнен', | |
), | |
7 => | |
array ( | |
'id' => 7, | |
'status' => 'Отменен', | |
'rank' => 8, | |
'comment' => 'Заказ отменен', | |
), | |
); | |
foreach($statuses as $id => $status){ | |
$o = $modx->newObject('OrderStatus', $status); | |
$o->set('id', $id); | |
$o->save(); | |
} | |
// Добавляем платежную систему | |
$Paysystems = array ( | |
1 => | |
array ( | |
'id' => 1, | |
'name' => 'Robokassa', | |
'comment' => 'Сервис приема широкого спектра платежей', | |
), | |
); | |
foreach($Paysystems as $id => $Paysystem){ | |
$o = $modx->newObject('Paysystem', $Paysystem); | |
$o->set('id', $id); | |
$o->save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment