@@ -24,8 +24,6 @@ class Ebay
2424 public const MARKETPLACE_IN = 16 ;
2525
2626 public const LISTING_DURATION_GTC = 100 ;
27- public const MAX_LENGTH_FOR_OPTION_VALUE = 50 ;
28- public const VARIATION_SKU_MAX_LENGTH = 80 ;
2927 public const ITEM_SKU_MAX_LENGTH = 50 ;
3028
3129 /** @var \Ess\M2ePro\Model\ActiveRecord\Component\Parent\Ebay\Factory */
@@ -40,25 +38,21 @@ class Ebay
4038 private $ config ;
4139 /** @var \Ess\M2ePro\Helper\Data\Cache\Permanent */
4240 private $ cachePermanent ;
43- /** @var \Ess\M2ePro\Helper\Data */
44- private $ dataHelper ;
4541
4642 public function __construct (
4743 \Ess \M2ePro \Helper \Component \Ebay \Configuration $ componentEbayConfiguration ,
4844 \Ess \M2ePro \Model \ActiveRecord \Component \Parent \Ebay \Factory $ ebayFactory ,
4945 \Ess \M2ePro \Helper \Module \Translation $ moduleTranslation ,
5046 \Ess \M2ePro \Model \ActiveRecord \Factory $ activeRecordFactory ,
5147 \Ess \M2ePro \Helper \Data \Cache \Permanent $ cachePermanent ,
52- \Ess \M2ePro \Model \Config \Manager $ config ,
53- \Ess \M2ePro \Helper \Data $ dataHelper
48+ \Ess \M2ePro \Model \Config \Manager $ config
5449 ) {
5550 $ this ->ebayFactory = $ ebayFactory ;
5651 $ this ->activeRecordFactory = $ activeRecordFactory ;
5752 $ this ->componentEbayConfiguration = $ componentEbayConfiguration ;
5853 $ this ->moduleTranslation = $ moduleTranslation ;
5954 $ this ->config = $ config ;
6055 $ this ->cachePermanent = $ cachePermanent ;
61- $ this ->dataHelper = $ dataHelper ;
6256 }
6357
6458 // ----------------------------------------
@@ -297,86 +291,6 @@ public function getCarrierTitle($carrierCode, $title = null): string
297291
298292 // ----------------------------------------
299293
300- /**
301- * @param array $options
302- *
303- * @return array
304- */
305- public function prepareOptionsForVariations (array $ options ): array
306- {
307- $ set = [];
308- foreach ($ options ['set ' ] as $ optionTitle => $ optionsSet ) {
309- foreach ($ optionsSet as $ singleOptionKey => $ singleOption ) {
310- $ set [trim ($ optionTitle )][$ singleOptionKey ] = trim (
311- $ this ->dataHelper ->reduceWordsInString (
312- $ singleOption ,
313- self ::MAX_LENGTH_FOR_OPTION_VALUE
314- )
315- );
316- }
317- }
318- $ options ['set ' ] = $ set ;
319-
320- foreach ($ options ['variations ' ] as &$ variation ) {
321- foreach ($ variation as &$ singleOption ) {
322- $ singleOption ['option ' ] = trim (
323- $ this ->dataHelper ->reduceWordsInString (
324- $ singleOption ['option ' ],
325- self ::MAX_LENGTH_FOR_OPTION_VALUE
326- )
327- );
328- $ singleOption ['attribute ' ] = trim ($ singleOption ['attribute ' ]);
329- }
330- }
331- unset($ singleOption , $ variation );
332-
333- return $ options ;
334- }
335-
336- /**
337- * @param array $options
338- *
339- * @return array
340- */
341- public function prepareOptionsForOrders (array $ options ): array
342- {
343- foreach ($ options as &$ singleOption ) {
344- if ($ singleOption instanceof \Magento \Catalog \Model \Product) {
345- $ reducedName = trim (
346- $ this ->dataHelper ->reduceWordsInString (
347- $ singleOption ->getName (),
348- self ::MAX_LENGTH_FOR_OPTION_VALUE
349- )
350- );
351- $ singleOption ->setData ('name ' , $ reducedName );
352-
353- continue ;
354- }
355-
356- foreach ($ singleOption ['values ' ] as &$ singleOptionValue ) {
357- foreach ($ singleOptionValue ['labels ' ] as &$ singleOptionLabel ) {
358- $ singleOptionLabel = trim (
359- $ this ->dataHelper ->reduceWordsInString (
360- $ singleOptionLabel ,
361- self ::MAX_LENGTH_FOR_OPTION_VALUE
362- )
363- );
364- }
365- }
366- }
367-
368- if (isset ($ options ['additional ' ]['attributes ' ])) {
369- foreach ($ options ['additional ' ]['attributes ' ] as $ code => &$ title ) {
370- $ title = trim ($ title );
371- }
372- unset($ title );
373- }
374-
375- return $ options ;
376- }
377-
378- // ----------------------------------------
379-
380294 /**
381295 * @return void
382296 */
0 commit comments