Skip to content

Commit

Permalink
Merge pull request #5 from time-frame/master
Browse files Browse the repository at this point in the history
Fixed ItemSpecific bug on product model
  • Loading branch information
SeanoNET authored May 26, 2020
2 parents 86faf1f + 30d69d3 commit e02bd8c
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
42 changes: 37 additions & 5 deletions NetoDotNET.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ static void Main(string[] args)
var neto = new StoreManager(config.GetSection("NETO_STORE_URL").Value, config.GetSection("NETO_API_KEY").Value, config.GetSection("NETO_USERNAME").Value);

#region Products
GetItems(neto);
//GetItems(neto);
//GetItemsFromDate(neto);

// AddItems(neto);
//AddVariableItems(neto);
AddVariableItems(neto);

//UpdateItems(neto);
#endregion
Expand Down Expand Up @@ -800,19 +800,51 @@ static void AddVariableItems(StoreManager neto)
new NewItem {
Name = "Variable Item",
SKU = "VAR",
DefaultPrice = 1.00m,
DefaultPrice = 1.00m
},
new NewItem {
Name = "Variable Item",
SKU = "VAR1",
DefaultPrice = 1.00m,
ParentSKU = "VAR"
ParentSKU = "VAR",
ItemSpecifics = new ItemSpecifics
{
ItemSpecific = new List<ItemSpecific>
{
new ItemSpecific()
{
Name = "Size",
Value = "1"
},
new ItemSpecific()
{
Name = "Colour",
Value = "RED"
}
}
}
},
new NewItem {
Name = "Variable Item",
SKU = "VAR2",
DefaultPrice = 1.00m,
ParentSKU = "VAR"
ParentSKU = "VAR",
ItemSpecifics = new ItemSpecifics
{
ItemSpecific = new List<ItemSpecific>
{
new ItemSpecific()
{
Name = "Size",
Value = "2"
},
new ItemSpecific()
{
Name = "Colour",
Value = "RED"
}
}
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion NetoDotNET.Examples/appsettings.example.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"NETO_STORENAME": "<YOUR_NETO_STORE_URL>",
"NETO_STORE_URL": "<YOUR_NETO_STORE_URL>",
"NETO_API_KEY": "<YOUR_NETO_API_KEY>",
"NETO_USERNAME": "<YOUR_NETO_USERNAME>"
}
10 changes: 7 additions & 3 deletions NetoDotNET/Entities/Product/ItemBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ public class ItemBase
[JsonConverter(typeof(SingleOrArrayConverter<CategoryProduct>))]
public List<CategoryProduct> Categories { get; set; }

[JsonConverter(typeof(SingleOrArrayConverter<ItemSpecific>))]
public List<ItemSpecific> ItemSpecifics { get; set; }
public ItemSpecifics ItemSpecifics { get; set; }

[JsonConverter(typeof(SingleOrArrayConverter<WarehouseQuantity>))]
public List<WarehouseQuantity> WarehouseQuantity { get; set; }

Expand All @@ -382,6 +382,8 @@ public class ItemBase
public List<RelatedContents> RelatedContents { get; set; }
}



public class WarehouseQuantity
{
public string WarehouseID { get; set; }
Expand Down Expand Up @@ -430,13 +432,15 @@ public class PriceGroup

public class ItemSpecifics
{
public ItemSpecific ItemSpecific { get; set; }
[JsonConverter(typeof(SingleOrArrayConverter<ItemSpecific>))]
public List<ItemSpecific> ItemSpecific { get; set; }
}

public class ItemSpecific
{
public string Name { get; set; }
public string Value { get; set; }
public int SortOrder { get; set; }

}

Expand Down
6 changes: 6 additions & 0 deletions NetoDotNET/NetoDotNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
<Version>0.2.2</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<Reference Include="Newtonsoft.Json">
Expand Down

0 comments on commit e02bd8c

Please sign in to comment.