ver. 0.291: ShopProducer frontend migration to Domain + Controllers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 20:32:07 +01:00
parent 1ba0c12327
commit 6181ef958d
19 changed files with 267 additions and 119 deletions

View File

@@ -1,48 +0,0 @@
<?
namespace front\controls;
class ShopProducer
{
static public function products()
{
global $page, $lang_id;
$producer = new \shop\Producer( \Shared\Helpers\Helpers::get( 'producer_id' ) );
$page['show_title'] = true;
$page['language']['title'] = $producer['name'];
$results = \shop\Producer::producer_products( $producer['id'], $lang_id, (int) \Shared\Helpers\Helpers::get( 'bs' ) );
if ( $results['ls'] > 1 )
{
$pager = \Shared\Tpl\Tpl::view( 'site/pager', [
'ls' => $results['ls'],
'bs' => (int) \Shared\Helpers\Helpers::get( 'bs' ) ? (int) \Shared\Helpers\Helpers::get( 'bs' ) : 1,
'page' => $page,
'link' => 'producent/' . \Shared\Helpers\Helpers::seo( $producer['name'] )
] );
}
return \Shared\Tpl\Tpl::view( 'shop-producer/products', [
'producer' => $producer,
'products' => $results['products'],
'pager' => $pager
] );
}
static public function list()
{
global $mdb, $page;
$page['show_title'] = true;
$page['language']['title'] = 'Producenci';
$rows = $mdb -> select( 'pp_shop_producer', 'id', [ 'status' => 1, 'ORDER' => [ 'name' => 'ASC' ] ] );
if ( \Shared\Helpers\Helpers::is_array_fix( $rows ) ) foreach ( $rows as $row )
$producers[] = new \shop\Producer( $row );
return \Shared\Tpl\Tpl::view( 'shop-producer/list', [
'producers' => $producers
] );
}
}

View File

@@ -191,6 +191,12 @@ class Site
new \Domain\Order\OrderRepository( $mdb )
);
},
'ShopProducer' => function() {
global $mdb;
return new \front\Controllers\ShopProducerController(
new \Domain\Producer\ProducerRepository( $mdb )
);
},
];
}
}