CakeProducts/templates/Products/view.php

58 lines
2.8 KiB
PHP

<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $product
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('Edit Product'), ['action' => 'edit', $product->id], ['class' => 'side-nav-item']) ?>
<?= $this->Form->postLink(__('Delete Product'), ['action' => 'delete', $product->id], ['confirm' => __('Are you sure you want to delete # {0}?', $product->id), 'class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('List Products'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('New Product'), ['action' => 'add'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="products view content">
<h3><?= h($product->name) ?></h3>
<table>
<tr>
<th><?= __('Name') ?></th>
<td><?= h($product->name) ?></td>
</tr>
<tr>
<th><?= __('Product Category') ?></th>
<td><?= $product->hasValue('product_category') ? $this->Html->link($product->product_category->name, ['controller' => 'ProductCategories', 'action' => 'view', $product->product_category->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Product Type') ?></th>
<td><?= $product->product_type_id->name ?></td>
</tr>
</table>
</div>
<div class="related">
<h4><?= __('Product Attributes') ?></h4>
<?php if (!empty($product->product_attributes)) : ?>
<div class="table-responsive">
<table>
<?php foreach ($product->product_attributes as $productAttribute) : ?>
<?php if (!$productAttribute->hasValue('product_category_attribute')) {
continue;
} ?>
<tr>
<th><?= h($productAttribute->product_category_attribute->name) ?></th>
<td>
<?= $productAttribute->hasValue('product_category_attribute_option') ? h($productAttribute->product_category_attribute_option->attribute_label) : ''; ?>
<?= !$productAttribute->hasValue('product_category_attribute_option') ? h($productAttribute->attribute_value) : ''; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>