\S::get( 'i' ), 'value' => \S::get( 'value' ), 'languages' => \S::get( 'languages' ), 'attribute' => \S::get( 'attribute' ), ] ); echo $html; exit; } static public function values_save() { $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania wartości atrybutu wystąpił błąd. Proszę spróbować ponownie.' ]; $values = json_decode( \S::get( 'values' ), true ); if ( $id = \admin\factory\ShopAttribute::values_save( (int) \S::get( 'attribute_id' ), $values['name'], $values['value'], $values['ids'], $values['default_value'], $values['impact_on_the_price'] ) ) $response = [ 'status' => 'ok', 'msg' => 'Wartości atrybutu zostały zapisane.', 'id' => $id ]; echo json_encode( $response ); exit; } public static function values_edit() { return \Tpl::view( 'shop-attribute/values-edit', [ 'attribute' => \admin\factory\ShopAttribute::attribute_details( (int) \S::get( 'attribute-id' ) ), 'values' => \admin\factory\ShopAttribute::get_attribute_values( (int) \S::get( 'attribute-id' ) ), 'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList() ] ); } public static function delete_attribute() { if ( \admin\factory\ShopAttribute::delete_attribute( (int) \S::get( 'id' ) ) ) \S::alert( 'Atrybut został usunięty.' ); header( 'Location: /admin/shop_attribute/view_list/' ); exit; } public static function attribute_save() { $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania atrybutu wystąpił błąd. Proszę spróbować ponownie.' ]; $values = json_decode( \S::get( 'values' ), true ); if ( $id = \admin\factory\ShopAttribute::attribute_save( (int) $values['id'], $values['name'], $values['status'] == 'on' ? 1 : 0, (int) $values['type'], (int) $values['o'] ) ) $response = [ 'status' => 'ok', 'msg' => 'Atrybut został zapisany.', 'id' => $id ]; echo json_encode( $response ); exit; } static public function attribute_edit() { return \Tpl::view( 'shop-attribute/attribute-edit', [ 'attribute' => \admin\factory\ShopAttribute::attribute_details( (int) \S::get( 'id' ) ), 'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList() ] ); } public static function view_list() { return \Tpl::view( 'shop-attribute/attributes-list' ); } }