Jump to content

rubyviolet

Member
  • Posts

    6
  • Joined

  • Last visited

rubyviolet's Achievements

  1. i figured it out myself!!! i dont know javascript so im patting myself on the back right now haha. <script> window.customCartDrawer = { onUpdateFunction: function(drawer, data) { $(document).ready(function(){ $('a').each(function(){ this.href = this.href.replace('/saved/p/', '/labels/'); }); }); } } </script> this is what i used and it worked 🙂
  2. @creedon so sorry to be a bother again, you have been so much help, so i was thinking because i need to do this to multiple links it would be fastest if i could replace the middle part of a link because the end parts of will be the same, that way i dont have to manually do this for every link. (i dont want anyone ever going to the product pages) for example: https://idmdiscovery.com/saved/p/analogical-force ---> https://idmdiscovery.com/labels/analogical-force would there be a way to replace saved/p with labels (for every single instance a link with saved/p appears on my site?) i hope this makes sense, thanks again you are a life saver.
  3. Site URL: https://idmdiscovery.com password idm. Hey! so i need some script that can redirect links to another link, for instance i want to change all the links in my cart so that they link to blog posts. I was using this code: <script> $( ( ) => { /* map cart item title urls */ const urlMappings = { '/saved/p/analogical-force' : '/labels/analogical-force' /* last or only item doesn't get a comma */ } const urlError = '/x'; /* page to go to in case a url mapping isn't found */ // do not change anything below, there be the borg here if ( location.pathname != '/cart' ) return; $( '.CartTableRow-itemTitle-1MDgZ' ).each ( function ( ) { let $this = $( this ); let href = $this.attr ( 'href' ); if ( href in urlMappings ) { href = urlMappings [ href ]; } else { href = urlError; } $this.attr ( 'href', href ); } ); } ); </script> and it worked until i installed the customcartdrawer plugin from squarewebsites.org, now the link redirect doesnt work with the cart drawer, i think i need to change the location pathname in the above script so its sitewide but i cant figure that out, i dont want anyone seeing the product pages, they are supposed to just hold data for the cart. If i can change the links sitewide instead of just the cart that might make it work again, can anyone help me out please? thanks so much.
  4. I'm having issues too, I thought it was just me, but the search is basically useless. i have hundreds of blogs and pages so i need a working search.
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.