SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    0 Post(s)
    0 Thread(s)

    Custom JavaScript for Ecommerce Shopify Site


    I've just finished building a Shopify shop from scratch at:

    Everything is working great, we're just working out small bugs here and there. We have it set up to where, when someone clicks on the "Add to Pallet" button, it refreshes to the same page and lands back on that particular products div. We used Javascript to do this by using an anchor tag based on that products SKU number. So, if you add a product to your pallet, you can see in the address bar something like:

    This works fine, but if the user adds another product on the same page, it amends that SKU number to the end of the other one, like so: Which makes the anchor not work.

    So, I was just wondering if there's a way to replace the SKU number every time someone adds another product instead of amending it...?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Christchurch, New Zealand
    104 Post(s)
    4 Thread(s)
    Are you using the location object to adjust the URL? For example, you can use location.hash to work with the fragment identifier.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts