Creating customizable products in your Shopify store not only increase your customer satisfaction, it also increases your conversion rate. Here is a method to add custom options for your Shopify product and convert it into personalized product - Go to Shopify store page and search for "Advanced Product Customizer" app or you can directly the the Shopify app page by clicking on this link Advanced Product Customizer . Install Advanced Product Customizer app for free in your Shopify store From the application dashboard, enable to app embed block to complete the installation process Click "Product Custom Options" From the Shopify products list, select the product on which you want to add custom options. Advanced Product Customizer offers Image Swatch, Color Swatch, Text box, File Upload, Radio, Checkbox, Date Picker and more. Here is the a demo video for adding custom option for a Shopify product -
In JSON we must explicitly need to put an attribute before each field that needs to be serialized. Also we need to put [DataContract] attribute before the declaration of the class. Here is the sample code JSON serialization -
[DataContract]
public class Employee
{
[DataMember]
private int empId;
[DataMember]
public string empName;
public void SetEmployeeId(int id)
{
empId = id;
}
}
If you want to ignore any field then simply do not put [DataMember] attribute in front of that property.
To serialize an object to JSON we can use DataContractJsonSerializer class from the namespace System.Runtime.Serialization.Json. Here is the sample code for JSON serialization -
Employee emp = new Employee();
emp.SetEmployeeId(1);
emp.empName = "John";Stream stream = new FileStream("Emp.json", FileMode.Create);DataContractJsonSerializer JsonSer = new DataContractJsonSerializer(typeof(Employee));JsonSer.WriteObject(stream, Employee);stream.Close();
The JSON for the employe object is :
{
"empId": 1,
"empName": "John"
}
Following code can be used to read JSON back in the form of object:
Employee emp = new Employee();
Stream stream = new FileStream("Emp.json", FileMode.Create);DataContractJsonSerializer JsonSer = new DataContractJsonSerializer(typeof(Employee));emp = (JsonSer)JsonSer.ReadObject(stream);stream.Close();
Comments
Post a Comment