cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Hotfolder-Impex -CSV -1 row multiple items -promotions and price row

Former Member
1,356

Hi , I am facing issue while processing a csv file via hot folder (Promotion automation via hot folders) : Requirement is i want to create a fixedpromotion from excel and insert its prices . Models are :ProductFixedPricePromotion and ProductFixedPricePromotion and what i have done is in hot folder xml file i configured like this :

     <property name="header">
         <value># ImpEx for Importing Prices into $CATALOG$
             $defaultPromoGrp=default
             $productCatalog=indiskastoreProductCatalog
             $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
             #% impex.setLocale(Locale.ENGLISH);
             INSERT PromotionPriceRow;Currency(isocode);
         </value>
     </property>
     <property name="impexRow">
         <value>


             ;{7};{8};

         </value>
     </property>
 </bean>

 <bean id="indiskaBatchFixedPromotionConverter" class="com.indiska.core.batch.converter.impl.DefaultImpexConverter">
     <property name="header">
         <value># ImpEx for Importing Prices into $CATALOG$
             $defaultPromoGrp=default
             $productCatalog=indiskastoreProductCatalog
             $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
             #% impex.setLocale(Locale.ENGLISH);
             INSERT_UPDATE ProductFixedPricePromotion;PromotionGroup(Identifier[default=$defaultPromoGrp]);enabled[default=true][unique=true];code[unique=true];title;description;priority;products(code,$catalogVersion)[mode=append][unique=true];startdate;enddate;productFixedUnitPrice(price,currency(isocode))[cacheUnique=true]


         </value>
     </property>
     <property name="impexRow">
         <value>

             ;;;{+0};{+1};{+2};{3};{4};{5};{6};{8}:{7};

         </value>
     </property>
 </bean>

so for a single row in csv i can insert two items here .And if the price is unique then its working fine other wise it is throwing exception :

like : if insert first time 50-EUR --it works. Second time if i execute the same it is throwing the following exception : [CronJobErrorHandler] line 12 at main script: Exception ocurred, will ignore: de.hybris.platform.impex.jalo.ImpExException: more than one item found for '12.51:EUR' using query ' FROM {PromotionPriceRow AS t0} WHERE {t0.price}=?v0 AND {t0.currency} IN ({{ SELECT {t1.pk} FROM {Currency AS t1} WHERE {t1.isocode}=?v1 }})' with values {v0=12.51, v1=EUR} - got at least 8825322115988 and 8825322148756[HY--1] INFO | jvm 1 | main | 2018/03/01 12:44:55.830 | de.hybris.platform.impex.jalo.ImpExException: more than one item found for '12.51:EUR' using query ' FROM {PromotionPriceRow AS t0} WHERE {t0.price}=?v0 AND {t0.currency} IN ({{ SELECT {t1.pk} FROM {Currency AS t1} WHERE {t1.isocode}=?v1 }})' with values {v0=12.51, v1=EUR} - got at least 8825322115988 and 8825322148756[HY--1]

Error is saying "after insertion in promotionpricerow and impex has to add its reference to fixedpromotion model but it is finding more than one pk for the same price and currency .

Unfotunalty in promotionpricerow there is no unique otherwise i would have fetched pricerow(code) . but no unique key is there ..

Please help me out .

Accepted Solutions (0)

Answers (0)