Inhalte aufrufen

Profilbild

Web API reading order items with product attributes


Best Answer Marcus Gesing , 05 September 2023 - 13:23

Yes, 
odata/v1/OrderItems?$filter=OrderId eq 1
 is fine. If RawAttributes is empty, then no attributes were selected for the ordered product.
 
AttributeDescription contains a short description of all selected attributes and is preferably to be used for description because the store frontend does it that way too.
Go to the full post


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
3 Antworten zu diesem Thema

#1 ertank

ertank

    Member

  • Members
  • PunktPunkt
  • 10 Beiträge

Geschrieben: 04 September 2023 - 15:29

Hello,

 

I am using Smartstore 5 API.I can read order items using a request like below

 

odata/v1/OrderItems$filter=OrderId eq 1

 

But, I also need to read certain product attribute named lets say XXX and its value. Example request returns AttributeDescription and RawAttributes but they both are empty.

 

Is it possible to have a specific product attribute and its value listed?

 

Thanks & Regards,

Ertan



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3802 Beiträge

Geschrieben: 05 September 2023 - 13:23   Best Answer

Yes, 
odata/v1/OrderItems?$filter=OrderId eq 1
 is fine. If RawAttributes is empty, then no attributes were selected for the ordered product.
 
AttributeDescription contains a short description of all selected attributes and is preferably to be used for description because the store frontend does it that way too.

  • stefanmueller gefällt das

Marcus Gesing

Smartstore AG


#3 ertank

ertank

    Member

  • Members
  • PunktPunkt
  • 10 Beiträge

Geschrieben: 07 September 2023 - 08:51

Product Attributes will be used to Sync Product between 3rd party application and so I am searching for a way to have specific attribute name and its value to be always listed together with OrderItems.

 

I am not sure if that is possible though. Alternative, would be to read each product in OrderItems separately with this specific attribute and its value listed.

 

BTW, Is there a better way to sync orders/products with 3rd party applications?

 

Thanks.



#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3802 Beiträge

Geschrieben: 07 September 2023 - 19:04

I don't understand why you want to use product attributes to synchronize with an external application. Product attributes are meant for something completely different.
 
You can bind additional data to orders and products using the SyncMapping or GenericAttribute entity. Alternatively, you can create your own entity for mapping. However, this requires a plugin, so not via the Web API. But then you have all the freedom.

  • stefanmueller gefällt das

Marcus Gesing

Smartstore AG