弄清楚了。基本上可以使用形状像的链接
http://example.com/checkout/cart/add?product=1&related_product=2,3,4,5
用 id 1 .. 5 的产品填充购物车,然后在 magento 中进入购物车。
就我而言,我生成了这样的链接
if(!isset($session)) {
$client = new SoapClient('http://example.com/index.php/api/v2_soap?wsdl=1');
$session = $client->login('username', 'Qq314asdgUScrncfD7VMb');
}
if(!isset($cart)) {
$cart = $client->shoppingCartCreate($session);
}
$ids = array();
foreach($items as $id) {
$result = $client->catalogProductInfo($session, $id." ", null, 'sku');
$ids[] = $result->product_id;
}
$this->Session->delete('Cart');
$this->redirect('http://example.com/checkout/cart/add?product='.$ids[0].'&related_product=' . implode(array_slice($ids, 1), ','));