Files
shopPRO/autoload/front/controls/class.ShopProduct.php
Jacek Pyziak 319491975d ver. 0.283: Legacy class cleanup — S, Html, Email, Image, Log, Mobile_Detect → Shared namespace
- Migrate class.S → Shared\Helpers\Helpers (140+ files), remove 12 unused methods
- Migrate class.Html → Shared\Html\Html
- Migrate class.Email → Shared\Email\Email
- Migrate class.Image → Shared\Image\ImageManipulator
- Delete class.Log (unused), class.Mobile_Detect (outdated UA detection)
- Remove grid library loading from admin (index.php, ajax.php)
- Replace gridEdit usage in 10 admin templates with grid-edit-replacement.php
- Fix grid-edit-replacement.php AJAX to send values as JSON (grid.js compat)
- Remove mobile layout conditionals (m_html/m_css/m_js) from Site + LayoutsRepository
- Remove \Log::save_log() calls from OrderAdminService, ShopOrder, Order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:06:06 +01:00

64 lines
1.8 KiB
PHP

<?php
namespace front\controls;
use shop\Product;
class ShopProduct
{
static public function lazy_loading_products()
{
global $lang_id;
$output = '';
$products_ids = \front\factory\ShopCategory::products_id( \Shared\Helpers\Helpers::get( 'category_id' ), \front\factory\ShopCategory::get_category_sort( (int)\Shared\Helpers\Helpers::get( 'category_id' ) ), $lang_id, 8, \Shared\Helpers\Helpers::get( 'offset' ) );
if ( is_array( $products_ids ) ): foreach ( $products_ids as $product_id ):
$output .= \Tpl::view('shop-product/product-mini', [
'product' => Product::getFromCache( $product_id, $lang_id )
] );
endforeach;
endif;
echo json_encode( [ 'html' => $output ] );
exit;
}
public static function warehouse_message()
{
global $lang_id;
$values = json_decode( \Shared\Helpers\Helpers::get( 'values' ), true );
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;
}
// wyświetlenie atrybutów w widoku produktu
static public function draw_product_attributes()
{
global $mdb, $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 = Product::getFromCache( $product_id, $lang_id );
$product_data = $product -> getProductDataBySelectedAttributes( $combination );
echo json_encode( [ 'product_data' => $product_data ] );
exit;
}
}