Data transfered to a lightbox from a page

Question:
Hello everybody,

Let me explain my problem:
On a page of my site are displayed all my items for sale in a repeater.
When I click on one of my items, I can extract the information I need (ItemName, ItemReference, Price, etc …)
A lightbox then opens to be able to add it to the cart. (or modify the quantity of my cart).
I would like this window to display the item I selected, then, if the article is still in the cart for this client, so it displays the quantity to modify (with the correct article), and if not i would like to simply addi it in the cart fopr this client, but it displays an item that does not correspond at all.
I attach my screenshots as well as the code used.
Thank you in advance for your help.

Product:
WIX EDITOR

What are you trying to achieve:
Add product in the cart from a Lightbox

Here the code to open the lightbox : that works !

wixWindowFrontend.openLightbox(‘Détails Panier’)

Here the code i put on “onReady” of the lightbox t filter data : iwould like to show the article that corresponds to this filter, i would like the lightbox to display the article in the cart correspoonding to the client to modify it (or to add it)

$w.onReady(function () {

$w(‘#ItemArticle’).value=session.getItem(‘NomArticle’);
$w(‘#ItemRefArticle’).value=session.getItem(‘RefArticle’);

$w(‘#MesArticles’).setFilter(wixData.filter()
.eq(“reference”, $w(‘#ItemRefArticle’).value))
$w(‘#MesArticles’).refresh()

});

To transfer data from a page to a lightbox:

Page code

import wixWindow from 'wix-window-frontend'

// data: { ... }
wixWindow.openLightbox('lightboxName', data)

Lightbox

import { lightbox } from 'wix-window-frontend'
const data = lightbox.context
1 Like

Hello

Thank you very much, everything is now ok.