primary sku photo working with janky toggle workaround but w/e lol

This commit is contained in:
bs
2025-11-01 16:10:48 -07:00
parent 41c5f7169e
commit b145e901ef
9 changed files with 226 additions and 10 deletions
+9
View File
@@ -58,6 +58,7 @@ class ProductPhotosTable extends Table
);
$this->addBehavior('Timestamp');
$this->addBehavior('Tools.Toggle', [
'field' => 'primary_photo',
'scopeFields' => ['product_id'],
@@ -74,6 +75,14 @@ class ProductPhotosTable extends Table
'product_category_id IS NOT' => null,
],
]);
$this->addBehavior('CakeProducts.ThirdToggle', [
'field' => 'primary_sku_photo',
'scopeFields' => ['product_sku_id'],
'scope' => [
'deleted IS' => null,
'product_sku_id IS NOT' => null,
],
]);
$this->belongsTo('Products', [
'foreignKey' => 'product_id',
'joinType' => 'LEFT',