Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[API] product_attribute.options Usage/Problem
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

I’m not sure I’m using this method correctly since there is no example of it in the wiki, but I think its something like this:

$options_set $client->call($session'product_attribute.options', array($attribute_id));

I’m trying to get the options set for “manufacturer” attribute of the the “Default” attribute set.

So what I did is, find the ID for the “Default” attribute set and then use product_attribute.list to find the actual attributes for “Default” attribute set.
I then found the attribute ID for the “manufacturer” attribute, and then used this and plugged it in to the above code.
Here’s the code I used:

// Find and Set attribute set id for $name
// Returns -1 if not found
function findAttributeSetID($attributeSets$name{
    $id 
= -1;
    foreach (
$attributeSets as $set{
        
if($set['name'== $name{
            $id 
$set['set_id'];
            break;
        
}
    }
    
return $id;
}

function findAttributeID($attributes$code{
    $id 
= -1;
    foreach(
$attributes as $a{
        
if($a['code'== $code{
            $id 
$a['attribute_id'];
            break;
        
}
    }
    
return $id;
}

$attributeSets 
$client->call($session'product_attribute_set.list');

$defaultID findAttributeSetID($attributeSets"Default");

$attributes $client->call($session'product_attribute.list'$defaultID);

$manufacturer_id findAttributeID($attributes"manufacturer");


if(
$manufacturer_id != -1{
    $options_set 
$client->call($session'product_attribute.options', array($manufacturer_id));
    
var_dump($options_set);
}
Everything up to the ‘product_attribute.options’ method works.

What I’m getting though is this error:

Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Call to a member function setAttribute() on a non-object in C:\Program Files\Apache\Apache2.2\htdocs\Convert\connect.php:182 Stack trace: #0 [internal function]: SoapClient->__call(’call’, Array) #1 C:\Program Files\Apache\Apache2.2\htdocs\Convert\connect.php(182): SoapClient->call(’2o2c1ell1n324dm...’, ‘product_attribu...’, Array) #2 {main} thrown in C:\Program Files\Apache\Apache2.2\htdocs\Convert\connect.php on line 182

(Note: Line 182 - is the line that calls ‘product_attribute.options’)

So I’m not sure if this is the fact that I’m using this method wrong or there a bug with the method.
It’s weird that the error message says: “Call to a member function setAttribute() on a non-object in C”.  Why am I calling a setAttribute() method when I’m trying to retrieve options and not settting them.  (I also tried a try/catch block, gives the same error message.)

Anyone have any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
clorne
Sr. Member
 
Total Posts:  236
Joined:  2008-01-10
London
 

Did you find a solution to this?

If you didn’t, my feeling is that this method has not been set up yet or there is a bug.

You can get some very odd results if you put in different attribute_ids.  Different from the manufacturer id which I think has a default of 65.

 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

Nope, didn’t find any solution.  I opened a bug report #6262 on this subject.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Killoff
Magento Team
 
Avatar
Total Posts:  17
Joined:  2008-05-22
 

Fixed in 23424 rev.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cgalpin
Jr. Member
 
Total Posts:  11
Joined:  2008-06-25
 
Killoff - 05 August 2008 12:33 AM

Fixed in 23424 rev.

I just ran into this too in 1.1.2 (although in my case the error message is “Requested attribute not found.").

I guess there is no avoiding using the last source from SVN at this point since I think I’m going to keep running into problems, but was wondering when you expected this to make a release?

thanks
charles

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dieter21
Member
 
Avatar
Total Posts:  51
Joined:  2008-03-29
Belgium
 

I fixed this problem by changing the following file:
\app\code\core\Mage\Eav\Model\Entity\Attribute\Abstract.php

Look at around line 365 for function:

protected function _getDefaultSourceModel()
{
        
return $this->getEntity()->getDefaultAttributeSourceModel();
}
and replace it with:
protected function _getDefaultSourceModel()
{
        
return 'eav/entity_attribute_source_table'
}

But one warning:
I have not tested if this change influences the functionality of other parts of magento.

 
Magento Community Magento Community
Magento Community
Magento Community
 
itognet
Jr. Member
 
Total Posts:  24
Joined:  2008-08-03
 

Where can I write you about the extender?

I get System.OutOfMemoryException when using the Windows MagentoXtender.
I can log in. But anything else makes the exception.

It says Too many items in the combobox.
I have tried from two computers

 
Magento Community Magento Community
Magento Community
Magento Community
 
seudo
Guru
 
Avatar
Total Posts:  344
Joined:  2008-04-21
 

@JKWan13 I was able to get an attributes options via this where $attribute_id is an integer:

$options_set $client->call($session'product_attribute.options', array('attribute_id'=>$attribute_id));
 
Magento Community Magento Community
Magento Community
Magento Community
 
JKwan13
Member
 
Total Posts:  63
Joined:  2008-06-12
 

@suedo?

Thanks for the update.  I see that you also updated the wiki for this as well.

I actually hadn’t tried it since they last fixed it, since I found a workaround for what I needed this function for.

I just tried it (v 1.1.6) with the original code I posted above and it seems to work, and your method seems to work as well.  So it seems that (at least for me) both using the “ ‘attirbute_id’ => “ or not works.

What I needed it for was to look up the id for the manufacturer, when adding products since you can’t enter using the string value.  I’m thinking I might stay with the workaround for now since the api seems so slow, and any extra calls will slow it down.

Btw my workaround was that I entered in all the attributes alphabetically, and then in my code, i just made an array of all the manufacturers (alhpabetically as well).  I then made a function to search the array for the “string” value of the manufacturer I was looking for and have it return the index on the array.  SInce the manufactuers were entered in alphabetically, the were in the same order I made my array, the index was the same.  (Note: I had to enter a false entry at the front, ( or you could just add one to the index) to get the right id for the manufacturer).

I can’t wait until they add the ability to add attributes and attibute options and manipulate attibute sets as well.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kullraith
Jr. Member
 
Total Posts:  6
Joined:  2008-11-13
 

magento 1.1.6 in xtender
i clik manage products and this message pops-up

Image Attachments
error  xtender.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
j2tdesign
Sr. Member
 
Avatar
Total Posts:  208
Joined:  2008-07-16
France
 

Hello,

I am having the same problem here and I haven’t found a solution yet.
Actually, I have this error message:

Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Call to a member function items() on a non-object in C:\xampp\htdocs\vitalibio\data_flow\process_products.php:89 Stack trace: #0 [internal function]: SoapClient->__call(’call’, Array) #1 C:\xampp\htdocs\vitalibio\data_flow\process_products.php(89): SoapClient->call(’7b0b468c9282654...’, ‘product_attribu...’, Array) #2 {main} thrown in C:\xampp\htdocs\vitalibio\data_flow\process_products.php on line 89

By calling :

$attributes $data_flow->proxy->call($data_flow->sessionId'product_attribute.options', array('attribute_id'=>66));
or
$attributes $data_flow->proxy->call($data_flow->sessionId'product_attribute.options', array(66));

I tried with magento 1.1.7 and 1.1.8.

Any ideas?

If I find a workaround, I will post it here wink

Jon

 
Magento Community Magento Community
Magento Community
Magento Community
 
Praveen Kumar Reddy
Jr. Member
 
Total Posts:  7
Joined:  2009-01-06
 

Hi,

I am getting Access Denied message when call any webservice api methods of Magento like

$result= $client->call($session, ‘customer.list’, array());

Any suggestions/solutions would be highly appreciated.

smile

Thanks in advance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
krazik
Jr. Member
 
Total Posts:  5
Joined:  2008-11-02
 

Did you find a solution to this?

j2t-design - 01 December 2008 04:37 AM

Hello,

I am having the same problem here and I haven’t found a solution yet.
Actually, I have this error message:

Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Call to a member function items() on a non-object in C:\xampp\htdocs\vitalibio\data_flow\process_products.php:89 Stack trace: #0 [internal function]: SoapClient->__call(’call’, Array) #1 C:\xampp\htdocs\vitalibio\data_flow\process_products.php(89): SoapClient->call(’7b0b468c9282654...’, ‘product_attribu...’, Array) #2 {main} thrown in C:\xampp\htdocs\vitalibio\data_flow\process_products.php on line 89

By calling :

$attributes $data_flow->proxy->call($data_flow->sessionId'product_attribute.options', array('attribute_id'=>66));
or
$attributes $data_flow->proxy->call($data_flow->sessionId'product_attribute.options', array(66));

I tried with magento 1.1.7 and 1.1.8.

Any ideas?

If I find a workaround, I will post it here wink

Jon

 
Magento Community Magento Community
Magento Community
Magento Community
 
krazik
Jr. Member
 
Total Posts:  5
Joined:  2008-11-02
 

I fixed it for me.  Not sure if the solution is right

in app/code/community/Linux4ever/MagentoXtender/Model/Product/Attribute/Api.php

public function options($attributeId$storeID null)
    
{
        
#disabled - this doesn't work -- return Mage::getModel('magentoxtender/eav_attribute_option_api')->items($attributeId);
        
return parent::options($attributeId$storeID);
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top