Prestashop网络服务:添加后的产品是不可见的,我应该重新保存产品从后台办公室。
我的代码是:
$xml = $webService->get(array('url' => PS_SHOP_PATH.'/api?schema=synopsis'));
$product = $xml->children()->children();
$product->price = str_replace(',','.',$p['price']);
$product->wholesale_price = str_replace(',','.',$p['price']);
$product->active = '1';
$product->advanced_stock_management = '0';
$product->on_sale = 1;
$product->show_price = 1;
$product->available_for_order = 1;
$product->name->language[0][0] = $p['name'];
$product->name->language[0][0]['id'] = 1;
$product->name->language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . 1;
$product->description->language[0][0] = !empty($p['desc']) ? substr($p['desc'], 0, 21844) : ' ';
$product->description->language[0][0]['id'] = 1;
$product->description->language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . 1;
$product->description_short->language[0][0] = !empty($p['short_desc']) ? substr($p['short_desc'], 0 , 100) : ' ';
$product->description_short->language[0][0]['id'] = 1;
$product->description_short->language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . 1;
$product->reference = !empty($p['refcode']) ? $p['refcode'] : ' ';
$product->ean13 = !empty($p['ean']) ? $p['ean'] : ' ';
$product->weight = !empty($p['weight']) ? $p['weight'] : ' ';
$product->depends_on_stock = 0;
$product->state = 1;
$product->redirect_type = '301-category';
$category_id = $c->id;
$product->id_category_default = $category_id;
$opt = array('resource' => 'products');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);
1条答案
按热度按时间1mrurvl11#
这似乎是一个已知问题
参见=〉https://github.com/PrestaShop/PrestaShop/issues/28586
有一些解决方法和建议可能会对您有所帮助。