Observable into observable array

Hello !

I am working on a “online-shop” project using Fuse and an homemade API, in order to learn how to use fuse.
The part I am having troubles is the “cart”, I have a file with an observables and I add a product whenever the add button is clicked.

When I use product.name in the UX no problem; But cannot use it in the javascript file.

// Here with product I Get the name, price etc ...

var product = productView.Parameter.flatMap( function(param) {
	//console.log("Current product id " + param._id);
	return (param);
});

//what I want to do is add this product "object" to my observable (list), as show below

function addtobucket() {
	dataStore.paniers.add(this.product);

	console.log("Content of the cart JSON -->  " + JSON.stringify(dataStore.paniers)); // NULL because this.product is undefined

}


I have tried many differents ways to add this product, following recommendations etc … Like make a copy with “var copie = Object.assign({}, obj);”

What am I missing ?

Well … I fixed It by doing :

function addtobucket(arg) {

	dataStore.paniers.add(productView.Parameter.flatMap( function(param) {
		return (param);
	}));

	console.log("panier contient en JSON -->  " + JSON.stringify(dataStore.paniers));
}
<ScrollView>
	<StackPanel ItemSpacing="10" Margin="10">
	<Text Value="PANIER" Alignment="Center" FontSize="16"/>
		<Each Items="{paniers}">
			<DockPanel Padding="10">
				<Panel Layer="Background" Clicked="{productDetails}" Color="#EEE" HitTestMode="LocalBounds"/>
				<ListIcon Dock="Left" Color="{color}" HitTestMode="None"/>
				<Label Value="{name}" HitTestMode="None"/>
				<Label Value="{price}€" Alignment="Right"/>

				<Image Dock="Right" File="../Assets/info.png" BoxSizing="FillAspect" Aspect="1"
					Clicked="{mvCart}" Color="#ccc"/>
			</DockPanel>
		</Each>
		<basic.Button Text="Payer ou réserver les produits" Clicked="{showDialog}" />
		<basic.Button Text="Faire de ce panier une whishlist" Clicked="{login}" />
	</StackPanel>
	</ScrollView>

//and the product details function : 

function productDetails(e) {
	console.log("click on : " + e.data.name ); // print "click on undefined
}


Thanks for your help