Existing product store and wix-code

Hi to all,

We have:
Existing Wix site with some products and the classic ‘product-page’ dynamic type url.
e.g. https:// domain-name/product-page/productname1
https:// domain-name/product-page/productname2.

Is it possible to use (on the product-page) wix-code and get the above url or the ‘productnameN’?
Getting the url or productname of existing wix-store products will allow to add more js add-ons, reviews and allow to have a hybrid wix-store and wix-code.
dim.

Hi!

Can you try to use ’ wixLoaction ’ module for that?
see there wixLocation.path .

Liran.

Hi Liran,
i already try (wix location path, url etc) but I only get the url "https:// domain-name/product-page/ " and not the last part which is the one that changes and of course the significant one . (note that to test, I use a free published site copy of the premium).
dim.

OK,

I suspected that this will be the case… unfortunately this is the only option for now.
We’ll have a deeper look at that and keep you updated.

Liran.

Ok Liran
Thanks.

hi to all

The same thing happens to me, I would like to capture the whole URL, I leave my code, if you can help me, I would appreciate it

import wixLocation from ‘wix-location’;

$w.onReady(function () {
let url = wixLocation.url; // Change wixLocation.protocol to wixLocation.url. Should be in $w.onReady scope
$w(“#URLcurrent”).value = url; // #URLcurrent represents the id name of your input field, change it to the correct id name
$w(“#dataset1”).onAfterSave(sendFormData);
});

import {sendEmail, sendEmailWithRecipient} from ‘backend/email’;

$w.onReady(function () {
$w(“#dataset1”).onAfterSave(sendFormData);
});

function sendFormData() {
const subject = A ${$w("#input2").value} LE INTERESA LO SIGUIENTE:;
const body = `Formulario de inscripción ME INTERESA

\URL: ${$w(“#URLcurrent”).value}
\Nombre: ${$w(“#input2”).value}
\Teléfono: ${$w(“#input3”).value}
\Email: ${$w(“#input4”).value}
\Terreno: ${$w(“#selection1”).value}`;

const recipient = $w(“#input2”).value;
sendEmailWithRecipient(subject, body, recipient)
.then(response => console.log(response));

sendEmail(subject, body)
.then(response => console.log(response));
}

Hi Alfredo,
(I am not a WIX staff)

To get the url, I worked with this solution :

(1) add an html component to page (with name : html3)

(2) add code to the html component :

<script type="text/javascript" src="//static.parastorage.com/services/js-sdk/1.90.0/js/wix.min.js"></script>
<script>
var HTMLurl;
document.addEventListener("DOMContentLoaded", function(event) {
	Wix.Settings.getSiteInfo(function (siteInfo) {  HTMLurl = siteInfo.url;
window.parent.postMessage(HTMLurl, "*");
  });
  });
</script>

(3) add code to page

import wixWindow from 'wix-window';
var  pUrl;

$w.onReady(function () {	
		$w("#html3").postMessage("");
		Init();
} );

export function Init() {				
	$w("#html3").onMessage( (event) => {		
		pUrl=event.data;
		console.log("pUrl " + pUrl);	
	});
}

(4) On PUBLISHED site, I have the URL in pUrl variable.

Dim.

hi Museusmusic

your method worked for me, finally, you passed, I’ve been trying to capture the complete url for a long time and I see that you had the same problem, thanks for sharing your knowledge and thanks to everyone who also helped me in the forum.

thank you very much to all

Hi Guys, we know this and we’re working on a fix.
Thanks,
Liran.

hi to all
I can not send the data of ¨pUrl¨ to the database, the database does not save anything
help me please