我需要在magento中执行以下查询
protected Void doInBackground(String... params) {
//load image
SyncHttpClient client = new SyncHttpClient();
RequestParams paramsImage = new RequestParams();
try {
paramsImage.put("photo", new File(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
client.post("http://crm.pavlun.info/api/upload_photo", paramsImage, new TextHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
}
@Override
public void onSuccess(int statusCode, Header[] headers, String responseString) {
Log.e("responseString", ""+responseString);
imageUrl = responseString;
Log.e("imageURL", ""+imageUrl);
}
});
//////////
//maybe is this the error?
JsonObject jobj = new Gson().fromJson(imageUrl, JsonObject.class);
myRes = jobj.get("url").getAsString();
Log.e("link gson", myRes);
/////////////////////////////////////////
ArrayList<NameValuePair> nameValuePairs1 = new ArrayList<NameValuePair>();
JSONObject joB = new JSONObject();
JSONArray list1 = new JSONArray();
list1.add(params[0]);
Map obj=new LinkedHashMap();
obj.put("company_id","1");
obj.put("phones", list1);
obj.put("photo", myRes);
obj.put("name",params[1]);
obj.put("birthdate",params[2]);
obj.put("email",params[3]);
org.json.JSONObject jsonqwe;
try {
JSONParser operationLink = new JSONParser();
ArrayList<NameValuePair> postP = new ArrayList<NameValuePair>();
postP.add(new BasicNameValuePair("json", JSONValue.toJSONString(obj)));
jsonqwe = operationLink.makeHttpRequest(registrationURL, "POST", postP);
Log.e("sad", jsonqwe.toString());
}catch(Exception e) {
e.printStackTrace();
}
return null;
}
如何在magento基础上构建此框架,例如
DELETE FROM `table_name` WHERE `column1` = '" . $value1. "' and `column2`='" . $value2. "'"
提前致谢....
答案 0 :(得分:1)
我不是测试它,但希望它能为你效用
$collection = Mage::getModel('model/model')->getCollection()
->addFieldToFilter('column1',array('eq'=> $value1))
->addFieldToFilter('column2',array('eq' => $value2))
;
foreach($collection as $coll)
{
Mage::getModel('module/model')->load($coll->getId())->delete();
}