Skip to Content
1
Former Member
Dec 16, 2015 at 09:26 AM

Add 2 or more SubscriptionPricePlan to a SubscriptionProduct

110 Views

Does anyone have any idea/met this situation before ? I am trying to add more than one SubscriptionPricePlan to a SubscriptionProduct via impex files.

By default, a SubscriptionPricePlan is created through impex files as:

 INSERT_UPDATE SubscriptionPricePlan; &pricePlan; product(code, $catalogVersion)[unique = true];
 ; pricePlan_Y_STARTER_100_1Y           ; Y_STARTER_100_1Y      ;
 ; pricePlan_Y_STARTER_100_2Y           ; Y_STARTER_100_2Y      ;

I am trying to add more than 1 SubscriptionPricePlan to a SubscriptionProduct, but, of course, I do something like:

 INSERT_UPDATE SubscriptionPricePlan; &pricePlan; product(code, $catalogVersion)[unique = true];
 ; pricePlan_Y_STARTER_100_1Y           ; Y_STARTER_100_1Y      ;
 ; pricePlan_Y_STARTER_100_2Y           ; Y_STARTER_100_1Y      ;

then the pricePlan for the product Y_STARTER_100_1Y gets overwritten and not added.

We tried adding a unique identifier to the SubscriptionPricePlan (call it “code”), then do something like

1:

  INSERT_UPDATE SubscriptionPricePlan; code[unique = true];
  ; pricePlan_Y_STARTER_100_1Y           ;
  ; pricePlan_Y_STARTER_100_2Y          ;

2:

  INSERT_UPDATE SubscriptionProduct;$catalogVersion;code[unique=true];europe1Prices(code);
   ; ; Y_STARTER_100_1Y ; pricePlan_Y_STARTER_100_1Y, pricePlan_Y_STARTER_100_2Y, pricePlan_Y_STARTER_200_1Y;

This works, but it seems that if you do not define a product for a price plan at creation time (aka 1.), then that price plan is considered as default and applied to all products, and of course we don’t want that.

Any ideas would be appreciated.

UPDATE :

 INSERT_UPDATE SubscriptionPricePlan; code[unique = true];
    ; pricePlan_Y_STARTER_100_1Y           ;
    ; pricePlan_Y_STARTER_100_2Y          ;
 

I've added a unique identifier to SubscriptionPricePlan, called code, all entries will differ for this attribute, but still the synchronization failes.

I can insert as many price plans per product as I want to, but when the sync process starts it gives me this error:

  column product of type SubscriptionPricePlan is not writable, but you want to update it. If you want to write this non writable attribute explicit, you have to use the forceWrite=true modifier. This warning is printed only once for header. Please check subsequent lines for similar problem.