如何从Magento 1.9 Soap Api v1中的产品ID获取产品的属性及其值

时间:2019-07-09 10:41:31

标签: php api magento soap magento-1.9

我只需要属性的总数和它们的值的总和...通过传递产品ID,我已经尝试过此代码,但是它给了我很少的属性,我需要分配给该产品的所有属性(下面给出了代码)。

<?php
require_once('../app/Mage.php');
Mage::app();    

$client     = new SoapClient('http://localhost/project/api/soap/?wsdl');


$user_name  = $_POST["user_name"];
$password   = $_POST["password"];
$prod_id    = $_POST["prod_id"];

$response   = array();

$session    = $client->login($user_name, $password);
//$product    = $client->call($session,"catalog_product.info" ,$prod_id);
$listAttributes =     $client->call($session,'product.listOfAdditionalAttributes',array('simple',$prod_id));

$response = array(
    "status" => "1",
    "message" => "suceess",
    "products" => $listAttributes
);

ob_start();
header('Content-type: application/json');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');

echo json_encode($response);
exit;
 ?>

0 个答案:

没有答案