One of the option selectors that you can use for your product listings is called “Dropimage” and it lets you specify small images for each option that change as the option is selected. Like this:
The default action of this feature is to show the image change alongside the option selector as shown above. However, a question we get often is in regards to tailoring the function so that it changes the product’s main image instead. Like this:
Can it be done?
Yes! However, it takes some customization of the HTML and scripting that is used by your store. While we do offer this as a service for 3dcart Merchants, in the spirit of sharing, we’ve decided to list the steps here in case you’d like to try adding the customization yourself.
The information in this article is provided solely as a courtesy and to offer basic instructions on making changes to your store’s HTML templates.
Please understand that – regardless of how simple or complex the changes may be – HTML changes and troubleshooting fall outside the scope of our support department. The 3dcart support team is neither trained, qualified, nor allowed to make these changes for you. The boundary of our scope in this matter is limited to providing these instructions and helping you reset the template if the changes don’t work as you wanted.
If you are uncomfortable with making changes to your site’s HTML, please contact your sales representative and inquire about our HTML and design services which can make these changes for you.
Thank you for your understanding
I’m willing to risk it! What do I need?
To make these changes you’ll need the following:
- An HTML5 theme folder
(Recommended for best results!)
- Access to and comprehesion using your 3dcart store’s FTP access
(click here for some quick instructions on using FTP)
- Some level of basic HTML editing knowledge
(Just basics like finding and replacing certain elements)
- A text or HTML editor of your choice
(notepad, notepad++, dreamweaver, etc)
- The modified listing.js file attached on this article
(see download links below)
- Patience and a penchant for trial and error
(OPTIONAL: although highly recommended)
I got all that! I can do this!
Great! Let’s get started then. First, some prep work.
Setting up your product
We assume that your product is already set up for using the dropimage option selector. If not, please click here and learn how to set up your options and dropimage selector images.
Here are a few notes to consider when setting up or updating the drop image options:
- Make the drop images the same size as your product images
Normally drop images are very small but now, the drop images will appear in the same section as the main images, so they’ll need to be the same size.
For example, if your product images are 500×500, make the drop image selector images the same size.
- Make sure that the first drop image is the same as your main product file.
In other words, if your main product image is “product-image_01.jpg” use that image also for the first drop down image.
This is because – as the page loads – the first option will already be selected, and you want to have it match the main image.
- Find out which theme you’re using
Finally, while creating/updating the product in the online store manager, make a note of the theme your store is using.
Go to Settings ->Design ->Themes & Styles and just have a quick look at what’s listed for “Selected Theme”
If the theme name contains “-html5” in its name, then it is an html5 theme which is information that will come into play in the next sections
Getting the necessary files
Once you download and unzip the file, keep it on your desktop. We’ll come back to it in a moment.
Next, you’ll need to connect to your store’s FTP access.
- Connect to your store’s FTP access
- Navigate your FTP program to web/assets/templates
Your will see a series of folders listing your store’s installed themes along with a “common” folder and a “common-html5” folder. Let’s begin with the common folders.
- If you are using an HTML-5 theme for your store, proceed to the common-html5 folder.
- If you are using an older non-HTML5 theme, please proceed to the common folder instead
The common folder will contain all of the default templates used by the store. They will be listed alphabetically. Again, be sure to go into the common folder appropriate for your selected theme.
- Once in the appropriate common folder, locate and download a clean copy of the listing_0.html template
- Download the file to your computer and rename it (on your computer) as listing_10.html
Now we need to make two small edits on the file:
- Open up the listing_10.html file with your favorite text or HTML editor.
- Locate the line of code at the top that says:
- Remove and replace that line with the following:
- Next, locate the following line farther down on the file:
If using an HTML5 theme, find this line:
If using a non-HTML5 theme, find this line:
- Remove this line completely. (Remove only this line!)
- Save your file
Great job! That was the hard part. Now let’s get these files up to your store.
- Once again connect to your store’s FTP
- This time, navigate to web/assets/templates/[theme_folder]
(where [theme_folder] is your store’s selected theme)
- Upload your edited listing_10.html file into the theme folder.
- While in the theme folder, navigate to the js folder
(It’s unlikely, but if your theme doesn’t have a “js” folder, just create it)
- Once in the theme’s js folder, upload the listing1.js file you downloaded and unzipped earlier.
Now, let’s get the product and the store ready to use these edited and uploaded files.
- Log into your 3dcart Online Store Manager
- Using the left hand navigation menu, go to Products ->Product List
- Locate the dropimage product we’re working with and click on its thumbnail image, name or ID to open it up
- While viewing the products information screen, click on the “Advanced” tab found along the top
- Look for the “Listing Template” drop down menu and set it to “Style 11”
(Style 11 corresponds to listing_10 that you uploaded previously)
- Click “Save” at the top right to set your changes.
For best results, we recommend having the store’s 3dZoom function turned on since it will also work with the drop images. To set this function,
- Go to Settings ->General ->Store Settings.
- Once there, click on the Product Display tab found along the top
- Look for the “Enable Product Page Zoom” drop down menu and set it to “3DZoom”
- Click Save
If done correctly, your product will now update its main image as the drop image selectors are changed!
Best of luck to you in your edits and have fun with your new feature!