@@ -89,14 +89,6 @@ public function getFormDefinition(FAPI\Form $form, array &$form_state): FAPI\For
8989
9090 switch ($ type ) {
9191 case 'edit ' :
92- $ this ->addActionLink (
93- 'media-btn ' ,
94- 'media-btn ' ,
95- $ this ->getHtmlRenderer ()->getIcon ('image ' ) . ' ' . $ this ->getUtils ()->translate ('Media ' , locale: $ this ->getCurrentLocale ()),
96- $ this ->getUrl ('crud.app.site.controllers.admin.json.downloadablemedia ' , ['id ' => $ this ->getRequest ()->query ->get ('product_id ' )]) . '?product_id= ' . $ this ->getRequest ()->query ->get ('product_id ' ) . '&action=new ' ,
97- 'btn btn-sm btn-light inToolSidePanel '
98- );
99-
10092 case 'new ' :
10193
10294 $ product_title = $ product_content = $ product_media = '' ;
@@ -165,24 +157,6 @@ public function getFormDefinition(FAPI\Form $form, array &$form_state): FAPI\For
165157 case 'delete ' :
166158 $ this ->fillConfirmationForm ('Do you confirm the deletion of the selected element? ' , $ form );
167159 break ;
168-
169- case 'media_deassoc ' :
170- $ media = $ this ->containerCall ([Media::class, 'load ' ], ['id ' => $ this ->getRequest ()->query ->get ('media_id ' )]);
171- $ form ->addField ('product_id ' , [
172- 'type ' => 'hidden ' ,
173- 'default_value ' => $ product ->id ,
174- ])->addField ('media_id ' , [
175- 'type ' => 'hidden ' ,
176- 'default_value ' => $ media ->id ,
177- ])->addField ('confirm ' , [
178- 'type ' => 'markup ' ,
179- 'value ' => 'Do you confirm the disassociation of the " ' . $ product ->title . '" product from the media ID: ' . $ media ->id . '? ' ,
180- 'suffix ' => '<br /><br /> ' ,
181- ])->addMarkup ('<a class="btn btn-danger btn-sm" href=" ' . $ this ->getUrl ('crud.app.site.controllers.admin.json.mediadownloadableproducts ' , ['id ' => $ media ->id ]) . '?media_id= ' . $ media ->id . '&action=downloadable_product_deassoc">Cancel</a> ' );
182-
183- $ this ->addSubmitButton ($ form , true );
184- break ;
185-
186160 }
187161
188162 return $ form ;
@@ -235,27 +209,22 @@ public function formSubmitted(FAPI\Form $form, &$form_state): mixed
235209 $ product ->setWebsiteId ($ values ['frontend ' ]['website_id ' ]);
236210 $ product ->setMediaId ($ values ['media_id ' ]);
237211 $ product ->setPrice ((float )$ values ['price ' ]);
212+ $ product ->setCredit ((float )$ values ['price ' ]);
238213 $ product ->setTaxClassId ($ values ['tax_class_id ' ]);
239214
240215 $ this ->setAdminActionLogData ($ product ->getChangedData ());
241216
242217 $ product ->persist ();
243218
244- $ this ->addSuccessFlashMessage ($ this ->getUtils ()->translate ("Product Saved. " ));
219+ $ this ->addSuccessFlashMessage ($ this ->getUtils ()->translate ("Giftcard Saved. " ));
245220 break ;
246221 case 'delete ' :
247222 $ product ->delete ();
248223
249- $ this ->setAdminActionLogData ('Deleted product ' . $ product ->getId ());
224+ $ this ->setAdminActionLogData ('Deleted giftcard ' . $ product ->getId ());
250225
251- $ this ->addInfoFlashMessage ($ this ->getUtils ()->translate ("Product Deleted. " ));
226+ $ this ->addInfoFlashMessage ($ this ->getUtils ()->translate ("Giftcard Deleted. " ));
252227
253- break ;
254- case 'media_deassoc ' :
255- if ($ values ['media_id ' ]) {
256- $ media = $ this ->containerCall ([Media::class, 'load ' ], ['id ' => $ values ['media_id ' ]]);
257- $ product ->removeMedia ($ media );
258- }
259228 break ;
260229 }
261230
0 commit comments