ver. 0.292: ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration to Domain
Full migration of front\factory\ — entire directory removed (all 20 classes migrated). ProductRepository +20 frontend methods, PromotionRepository +5 applyType methods, TransportRepository +4 cached methods, PaymentMethodRepository +cached frontend methods. Fix: broken transports_list() in ajax.php replaced with forPaymentMethod(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
77
autoload/front/Controllers/ShopProductController.php
Normal file
77
autoload/front/Controllers/ShopProductController.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
namespace front\Controllers;
|
||||
|
||||
class ShopProductController
|
||||
{
|
||||
private $categoryRepository;
|
||||
|
||||
public function __construct( \Domain\Category\CategoryRepository $categoryRepository )
|
||||
{
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
}
|
||||
|
||||
public function lazyLoadingProducts()
|
||||
{
|
||||
global $lang_id;
|
||||
|
||||
$output = '';
|
||||
$categoryId = (int)\Shared\Helpers\Helpers::get( 'category_id' );
|
||||
$products_ids = $this->categoryRepository->productsId(
|
||||
$categoryId,
|
||||
$this->categoryRepository->getCategorySort( $categoryId ),
|
||||
$lang_id,
|
||||
8,
|
||||
(int)\Shared\Helpers\Helpers::get( 'offset' )
|
||||
);
|
||||
|
||||
if ( is_array( $products_ids ) ): foreach ( $products_ids as $product_id ):
|
||||
$output .= \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
|
||||
'product' => \shop\Product::getFromCache( $product_id, $lang_id )
|
||||
] );
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
echo json_encode( [ 'html' => $output ] );
|
||||
exit;
|
||||
}
|
||||
|
||||
public function warehouseMessage()
|
||||
{
|
||||
global $lang_id;
|
||||
|
||||
$values = json_decode( \Shared\Helpers\Helpers::get( 'values' ), true );
|
||||
|
||||
$attributes = [];
|
||||
foreach ( $values as $key => $val )
|
||||
{
|
||||
if ( $key != 'product-id' and $key != 'quantity' )
|
||||
$attributes[] = $val;
|
||||
}
|
||||
|
||||
$result = \shop\Product::getWarehouseMessage( $values['product-id'], $attributes, $lang_id );
|
||||
echo json_encode( $result );
|
||||
exit;
|
||||
}
|
||||
|
||||
public function drawProductAttributes()
|
||||
{
|
||||
global $lang_id;
|
||||
|
||||
$combination = '';
|
||||
$selected_values = \Shared\Helpers\Helpers::get( 'selected_values' );
|
||||
|
||||
foreach ( $selected_values as $value )
|
||||
{
|
||||
$combination .= $value;
|
||||
if ( $value != end( $selected_values ) )
|
||||
$combination .= '|';
|
||||
}
|
||||
|
||||
$product_id = \Shared\Helpers\Helpers::get( 'product_id' );
|
||||
$product = \shop\Product::getFromCache( $product_id, $lang_id );
|
||||
$product_data = $product->getProductDataBySelectedAttributes( $combination );
|
||||
|
||||
echo json_encode( [ 'product_data' => $product_data ] );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user