on 12-16-2015 9:26 AM
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.
Does not work like that, it seems. product(code,$catalogVersion)[unique=true]
I do not want uniqueness on the product, I need to insert as many price plans for the same product as I want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The uniqueness is determined by the whole set of attributes I've provided, if some of these are different then you'll be able to add a new price plan. It doesn't need necessarily be a product, you can leave a product the same, but you have to provide different values for other attributes. By different I mean in terms of the whole set.
Looks like you have price plans with the same code
in two catalog versions but with different products. Since product
is not editable synchronization fails.
When I create price plans I usually use the following set of unique attributes (I have skipped other attributes)
$productCatalog=productCatalog
$version=Staged
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default=$version])[unique=true,default='$productCatalog:$version']
INSERT_UPDATE SubscriptionPricePlan;ug(code)[unique=true];product(code,$catalogVersion)[unique=true];startTime[dateformat=MM/dd/yyyy,allownull=true,unique=true];currency(isocode)[unique=true];minqtd[default=1][unique=true];$catalogVersion
This set can be expanded or reduced according to your requirements.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ovidiu,
If you want to have two price plans for one product then apparently they should differ in some attributes. Use these attributes with unique
modifier in you impex scripts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer. Though trough hmc you can create identical price plans for the same product, indeed with impex files you need to have some unique attribute.
So we added a new attribute to the priceplan, called myId, for example, which is unique, and removed the unique from the product. This seems to work.
Thanks again.
Updated the question, it seems the sync fails
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.