Unknown column 'product_code' in 'field list on my prestashop - prestashop-1.6

Sir when i go to save any product then i see this error. so can any help how can i fix it
Unknown column 'product_code' in 'field list
UPDATE ps_product SET id_product = '430',id_shop_default = '1',id_manufacturer = '0',id_supplier = '0',reference = '',supplier_reference = '',location = '',width = '0',height = '0',depth = '0',weight = '0',quantity_discount = '0',ean13 = '',upc = '',cache_is_pack = '0',cache_has_attachments = '0',is_virtual = '0',id_category_default = '12',id_tax_rules_group = '0',on_sale = '0',online_only = '0',ecotax = '0',minimal_quantity = '1',price = '49.99',wholesale_price = '29.99',unity = '',unit_price_ratio = '0',additional_shipping_cost = '0',customizable = '0',text_fields = '0',uploadable_files = '0',active = '1',redirect_type = '404',id_product_redirected = '0',available_for_order = '1',available_date = '0000-00-00',condition = 'new',show_price = '1',indexed = '0',visibility = 'both',cache_default_attribute = '0',advanced_stock_management = '0',date_add = '2017-06-29 23:34:25',date_upd = '2017-07-04 00:41:34',pack_stock_type = '3',product_code = '' WHERE id_product = 430

Related

Update Nested object Value on Realm iOS

Below is the data that I have fetched from server and save to realm DB, When I try to updating scheduler_data values and stop values, but they doesn't update
(
{
"form_id" = 3703;
id = 180;
"parent_id" = 0;
"scheduler_data" = {
repeat = 7;
"schedule_for" = task;
"start_date" = "2018-08-17T11:55:41.867Z";
"start_time" = "2018-08-17T11:59:44.289Z";
stop = {
field = COL1;
operation = "equal_to";
value = "time";
};
state = 58;
territory = GHTY67;
}
)
Here the code for to update Value
SaveTaskDatabase is the table name
for saveData in realm.objects(SaveTaskDatabase.self).filter("unq_id == %#",taskUni_ID){
try! realm.write {
saveData.scheduler_data?.stop?.operation = "add"
saveData.scheduler_data?.stop?.field = "muliple"
saveData.scheduler_data?.stop?.value = "baseOnValue"
}
}

JSON: Extracting Data Using Alamofire and Swift 3

Can anyone tell me how to get the data out of this JSON?
Here is my code followed by the JSON
let URL = "URL"
Alamofire.request(URL).responseJSON
{ response in
print("HereBegins: = \(response)")
let result = response.result.value as? [String:Any]
}
the json being returned is...
HereBegins: = SUCCESS:
{
items =
(
{
addToCartUrl = "blah blah URL";
affiliateAddToCartUrl = "blah blah another URL";
availableOnline = 0;
brandName = Generic;
bundle = 0;
categoryNode = "976759_1071964_976788";
categoryPath = "Food/Fresh Food/Dairy, Eggs & Cheese/Milk & Cream";
clearance = 0;
customerRating = "5.0";
customerRatingImage = "http://i2.walmartimages.com/i/CustRating/5.gif";
freeShipToStore = 0;
freeShippingOver50Dollars = 1;
giftOptions = {
allowGiftMessage = 0;
allowGiftReceipt = 0;
allowGiftWrap = 0;
};
imageEntities =
(
{
entityType = SECONDARY;
largeImage = "https://i5.walmartimages.com/asr/c2bc3886-fb4f-4c46-b7e9-0cc4ebabc7c1_1.d42acf75b29b132532d5953b139b115f.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF";
mediumImage = "https://i5.walmartimages.com/asr/c2bc3886-fb4f-4c46-b7e9-0cc4ebabc7c1_1.d42acf75b29b132532d5953b139b115f.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF";
thumbnailImage = "https://i5.walmartimages.com/asr/c2bc3886-fb4f-4c46-b7e9-0cc4ebabc7c1_1.d42acf75b29b132532d5953b139b115f.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF";
},
{
entityType = PRIMARY;
largeImage = "https://i5.walmartimages.com/asr/1d575fe6-b8c9-4dc6-821b-42cbde621373_1.4764431b7ebfb4707c0a2f7fe47e85cc.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF";
mediumImage = "https://i5.walmartimages.com/asr/1d575fe6-b8c9-4dc6-821b-42cbde621373_1.4764431b7ebfb4707c0a2f7fe47e85cc.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF";
thumbnailImage = "https://i5.walmartimages.com/asr/1d575fe6-b8c9-4dc6-821b-42cbde621373_1.4764431b7ebfb4707c0a2f7fe47e85cc.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF";
}
);
isTwoDayShippingEligible = 0;
itemId = 46491746;
largeImage = "https://i5.walmartimages.com/asr/1d575fe6-b8c9-4dc6-821b-42cbde621373_1.4764431b7ebfb4707c0a2f7fe47e85cc.jpeg?odnHeight=450&odnWidth=450&odnBg=FFFFFF";
longDescription = "<br><b>Great Value Vanilla Almond Milk, 64 fl oz:</b><br><ul><li>Delicious flavor</li><li>Great Value almond milk comes in a 64 fl oz carton</li><li>Vitamins A, D and E added</li><li>Added calcium</li><li>Only 80 calories per serving</li></ul>";
marketplace = 0;
mediumImage = "https://i5.walmartimages.com/asr/1d575fe6-b8c9-4dc6-821b-42cbde621373_1.4764431b7ebfb4707c0a2f7fe47e85cc.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF";
modelNumber = 11951;
name = "Great Value Vanilla Almond Milk, 64 fl oz";
ninetySevenCentShipping = 0;
numReviews = 3;
offerType = "STORE_ONLY";
parentItemId = 46491746;
preOrder = 0;
productTrackingUrl = "http://linksynergy.walmart.com/fs-bin/click?id=|LSNID|&offerid=223073.7200&type=14&catid=8&subid=0&hid=7200&tmpid=1082&RD_PARM1=https%253A%252F%252Fwww.walmart.com%252Fip%252FGreat-Value-Vanilla-Almond-Milk-64-fl-oz%252F46491746%253Faffp1%253DHzNQqMKL6fuAwFZnu_RUqysY3U3RzuxH0bQKAHNYr0Q%2526affilsrc%253Dapi";
productUrl = "http://c.affil.walmart.com/t/api03?l=https%3A%2F%2Fwww.walmart.com%2Fip%2FGreat-Value-Vanilla-Almond-Milk-64-fl-oz%2F46491746%3Faffp1%3DHzNQqMKL6fuAwFZnu_RUqysY3U3RzuxH0bQKAHNYr0Q%26affilsrc%3Dapi%26veh%3Daff%26wmlspartner%3Dreadonlyapi";
salePrice = "2.58";
shipToStore = 0;
standardShipRate = 0;
stock = "Not available";
thumbnailImage = "https://i5.walmartimages.com/asr/1d575fe6-b8c9-4dc6-821b-42cbde621373_1.4764431b7ebfb4707c0a2f7fe47e85cc.jpeg?odnHeight=100&odnWidth=100&odnBg=FFFFFF";
upc = 078742052366;
}
);
}
Figured it out.
if let resData = result["items"].arrayObject {
arrRes = resData as! [[String:AnyObject]]
for element in arrRes[0]
{
print(element)
}
print(arrRes[0]["name"])

How Parse JSON from API [duplicate]

This question already has answers here:
type 'Any' has no subscript members
(2 answers)
Closed 5 years ago.
i know to much ask like this. i already searching but not match with my problems.
oke i will try explain with my code
i have data API Like this
["profile": {
accountId = 58e470a0c50472851060d083;
androidDeviceId = "[\"3453247ddcf3f809\"]";
androidVersion = 21;
appId = (
"c46b4c10-62ce-11e6-bdd4-59e4df4b8410",
"fac915f0-fe2b-11e6-9dfb-55339bd7be35"
);
appVersion = "v5.1.0";
avatar = "https://account.8villages.com/uploads/images/5/1491366164_bnx1t0rudi.jpg";
birthDate = "12/03/1994";
"channel-group" = android;
communityId = 553e09b251906884443eff85;
coordinates = {
coordinates = (
"106.9602383333333",
"-6.249333333333334"
);
type = Point;
};
crop = "";
crops = "<null>";
customerId = 5369bd85cae84d0e03246a7c;
dateSubmitted = {
iso = "2017-04-05T04:20:48.483Z";
timestamp = 1491366048;
};
fullName = "Megi Fernanda";
gender = "Laki-laki";
homeAddress = Payakumbuah;
location = "Kota Payakumbuh";
moderation = {
at = {
iso = "2017-04-05T04:20:48.483Z";
timestamp = 1491366048;
};
by = auto;
status = moderated;
};
skill = "Budidaya pertanian";
state = "Sumatera Barat";
storeType = "";
subdistrict = "Payakumbuh Barat";
totalConversations = {
articles = 0;
forums = 0;
questions = 2;
responses = 0;
storeItems = 1;
};
type = users;
university = "Politeknik Negeri Pertanian Payakumbuh";
}, "accessToken": {
key = "lH5aYvnp2JAZ6zoKQK4mpfsxCI0.";
secret = "yfZfTZbsaVIhKCbksGHQnPcPg9mKtoRAKyvjg_cgMeo.";
}]
i already can got fullName, Addres, Skill State etc
if let profile = json["profile"] as? NSDictionary {
let name = profile["fullName"]
let alamat = profile["Skill"]
}
but i don't know how to get atribut in totalConversation like question, storeItems, points
skill = "Budidaya pertanian";
state = "Sumatera Barat";
storeType = "";
subdistrict = "Payakumbuh Barat";
totalConversations = {
articles = 0;
forums = 0;
questions = 2;
responses = 0;
storeItems = 1;
};
i tried like
let profile = json["profile"]["totalConversation"] as? NSDictionary
error sign : Type 'any?' has no subscript members
You got that error because json["profile"] is Any type and it doesn't have any subscript. So you need to cast json["profile"] to a dictionary, [String: Any] is dictionary type in Swift.
if let profile = json["profile"] as? [String: Any] {
if let totalConversations = profile["totalConversations"] as? [String: Any] {
let questions = totalConversations["questions"] as? Int
}
}

Finding cause of newRenderPipelineStateWithDescriptor failure

I'm trying to create a pipeline state in swift and the app crashes with SIGABRT. I've put the call to newRenderPipelineStateWithDescriptor within a try catch block. Why is it not caching it?
Here's the code,
let defaultLibrary = device.newDefaultLibrary()!
let fragmentProgram = defaultLibrary.newFunctionWithName("passThroughFragment")!
let vertexProgram = defaultLibrary.newFunctionWithName("passGeometry")!
// check TexturedVertex
let vertexDesc = MTLVertexDescriptor()
vertexDesc.attributes[0].format = .Float3
vertexDesc.attributes[0].offset = 0
vertexDesc.attributes[0].bufferIndex = 0
vertexDesc.attributes[1].format = .Float3
vertexDesc.attributes[0].offset = sizeof(Vec3)
vertexDesc.attributes[0].bufferIndex = 0
vertexDesc.attributes[2].format = .Float2
vertexDesc.attributes[0].offset = sizeof(Vec3) * 2
vertexDesc.attributes[0].bufferIndex = 0
vertexDesc.layouts[0].stepFunction = .PerVertex
vertexDesc.layouts[0].stride = sizeof(TexturedVertex)
let pipelineStateDescriptor = MTLRenderPipelineDescriptor()
pipelineStateDescriptor.vertexFunction = vertexProgram
pipelineStateDescriptor.fragmentFunction = fragmentProgram
//pipelineStateDescriptor.vertexDescriptor = vertexDesc
pipelineStateDescriptor.colorAttachments[0].pixelFormat = view.colorPixelFormat
pipelineStateDescriptor.colorAttachments[0].blendingEnabled = false
pipelineStateDescriptor.sampleCount = view.sampleCount
do {
// SIGABRT will happen here when enabling .vertexDescriptor = vertexDesc
try pipelineState = device.newRenderPipelineStateWithDescriptor(pipelineStateDescriptor)
} catch let error {
print("Failed to create pipeline state, error \(error)")
}
The code above doesn't crash, until I enable this line,
pipelineStateDescriptor.vertexDescriptor = vertexDesc
To give a bit of background, my vertex shader used to receive a packed_float4 buffer as input but I'm trying to update it to a struct, as defined in the MTLVertexDescriptor above.
The frustrating thing is that the app just crashes without giving any hints of what's wrong.
Is there any way of get error messages when calling device.newRenderPipelineStateWithDescriptor?
Edit:
This fixes the crash,
vertexDesc.attributes[0].format = .Float3
vertexDesc.attributes[0].offset = 0
vertexDesc.attributes[0].bufferIndex = 0
vertexDesc.attributes[1].format = .Float3
vertexDesc.attributes[1].offset = sizeof(Vec3)
vertexDesc.attributes[1].bufferIndex = 0
vertexDesc.attributes[2].format = .Float2
vertexDesc.attributes[2].offset = sizeof(Vec3) * 2
vertexDesc.attributes[2].bufferIndex = 0
But apparently there's no way to make newRenderPipelineStateWithDescriptor to throw an exception because of that at the moment.

An object that has a key that matches the key of the supplied object could not be found in the ObjectStateManager

I Use following code
Tel_CallHistory CallHistory = new Tel_CallHistory();
CallHistory.MobileNo = MobileNo;
CallHistory.CRId = CallResponse;
CallHistory.CallRemark = CallRemark;
CallHistory.UserId = UserId;
CallHistory.CallDate = DateTime.Now;
CallHistory.CallTime = DateTime.Now.TimeOfDay;
CallHistory.MeetingPoint = meetingpoint;
if (CallResponse == 1)
{
CallHistory.NCallDateOn = null;
CallHistory.NCallTimeAt = null;
CallHistory.MeetingDate = Convert.ToDateTime( meetingdate);
CallHistory.MeetingTime = DateTime.Parse(meetingtime).TimeOfDay;
}
else
{
CallHistory.NCallDateOn = Convert.ToDateTime(NCallDateOn);
CallHistory.NCallTimeAt = DateTime.Parse(NCallTimeAt).TimeOfDay;
CallHistory.MeetingDate = null;
CallHistory.MeetingTime = null;
}
db.Tel_CallHistory.AddObject(CallHistory);
Tel_Mobile TelMobile = _teacher.getDB().Tel_Mobile.Single(a => a.MobileNo == MobileNo);
TelMobile.CallDate = CallHistory.NCallDateOn;
TelMobile.CallTime = CallHistory.NCallTimeAt;
TelMobile.LCallDateOn = CallHistory.CallDate;
TelMobile.LCallTimeAt = CallHistory.CallTime;
TelMobile.LCRId = CallHistory.CRId;
TelMobile.LCallRemark = CallHistory.CallRemark;
TelMobile.LMeetingPoint = CallHistory.MeetingPoint;
TelMobile.LMeetingDate = CallHistory.MeetingDate;
TelMobile.LMeetingTime = CallHistory.MeetingTime;
db.Tel_Mobile.ApplyOriginalValues(TelMobile);
db.SaveChanges();
db.AcceptAllChanges();
but when db.Tel_Mobile.ApplyOriginalValues(TelMobile) executes, show error
An object that has a key that matches the key of the supplied object
could not be found in the ObjectStateManager. Verify that the object
to which changes must be applied is not in the Added state and that
its key values match the key values of the supplied object.
You probably want to attach it.
db.Tel_Mobile.Attach(TelMobile);

Resources