Files
pomysloweprezenty.pl/autoload/admin/controls/class.ShopProducer.php
Jacek Pyziak 33c997ce0d feat: Enhance product saving functionality with security information and language support
- Added `security_information` parameter to `ShopProduct::save` method.
- Refactored language handling in product saving to utilize `Languages::languages_list`.
- Updated SEO link handling to ensure proper redirection and canonical URLs.
- Improved error handling and logging during the update process in `Update` class.
- Enhanced producer and product classes to include additional language data.
- Updated version to 0.233 and added update logs for better tracking.
2026-01-27 23:46:36 +01:00

37 lines
1.2 KiB
PHP

<?
namespace admin\controls;
class ShopProducer
{
static public function delete()
{
if ( \admin\factory\ShopProducer::delete( \S::get( 'id' ) ) )
\S::alert( 'Producent został usunięty' );
header( 'Location: /admin/shop_producer/list/' );
exit;
}
static public function save()
{
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania producenta wystąpił błąd. Proszę spróbować ponownie.' ];
$values = json_decode( \S::get( 'values' ), true );
if ( $producer_id = \admin\factory\ShopProducer::save( $values['id'], $values['name'], $values['status'] == 'on' ? 1 : 0, $values['img'], $values['description'], $values['data'], $values['meta_title'] ) )
$response = [ 'status' => 'ok', 'msg' => 'Producent został zapisany.', 'id' => $producer_id ];
echo json_encode( $response );
exit;
}
static public function edit()
{
return \Tpl::view( 'shop-producer/edit', [
'producer' => \S::get( 'id' ) ? new \shop\Producer( \S::get( 'id' ) ) : null,
'languages' => \admin\factory\Languages::languages_list()
] );
}
static public function list()
{
return \Tpl::view( 'shop-producer/list' );
}
}