PLT Posted June 4 Posted June 4 (edited) Hello. I wanna build a custom form that will grab the [ #productDetails .product-title ] from the Product Page, and use it to populate the Subject Field. Any ideas? I'm using the Avenue Template. Thanx! https://www.preston.camera/abstractions-prints/she-her Edited June 4 by PLT add details
tuanphan Posted June 5 Posted June 5 I don't know this, but if you want to get Product URL, you can follow these. You can add a Form Block with Hidden Field Label: Page URL then use this code to Pages > Website Tools > Code Injection > Footer <script> document.addEventListener('DOMContentLoaded', function() { if (document.querySelector('[name="SQF_PAGE_URL"]')) { document.querySelector('[name="SQF_PAGE_URL"]').value = location.pathname; } }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
PLT Posted June 10 Author Posted June 10 On 6/5/2024 at 3:41 AM, tuanphan said: I don't know this, but if you want to get Product URL, you can follow these. You can add a Form Block with Hidden Field Label: Page URL then use this code to Pages > Website Tools > Code Injection > Footer <script> document.addEventListener('DOMContentLoaded', function() { if (document.querySelector('[name="SQF_PAGE_URL"]')) { document.querySelector('[name="SQF_PAGE_URL"]').value = location.pathname; } }); </script> Hey! Sorry, I've been traveling. I'll give this a try in the next day or so. Thank you! PLT
PLT Posted June 10 Author Posted June 10 On 6/5/2024 at 3:41 AM, tuanphan said: <script> document.addEventListener('DOMContentLoaded', function() { if (document.querySelector('[name="SQF_PAGE_URL"]')) { document.querySelector('[name="SQF_PAGE_URL"]').value = location.pathname; } }); </script> Hello. I tried this a few times, returned no value. Thoughts? Thanx.
tuanphan Posted June 13 Posted June 13 Ah, I forgot, I just test a new code, you can see this demo https://herring-duck-dk5w.squarespace.com/shop/product-01 pass: abc The form will be like this. Here I used Text Field for Page URL. (Edit Mode) (Outside) If you agree this, I will send new code. With this, if you have 10 products, you will need to add Form to 10 Products, or you can add Form to Footer, then we will use code to move it to 10 products Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment