# Cannot link the photo to each product

**URL:** <https://forum.wixstudio.com/t/cannot-link-the-photo-to-each-product/32015>\
**Category:** Ask the community\
**Tags:** question, code, wix-stores\
**Created:** [October 11, 2020, 3:25pm UTC](https://forum.wixstudio.com/t/cannot-link-the-photo-to-each-product/32015 "2020-10-11T15:25:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoiying123](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/hoiying123/32/24028_2.png) [@hoiying123](https://forum.wixstudio.com/u/hoiying123)\
**Post date:** [October 11, 2020, 3:25pm UTC](https://forum.wixstudio.com/t/cannot-link-the-photo-to-each-product/32015/1 "2020-10-11T15:25:02Z")

</div>

Hello guys. I have questions on adding extra product detail gallery (Banner + Detail Shoot) relating to each products.  
Hope that I can get solutions here.

I use Wix preset product page but I cannot add field in the read-only database.  
So I make another dataset called Product list (#dataset2) with Banner + Detail Shoot gallery.

 ![](https://us1.discourse-cdn.com/wix/original/3X/8/b/8b132c2c58a6e04b3be41e6890997cdac498e986.png)

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/6/26e10fa6d1331b56d41c6c1ace49ad5e8737e69d.png)

ID as the common field of products database and Product list database.

 ![](https://us1.discourse-cdn.com/wix/original/3X/3/a/3a9e4f440a86436582bf4eb0188aaddf17c2e325.png)

Take the product (1b2ca124-cd57-56cd-482d-5c9d9ae6923c) as an example.

But I find that I have to generate the specific product id on each page, so I can connect the related fields( Banner & detail shoot) in dataset2.

I believe that I need Corvid to generate

1. Get the product id

2. filter the data in dataset2 regarding the product id

3. link the detail shoot field in dataset 2 to the #gallery1 & #gallery2

May anyone help me please😥 Thanks a lot!

* * *

Update:  
I discovered a code to fix this already, hope to help any newbies like me

import wixData **from** ‘wix-data’ ;  
import wixWindow **from** ‘wix-window’ ;  
import wixStores **from** ‘wix-stores’ ;

**let** product;

$w.onReady( **async function** () {  
product = **await** $w( ‘#productPage1’ ).getProduct(); filterDataset();  
$w( ‘#dataset2’ ).setFilter(  
wixData.filter()  
.eq( ‘id’ , product)); filterDataset();  
});

**async function** filterDataset() {  
**await** $w( ‘#dataset2’ ).setFilter(wixData.filter().eq( ‘id’ , product.\_id));  
}

This generate the related photo to each product page~  
Hope it can help

---

<div class="post-metadata">

**Author:** ![hoiying123](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/hoiying123/32/24028_2.png) [@hoiying123](https://forum.wixstudio.com/u/hoiying123)\
**Post date:** [November 11, 2020, 8:14am UTC](https://forum.wixstudio.com/t/cannot-link-the-photo-to-each-product/32015/2 "2020-11-11T08:14:11Z")

</div>

Problem appear again after I publish the website.

With the above coding, the correct related photos did link to each product.

 ![](https://us1.discourse-cdn.com/wix/original/3X/c/f/cf44e09439dbe6695d530f8c52e54dbbef2d6e0b.jpeg)

---

<div class="post-metadata">

**Author:** ![hoiying123](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/hoiying123/32/24028_2.png) [@hoiying123](https://forum.wixstudio.com/u/hoiying123)\
**Post date:** [November 11, 2020, 8:15am UTC](https://forum.wixstudio.com/t/cannot-link-the-photo-to-each-product/32015/3 "2020-11-11T08:15:03Z")

</div>

But in “view live site” mode, the galleries are unable to link as editor mode shown.

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/e/2ebf22a4b9f77afbbffe42211a35d1acf44d7c9e.jpeg)

---

<div class="post-metadata">

**Author:** ![hoiying123](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/hoiying123/32/24028_2.png) [@hoiying123](https://forum.wixstudio.com/u/hoiying123)\
**Post date:** [November 11, 2020, 8:15am UTC](https://forum.wixstudio.com/t/cannot-link-the-photo-to-each-product/32015/4 "2020-11-11T08:15:14Z")

</div>

I thought it may be related to these error, may somebody help on these?

Thanks a lot xoxo

 ![](https://us1.discourse-cdn.com/wix/original/3X/f/8/f8e2f51a13b5b38e9ea26829bd4eba0500394067.png)
