Jump to content

Adding an image to custom product form

Go to solution Solved by creedon,

Recommended Posts

Posted

When you say custom product form, is this a form that is added to a product through the product editor interface?

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password is not a security breach. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

  • Solution
Posted (edited)

Add the following to Store Settings > Advanced > Page Header Code Injection for the store page.

<style>

  /*
  
    begin product form image add
    
    Version     : 0.1d0
    
    SS Version  : 7.1
    
    By          : Thomas Creedon < http://www.tomsWeb.consulting/ >
    
    */
    
    [data-form-id="5f8f0e40d03aaf4e9a88476d"]::before
    
      {
      
        background-image : url( https://images.squarespace-cdn.com/content/v1/5e27638ae410453315a6e06d/1603938096141-627PII0Z3UEWX8XOFPDO/TypesetForTwo-ChristmasYall+back1.jpg );
        background-position : center;
        background-repeat : no-repeat;
        background-size: contain;
        content : '';
        display : block;
        height : 300px;
        margin-bottom : 24px;
        
        }
        
    /* end product form image add */
    
  </style>

This code is specific to the poster's need.

You'll want to replace the example background image url with your image url. Also you may want to change the height value.

Let us know how it goes.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Posted

This worked perfectly! Thank you so much! 

One other question. Is it possible to have different images on different forms. 

For example, I added an image to the form for my vertical cards but I need a different image for my horizontal cards on that respective form. Is that possible?  Even if I create its own form how do I point the image each to the specific form?  

Posted

It may be possible. If you altered the code by duplicating the code and changing the data-form-id value to the appropriate value for the new form then you could associate a new image with that form.

Basically the current code associates one image with one form.

Without a specific example of a product with this alternate form it is hard to be more specific. It would also help to know the URL of the image you want at the the top of the form.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Posted (edited)

Thanks again for your response, I really appreciate your time. 

Here's the URL for to the page with the new form: https://www.typesetfortwo.com/christmas-collection/p/blessings

Here's the URL for the image for the new form: 

https://   images.squarespace-cdn.com/content/v1/5e27638ae410453315a6e06d/a9fbbff1-52fe-48ff-9dfe-2e9af78799f3/Christmas2021-BACK-Layout-HORI.jpgChristmas2021-BACK-Layout-HORI.jpg

Edited by PhoebeT42
Posted

If you duplicate the code above and replace 5f8f0e40d03aaf4e9a88476d with the following 6178d859046d482a1c34bce8. Then the form for this product can have a different image than the other product pop-up form.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

  • 4 months later...
Posted

Hi, I wanted to do the same thing on my website, so I tryed coping your code where indicated and changing the img url. It didn't work...

Should I change the data-form id aswell ? if yes, where do I find my id ?

Thanks in advance :)

Posted
15 minutes ago, manufacture_wagram said:

Should I change the data-form id aswell ? if yes, where do I find my id ?

Yes.

Finding the id involves using the browser developer tools which can't be explained in a few sentences.

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.