lifeform Posted December 27, 2013 Share Posted December 27, 2013 (edited) hello, i use webservice to update product. i use 1.5.4.1 before. and there is a problem like this before. and this is solved by update product class at setWsProductFeatures proccedure. 2 weaks ago i update with 1-clickUpgrade to 1.5.6.1 the other looks fine. untuk i found my product feature value are lost. i look once again in the product classes. and the procedure was fixes by presta. so i do not know where is the problem once again here is my code of update product if ($row = mysqli_fetch_row($result)) { $idProduct = $row[0]; $qty = $row[1]; $active = $row[2]; $meta_keyword_en = $row[3]; $meta_keyword_id = $row[4]; $meta_desc_en = $row[7]; $meta_desc_id = $row[8]; $meta_title_en = $row[5]; $meta_title_id = $row[6]; //get products from webservice try { $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt = array('resource' => 'products'); if (isset($idProduct)) $opt['id'] = $idProduct; $xml = $webService->get($opt); // Here we get the elements from children of customer markup which is children of prestashop root markup $resources = $xml->children()->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error'; } if (isset($active)) { $resources->active = $active; } if (isset($meta_keyword_en) || isset($meta_keyword_id)) { $resources->meta_keywords->language[0] = $meta_keyword_en; $resources->meta_keywords->language[1] = $meta_keyword_en; $resources->meta_description->language[0] = $meta_desc_en; $resources->meta_description->language[1] = $meta_desc_id; $resources->meta_title->language[0] = $meta_title_en; $resources->meta_title->language[1] = $meta_title_id; } //post data to webservice try { unset($resources->position_in_category); unset($resources->manufacturer_name); unset($resources->quantity); unset($resources->type); $opt = array('resource' => 'products'); $opt['putXml'] = $xml->asXML(); $opt['id'] = $idProduct; $xml = $webService->edit($opt); // if WebService don't throw an exception the action worked well and we don't show the following message } catch (PrestaShopWebserviceException $ex) { // Here we are dealing with errors $trace = $ex->getTrace(); if ($trace[0]['args'][0] == 404) echo 'Bad ID'; else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; else echo 'Other error<br />'.$ex->getMessage(); } and here is my feature value xml <product_features node_type="product_feature"> <product_feature xlink:href="http://www.xxx.com/api/product_features/1"> <id> <![CDATA[ 1 ]]> </id> <custom> <![CDATA[ 0 ]]> </custom> <id_feature_value xlink:href="http://www.xxx.com/api/product_feature_values/16"> <![CDATA[ 16 ]]> </id_feature_value> </product_feature> <product_feature xlink:href="http://www.xxx.com/api/product_features/2"> <id> <![CDATA[ 2 ]]> </id> <custom> <![CDATA[ 1 ]]> </custom> <id_feature_value xlink:href="http://www.xxx.com/api/product_feature_values/10633"> <![CDATA[ 10633 ]]> </id_feature_value> </product_feature> </product_features> if i check once again after update, the product value is there. but value lang is reset to blank. could you please help. i really confused here. anybody? thx budi Edited December 27, 2013 by lifeform (see edit history) Link to comment Share on other sites More sharing options...
lifeform Posted December 27, 2013 Author Share Posted December 27, 2013 after check several times, every update product with webservice wiill delete the feature_value_lang. but the feature_value is still there. but i did not know where i must fix this problem Link to comment Share on other sites More sharing options...
lifeform Posted December 28, 2013 Author Share Posted December 28, 2013 (edited) i found that everytime update the product, the feature_value_id is increase. however the feature value lost only custom feature value. setWsProductFeatures always delete and insert again. i think addFeaturesToDB always create new id in table feature everytime feature custom is pass to the procedure i do not know how to fix this. could somebody help. thx Edited December 28, 2013 by lifeform (see edit history) Link to comment Share on other sites More sharing options...
lifeform Posted February 6, 2014 Author Share Posted February 6, 2014 is there any body use webservice?? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now