show image on view product photos page, setEntityClass defaulting to all plugin entities
This commit is contained in:
parent
155095c25c
commit
8cf8d7cfa0
|
@ -169,6 +169,8 @@ class ProductPhotosController extends AppController
|
|||
|
||||
$fullPath = Configure::readOrFail('CakeProducts.photos.directory') . $productPhoto->photo_dir . DS . $productPhoto->photo_filename;
|
||||
|
||||
return $this->response->withFile($fullPath);
|
||||
return $this->response->withFile($fullPath, [
|
||||
'download' => $this->request->getQuery('download', false) === '1'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
use Cake\ORM\Association\BelongsTo;
|
||||
|
@ -49,6 +50,10 @@ class ProductCategoryAttributeOptionsTable extends Table
|
|||
$this->setDisplayField('attribute_value');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductCategoryAttributeOptions.entity', 'CakeProducts\Model\Entity\ProductCategoryAttributeOption')
|
||||
);
|
||||
|
||||
$this->belongsTo('ProductCategoryAttributes', [
|
||||
'foreignKey' => 'product_category_attribute_id',
|
||||
'joinType' => 'INNER',
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Database\Type\EnumType;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
|
@ -51,6 +52,9 @@ class ProductCategoryAttributesTable extends Table
|
|||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductCategoryAttributes.entity', 'CakeProducts\Model\Entity\ProductCategoryAttribute')
|
||||
);
|
||||
$this->belongsTo('ProductCategories', [
|
||||
'foreignKey' => 'product_category_id',
|
||||
'bindingKey' => 'internal_id',
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use CakeProducts\Model\Entity\ProductCategoryVariantOption;
|
||||
use CakeProducts\Model\Table\ProductCategoryVariantsTable;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
|
@ -53,6 +54,9 @@ class ProductCategoryVariantOptionsTable extends Table
|
|||
$this->setDisplayField('variant_value');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductCategoryVariantOptions.entity', 'CakeProducts\Model\Entity\ProductCategoryVariantOption')
|
||||
);
|
||||
$this->addBehavior('Timestamp');
|
||||
|
||||
$this->belongsTo('ProductCategoryVariants', [
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\ORM\Query\SelectQuery;
|
||||
use Cake\ORM\RulesChecker;
|
||||
use Cake\ORM\Table;
|
||||
|
@ -44,6 +45,10 @@ class ProductCategoryVariantsTable extends Table
|
|||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductCategoryVariants.entity', 'CakeProducts\Model\Entity\ProductCategoryVariant')
|
||||
);
|
||||
|
||||
$this->belongsTo('ProductCategories', [
|
||||
'foreignKey' => 'product_category_id',
|
||||
'bindingKey' => 'internal_id',
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
use Cake\ORM\Association\BelongsTo;
|
||||
|
@ -52,6 +53,10 @@ class ProductPhotosTable extends Table
|
|||
$this->setDisplayField('photo_filename');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductPhotos.entity', 'CakeProducts\Model\Entity\ProductPhoto')
|
||||
);
|
||||
|
||||
$this->addBehavior('Timestamp');
|
||||
|
||||
$this->belongsTo('Products', [
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use CakeProducts\Model\Table\ProductsTable;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
|
@ -52,6 +53,10 @@ class ProductSkusTable extends Table
|
|||
$this->setDisplayField('sku');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductSkus.entity', 'CakeProducts\Model\Entity\ProductSku')
|
||||
);
|
||||
|
||||
$this->addBehavior('Timestamp');
|
||||
|
||||
$this->belongsTo('Products', [
|
||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Database\Type\EnumType;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
|
@ -51,6 +52,10 @@ class ProductsTable extends Table
|
|||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.Products.entity', 'CakeProducts\Model\Entity\Product')
|
||||
);
|
||||
|
||||
$this->belongsTo('ProductCategories', [
|
||||
'foreignKey' => 'product_category_id',
|
||||
'bindingKey' => 'internal_id',
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
<div class="column column-80">
|
||||
<div class="productPhotos view content">
|
||||
<h3><?= h($productPhoto->photo_filename) ?></h3>
|
||||
<img src="<?= $this->Url->build([
|
||||
'action' => 'image',
|
||||
$productPhoto->id,
|
||||
]); ?>" alt="<?= $productPhoto->id; ?>"/>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?= __('Id') ?></th>
|
||||
|
|
Loading…
Reference in New Issue