forked from BantenITSolutions/oc-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates a new form widget for that lists items, and uses this on the backend to display order items. Read-only at the moment, but it's better than nothing... Also set a blank label for the field
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
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
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,28 @@ | ||
<?php namespace Dshoreman\Shop\FormWidgets; | ||
|
||
use Backend\Classes\FormWidgetBase; | ||
use Backend\Widgets\Grid; | ||
|
||
class ItemGrid extends FormWidgetBase { | ||
|
||
public function widgetDetails() | ||
{ | ||
return [ | ||
'name' => 'Item Grid', | ||
'description' => 'Renders a grid of items from an order', | ||
]; | ||
} | ||
|
||
public function render() | ||
{ | ||
$this->prepareVars(); | ||
|
||
return $this->makePartial('itemgrid'); | ||
} | ||
|
||
public function prepareVars() | ||
{ | ||
$this->vars['items'] = json_decode($this->formField->value); | ||
} | ||
|
||
} |
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,22 @@ | ||
<table class="table table-condensed"> | ||
<thead> | ||
<tr> | ||
<th>Item #</th> | ||
<th>Name</th> | ||
<th>Price</th> | ||
<th>Quantity</th> | ||
<th>Subtotal</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($items as $item): ?> | ||
<tr> | ||
<td><?= $item->id ?></td> | ||
<td><?= $item->name ?></td> | ||
<td><?= $item->price ?></td> | ||
<td><?= $item->qty ?></td> | ||
<td><?= $item->subtotal ?></td> | ||
</tr> | ||
<?php endforeach; ?> | ||
</tbody> | ||
</table> |
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