Cara mendapatkan semua gambar dari produk tertentu dengan menggunakan kode ini saya hanya dapat mengambil satu gambar dari produk tertentu. .
Tolong bantu saya baru dalam hal ini.
<?php
// Get products in category
require_once('../app/Mage.php');//Path to Magento umask(0);
if(isset($_GET["categoryId"])){
$categoryId=$_GET["categoryId"];
$proxy = new SoapClient('http://www.prashant.com/index.php/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('prash', 'prashant123@'); // TODO : change login and pwd if necessary
$products= $proxy->catalogCategoryAssignedProducts($sessionId,$categoryId);
$itemDetails=array();
Mage::app();
foreach ($products as $item) {
$product2 = Mage::getModel('catalog/product')->load($item->product_id);
$productMediaConfig = Mage::getModel('catalog/product_media_config');
$baseImageUrl = $productMediaConfig->getMediaUrl($product2->getImage());
$price2=0;
$price2=$product2->getFinalPrice();
if($price2==0){
$price2=$product2->getPrice();
}
$desc=$product2->getDescription();
if($desc==""){
$desc="blank";
}
$baseImageUrl = $productMediaConfig->getMediaUrl($product2->getImage());
if($baseImageUrl=="http://www.prashant.com/media/catalog/product/"){
$baseImageUrl="http://www.prashant.com/customApi/icon.png";
}
//"desc"=>$desc,
$statusp=$product2->getStatus();
$statusen= Mage_Catalog_Model_Product_Status::STATUS_ENABLED;
if($statusp==$statusen){
$itemDetails[]=array(
"productId"=>$item->product_id,
"name"=>$product2->getName(),
"price"=>$product2->getPrice(),
"spprice"=>$price2,
"desc"=>$desc,
"imageurl"=>$baseImageUrl,
);
}
}
//return array of products
//echo "<pre>";
//print_r($itemDetails);
//echo "</pre>";
echo json_encode($itemDetails);
exit();
}else{
echo "error";
exit();
}
?>