[Помощь] Добавить поле к заказу в админке и вывод в личном кабинете

HeadHunter

Shop Script
Регистрация
21 Июн 2011
Сообщения
629
Реакции
276
Собственно сабж. Как добавить поле в редакторе заказа, чтобы оно сохранялось в базу и можно было бы вывести в личном кабинете у юзверя.

С ув. kadurinho
 
Сам и отвечаю на свой вопрос)

1. Выполнить SQL-запрос:
Код:
ALTER TABLE  `SC_orders` ADD  `parcel_id` VARCHAR( 100 ) NOT NULL

2. В файле published/SC/html/scripts/templates/backend/order_editor/order.html добавить
Код:
Моё моле: <input type="text" name="parcel_id" value="{$order_info.parcel_id}" maxlength="100">

3. В файле published/SC/html/scripts/modules/order_editor/_methods/edit_order.php после
Код:
$discount_descr = $this->getData('order_discount_description');
добавить
Код:
$parcel_id = $this->getData('parcel_id');
и заменить
Код:
$info = compact('shipping_info', 'billing_info', 'products', 'discount', 'shipping_cost', 'payment_type', 'amount', 'comment', 'discount_descr');
на
Код:
$info = compact('shipping_info', 'billing_info', 'products', 'discount', 'shipping_cost', 'payment_type', 'amount', 'comment', 'discount_descr', 'parcel_id');

4. В файле published/SC/html/scripts/modules/order_editor/class.order_editor.php после
Код:
,'discount_description' => $order_info['discount_descr']
добавить
Код:
,'parcel_id' => $order_info['parcel_id']

5. В файле published/SC/html/scripts/templates/frontend/order_detailed.html добавьте в нужном месте
Код:
{$order.parcel_id}

6. Чтобы вывести это поле в просмотр заказа, открываем published/SC/html/scripts/templates/backend/order_detailed.html и в нужное место вставляем
Код:
Моё поле: {$order.parcel_id}
 
Назад
Сверху