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

Can Magento API create products with attributes? 
 
BizSync
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-24
Boston, MA.
 

I’ve got products coming from an external system and I’m using the Core API to add them to Magento. 

However, the external products are tied to attributes such as size (and possibly color).

What I need to do is create products in Magento for the base stock number, then create relative “sizes” (i.e. size 1, 2, etc.).
as attributes.  The sizes are tied to inventory quantities on the back-end and need to be added and removed based
on the stock quantities on hand.  For example, if they sell out of size 11, they’ll want the size to be hidden on the site.
But if they have them in stock, they’ll want the size to show up on the product in the dropdown…

Creating the products in Magento is fairly easy using “catalog_product.create” and updating the base product is easy as well.

Clearly creating attributes is capable in the admin interface, but I see no way of “programatically” creating the attributes for the sku in Magento in the catalog_product.attributes.

Without having to create my own module, is the Magento core API capable of this?  Or does someone have any other
suggestion to get this to work?

I’m using 1.7.x

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

You will be making simple products for each size/colour sku and having a master configurable product that the simple products are attached to. I am fairly certain that Magento can do all of what you want (as described), you may need to import the first set with dataflow, get them looking good, then work on the SOAP to keep things maintained. I would proceed, and if you have the API side working already there is ‘nothing to fear’.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BizSync
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-24
Boston, MA.
 
Discovery - 29 November 2008 03:56 PM

You will be making simple products for each size/colour sku and having a master configurable product that the simple products are attached to. I am fairly certain that Magento can do all of what you want (as described), you may need to import the first set with dataflow, get them looking good, then work on the SOAP to keep things maintained. I would proceed, and if you have the API side working already there is ‘nothing to fear’.

I’ve considered this method.  Creating simple products for each sku. etc.

For example, if I have SKU

2-442 (make this the master configurable one)

And that SKU has sizes that are 1,2 and 3. 

I’d create simple products for each of the size like:

2-442-1
2-442-2
2-442-3

The question I ask is, can from the API, I make the connection between the master configurable product and
the simple product SKU’s?

I see no place where I can “connect” the sku’s so that the sizes appear as an “option” dropdown for the main
product in the customer side frontview… Seems there’s something missing there.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

As mentioned, you would want to use Simple products to represent the physical product/SKU and then wrap those in Configurable products to sell them.  The added benefit of that is inventory management.  You track the inventory of each simple product separately.

But, to answer your question, you can manage attributes and attribute sets via the API as well. 

Mage_Catalog_Model_Product_Attribute_Api
Mage_Catalog_Model_Product_Attribute_Set_Api

http://www.magentocommerce.com/wiki/doc/webservices-api/api#product_attributes_api
http://www.magentocommerce.com/wiki/doc/webservices-api/api#product_attribute_sets_api

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Wow.  Removed due to total stupidity on my part.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BizSync
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-24
Boston, MA.
 
Lee Saferite - 30 November 2008 07:50 AM

As mentioned, you would want to use Simple products to represent the physical product/SKU and then wrap those in Configurable products to sell them.  The added benefit of that is inventory management.  You track the inventory of each simple product separately.

But, to answer your question, you can manage attributes and attribute sets via the API as well. 

Mage_Catalog_Model_Product_Attribute_Api
Mage_Catalog_Model_Product_Attribute_Set_Api

http://www.magentocommerce.com/wiki/doc/webservices-api/api#product_attributes_api
http://www.magentocommerce.com/wiki/doc/webservices-api/api#product_attribute_sets_api

Correct me if I’m wrong, and maybe I’m missing something, but I do not see any way of creating attributes.
It appears the API here only allows for “retrieval” and listing, not creating, updating etc.

Did I miss something?

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Wow, you are right.  I must be having an off day. =)

Sorry about that.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BizSync
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-24
Boston, MA.
 

So if I’m correct here, there’s no way to do what I want through the Web service?

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

I would say it depends on exactly what you want to do really.

You apparently cannot define new attributes or attribute sets, but you can USE define attributes and sets.  Meaning, you can define a product type and what information it contains via the AdminUI.  You can use the API to import products of that type.  So, say you have T-Shirts on your site.  You can define an attribute set that covers T-Shirts and has all the colors and sizes define ahead of time.  Then on import you can actually use those colors and sizes.

What exactly do you think you cannot accomplish?

As a side note, If you wanted the ability to add/edit attribute sets via the API, you could add that code in yourself via a module.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Megento Example
Jr. Member
 
Total Posts:  1
Joined:  2010-10-19
 

I too faced the same problem. I want to create a new attribute. I tried a lot, after analyzing I came to understand that, we cannot create a new attribute via web service, as there is no API available for creating a attribute.

 
Magento Community Magento Community
Magento Community
Magento Community
 
oyvindlh
Jr. Member
 
Total Posts:  2
Joined:  2010-11-25
 

I’m trying to populate attributes via API as well. But there is no way to do it?

For instance:

$serier[] = array(’catalog_product’, ‘140’, array(
‘label’ => ‘Ceremony’,
‘position’ => 0,
));

$proxy->multicall($sessionId, $serier);

Where 140 is the attribute code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
NETZKOLLEKTIV
Member
 
Avatar
Total Posts:  35
Joined:  2010-05-06
Erlangen, Germany
 

Adding new attributes is possible using our NETZKOLLEKTIV Core API Extension among many more methods. You may also add newly created attributes to attribute sets and add new attribute sets.
Just take a look at our extension page and documentation. If you have any questions do not hesitate to ask using our contact form.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top