我正在尝试与Magento API集成,以从履行中心的csv文件创建发货。我继续得到这个错误:
Caught create exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '100000381' for key 2
似乎没有办法绕过它。以下是PHP代码:
<?php
$order = '100000636';
$carrier = 'fedex';
$proxy = new SoapClient($host.'api/v2_soap/?wsdl');
$sessionId = $proxy->login($user, $pass);
// Create new shipment
try {
$newShipmentId = $proxy->salesOrderShipmentCreate($sessionId, $order, array('13', '1'), 'shipment comment',false,false);
} catch (Exception $e) {
echo 'Caught create exception: ' .$e->getMessage();
}
var_dump($newShipmentId);
如果increment_last_id
的值小于用于最近成功创建的装运的实际增量ID,请检查eav_entity_store
表。如果是,请尝试将其替换为实际的最后一个值。知道:
- 发货的
entity_type_id
默认应为8,否则使用eav_entity_type
表中与shipment
对应的值 - 如果不在单店模式下运行,请检查相关
store_id
的值