0

I'm trying to add custom field in my products, "bra_size".

I'm able to add it in magento, make associated_item with it, but impossible to get the value of this product in the associated_products array of the products.

When I make a "http://magento.xxx.com/api/catalog/get_product.php?productId=xx" on the configurable product, I get this :

configitems: {
Bra Size: {
79: "95 D",
80: "95 C",
83: "90 D",
84: "90 C",
88: "85 D",
89: "85 C"
}

But in the associated_products array, "brasize" don't appear :

{
product_id: "1259",
type_id: "simple",
inventory: "0.0000",
sku: "TRD01-92173-85 C",
weight: "0.1500",
news_from_date: null,
news_to_date: null,
status: "1",
visibility: "4",
created_at: "2014-06-17 11:27:39",
updated_at: "2014-06-17 11:28:02",
custom_smartid: null,
custom_color: null,
custom_pantsize: null,
custom_shoesize: null,
custom_shirtsize: null,
custom_uniquesize: null,
price: 17.95
},

I also kmow that magento save the value of braSize in the simple product, but still don't able to catch it from the configurable product. Does anyone know how to fix it ? Thank's a lot ;)

EDIT : Yep, I rebuild all indexes, reboot server, but just use Magento to add attribute (no php or module or other) Here is the get_product.php :

require_once dirname(__FILE__).'/../app/Init.php';

$task = new Init(__FILE__);

try {
    $client = $task->getSOAPClient();
    $session = $task->getSOAPSession($client);

    $productId = $_GET['productId'];

    $result[0] = array('catalog_product.information', $productId);
    $result[1] = array('catalog_product_attribute_media.list', $productId);

    $list = $client->multiCall($session, $result);

    $task->setResponse($list);
} catch(Exception $e) {
    $task->errorResponse($e->getMessage());
}
2
  • Did you rebuild the indexes? also, can you post the code from get_product.php?
    – Marius
    Commented Aug 21, 2014 at 12:35
  • Edit my question, too much character for a comment
    – Malerick
    Commented Aug 21, 2014 at 12:40

1 Answer 1

1

When you call catalog_product.information you can pass in the attributes that you want to return. I think for your code the following will work.

$result[0] = array('catalog_product.information', $productId, null, array(all attributes you want));

If you are using the newer api the code looks as follows:

// product info
$attributes = new stdclass();
$attributes->attributes = array('product_title', 'description', 'short_description', 'price');
$list = $client->catalogProductInfo($session, <sku>, NULL, $attributes);
4
  • So I add null, array(attributes), replacing attributes by the name of my custom attribute "bra_size" ? Or do I have to find a attribute code, or something like it ? Thank's for your time =)
    – Malerick
    Commented Aug 22, 2014 at 13:04
  • sorry you just need to add an array of attribute codes. Commented Aug 22, 2014 at 13:05
  • Thank's, try it when I find the attribute code, and when I got access to the php files. But I will update if this work for me, don't worry
    – Malerick
    Commented Aug 22, 2014 at 13:12
  • Okay so I replace the line by "$result[0] = array('catalog_product.information', $productId, null, array('zdl_brasize'));", where 'zdl_brasize' is the attribute code, but no difference in the function =/. I also try removing 'null', but can't see any difference in the result of the operation
    – Malerick
    Commented Aug 25, 2014 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.