#Products' related ingredients block for each product

10 messages · Page 1 of 1 (latest)

frigid bane
#

Hey guys, I am stuck with this, so if anyone knows the answer would be a massive help!

I am creating an e-commerce store and want to list specific ingredients under each product for that product. The logic is the same as "related products" in the e-commerce template. You choose "related ingredients'' in the admin UI under each product and that should be displayed in the product page under each product.

I manage to render the title and description, but the image(media) just wont render. I cant figure out why.

I attached my code images and API with explanations of my code logic. If you have any questions please ask and I will try to answer!

If anyone has a big brain and can do some big brain moves bigbrain2 to help me figure it out would be amazing!
Cause at the moment after a long grind session I am feeling like this: cough :(.

Thanks in advance!

maiden pagodaBOT
frigid bane
shut lily
#

Hey @frigid bane

#

I can check this out now

#

This looks like it needs some back and forth discussion, let me know when you're on

frigid bane
#

Hey @shut lily ,
Thanks very much for this.
I will be online today the whole day, if you have time, if not I can do tomorrow.
Let me know what suits best for you.
Thanks for the answer,

#

Jonas

frigid bane
#

It seems that "ingredients" collection has media object like that:

"media": {
"id": "66251daa09f909e8100e7b3f",
"alt": "cayenne pepper",
"filename": "cayenne-pepper.png",
"mimeType": "image/png",
"filesize": 29616,
"width": 900,
"height": 712,
"createdAt": "2024-04-21T14:07:38.662Z",
"updatedAt": "2024-04-21T14:07:38.662Z",
"url": "http://localhost:3000/media/cayenne-pepper.png"
},

But when I relate it to products collection, media becomes a single string(?) :

"media": "6616bd5d2a6ae9d636e61a6b".

Maybe that helps, I dunno.

frigid bane
#

I solved the problem myself finally. Thanks for the answer though!