function Product() {
  var fields = {
    'model': '', //The unique identifier
    'name': '',
    'description': '',
    'base_price': 0.0,
    'estimated_shipping': 0.0,
    'image': '',
    'stock': 0,
    'weight': 0.0,
    'category': new ProductCategory()
  };
  var attributes = {};

  var fromString = function(str) {
    try {
      var json_parsed = JSON.parse(str);
      for (var i in json_parsed) {
        this.setField(i, json_parsed[i]);
      }
    } catch (e) {}
  }
  var toString = function(templ) {
    var ret = '';
    return ret;
  }
  var setField = function(field, val) {
    if (fields[field] && typeof fields[field] == typeof val) {
      fields[field] = val;
    }
  }
  var setAttribute = function(attribute, val) {
    attributes[attribute] = new ProductAttribute(attribute);
  }
  var toObject = function() {
    var ret = fields;
    ret.attributes = attributes;
    return ret;
  }
  return {
    'toString': toString,
    'fromString': fromString,
    'setField': setField,
    'setAttribute': setAttribute,
    'toObject': toObject
  }
}
