OCAPI #448
Replies: 7 comments
-
Hi, if the custom attribute are in the product, you could retrieve from productHit, if are some calculated attribute or external ones, is better check one to one if this process could decrease performance |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for your response, but how to enable custom attributes in productHit? |
Beta Was this translation helpful? Give feedback.
-
Hi Joji,
AFAIK, as long as the attribute is showing on your BM product detail
screen, you don't need to do anything extra to enable custom attribute in
the OCAPI. If you have a selector in your request, just use wildcard or add
the custom attribute to the selector. The attribute will be in the response
document.
Wei
…On Mon, Aug 5, 2019 at 6:56 AM Joji Thomas ***@***.***> wrote:
Hi,
Thanks for your response, but how to enable custom attributes in
productHit?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/orgs/SalesforceCommerceCloud/teams/community/discussions/101/comments/2?email_source=notifications&email_token=AAPID6TCOS6OYHLBJKOJAUTQDABNDA5CNFSM4IJHN6X2YY3PNVWWK3TUL52HS4DFWNCGS43DOVZXG2LPNZIG643UKJSXA3DZVJRW63LNMVXHIX3JMTHAAAQXT4>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPID6RM2PYRIAEOJVXRAALQDABNDANCNFSM4IJHN6XQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Hi Vivily, You are right, we will get all the product related attributes in GET /products/{id} API, but I need the same custom attributes in GET /product_search API response. Is there any configuration or settings for achieving this requirement. |
Beta Was this translation helpful? Give feedback.
-
Hi @joji-litmus7 , No, there is not a configuration to do this as it really is not the best practice to add this data to that response. If you really want to do it, the only means by which to do so would be through the dw.ocapi.shop.product_search.modifyGETResponse hook. There you would need to get the response document and then get each of the products and add the additional fields that you want to that document. This means that you would be taking an API request that was just reading from an index and would be adding additional, maybe cached, maybe not, calls to get the product object for each record to get that data. The best practice way to get that information would be to get the array of items back from the /product_search API and then call /products/{id}....{id} to get the product records. |
Beta Was this translation helpful? Give feedback.
-
In modifyGETResponse get the original product from getProduct api and loop over product.custom and set in c_customproperty. When you loop take care of enum values. |
Beta Was this translation helpful? Give feedback.
-
There is a video that covers using OCAPI hooks in the Partner Community
Learning Path: https://embed.vidyard.com/share/SuHKKP72voLN2ezSDidqeB?
Check it out.
Jorge
…On Mon, Aug 12, 2019 at 11:10 PM Saurabh Jain ***@***.***> wrote:
In modifyGETResponse get the original product from getProduct api and loop
over product.custom and set in c_customproperty. When you loop take care of
enum values.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/orgs/SalesforceCommerceCloud/teams/community/discussions/101/comments/6?email_source=notifications&email_token=AJZO4ZS6G4P5OW4XN6PN2ZLQEIQ2NA5CNFSM4IJHN6X2YY3PNVWWK3TUL52HS4DFWNCGS43DOVZXG2LPNZIG643UKJSXA3DZVJRW63LNMVXHIX3JMTHAAAQ4BM>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJZO4ZR3FN6K33EM4QFSUILQEIQ2NANCNFSM4IJHN6XQ>
.
|
Beta Was this translation helpful? Give feedback.
-
What is the best approach to add custom attributes in "/product_search" API response?
Beta Was this translation helpful? Give feedback.
All reactions