Auto Select colour Swatch when configurable product page loadsAuto select option based on category ?Configurable Swatches on Listing Page: Show Multiple Color AttributesConfigurable product with multiple color variationsChange More product images on color swatch selectConfigurable swatch not working properlyIs there a way to automatically select the first colour swatch on the product page?Is there any way that one swatch is selected by default (magento configurable swatches)How to change image size on category page when click swatchHow to Auto Select The Color as Swatch Option for Products with Only One Color (on Magento 2.1 Product View)?Hide Configurable product images from details page when color swatch is selected
Revoked SSL certificate
Can you really stack all of this on an Opportunity Attack?
Codimension of non-flat locus
Cross compiling for RPi - error while loading shared libraries
Why do I get two different answers for this counting problem?
Is it inappropriate for a student to attend their mentor's dissertation defense?
NMaximize is not converging to a solution
How is it possible to have an ability score that is less than 3?
Did Shadowfax go to Valinor?
Can I ask the recruiters in my resume to put the reason why I am rejected?
Approximately how much travel time was saved by the opening of the Suez Canal in 1869?
How much RAM could one put in a typical 80386 setup?
Is it possible to run Internet Explorer on OS X El Capitan?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
What defenses are there against being summoned by the Gate spell?
How to determine what difficulty is right for the game?
How old can references or sources in a thesis be?
How does quantile regression compare to logistic regression with the variable split at the quantile?
LaTeX: Why are digits allowed in environments, but forbidden in commands?
Is it possible to do 50 km distance without any previous training?
I'm flying to France today and my passport expires in less than 2 months
Today is the Center
Convert two switches to a dual stack, and add outlet - possible here?
Maximum likelihood parameters deviate from posterior distributions
Auto Select colour Swatch when configurable product page loads
Auto select option based on category ?Configurable Swatches on Listing Page: Show Multiple Color AttributesConfigurable product with multiple color variationsChange More product images on color swatch selectConfigurable swatch not working properlyIs there a way to automatically select the first colour swatch on the product page?Is there any way that one swatch is selected by default (magento configurable swatches)How to change image size on category page when click swatchHow to Auto Select The Color as Swatch Option for Products with Only One Color (on Magento 2.1 Product View)?Hide Configurable product images from details page when color swatch is selected
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a configurable product with one colour and different sizes, both these are set as required fields.
I've set the colour attribute as not required, but then it wont show up when I create a configurable product and wont show on the product page.
How do I get the colour swatch to be automatically selected when the product page loads?
magento-1.9 configurable-product javascript color-swatches
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a configurable product with one colour and different sizes, both these are set as required fields.
I've set the colour attribute as not required, but then it wont show up when I create a configurable product and wont show on the product page.
How do I get the colour swatch to be automatically selected when the product page loads?
magento-1.9 configurable-product javascript color-swatches
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
What is your question?
– Robbie Averill
Jun 27 '16 at 12:05
How do I get the colour swatch to be automatically selected when the product page loads?
– user2240778
Jun 27 '16 at 13:21
add a comment |
I have a configurable product with one colour and different sizes, both these are set as required fields.
I've set the colour attribute as not required, but then it wont show up when I create a configurable product and wont show on the product page.
How do I get the colour swatch to be automatically selected when the product page loads?
magento-1.9 configurable-product javascript color-swatches
I have a configurable product with one colour and different sizes, both these are set as required fields.
I've set the colour attribute as not required, but then it wont show up when I create a configurable product and wont show on the product page.
How do I get the colour swatch to be automatically selected when the product page loads?
magento-1.9 configurable-product javascript color-swatches
magento-1.9 configurable-product javascript color-swatches
edited Jun 27 '16 at 13:21
user2240778
asked Jun 27 '16 at 12:03
user2240778user2240778
298315
298315
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
What is your question?
– Robbie Averill
Jun 27 '16 at 12:05
How do I get the colour swatch to be automatically selected when the product page loads?
– user2240778
Jun 27 '16 at 13:21
add a comment |
What is your question?
– Robbie Averill
Jun 27 '16 at 12:05
How do I get the colour swatch to be automatically selected when the product page loads?
– user2240778
Jun 27 '16 at 13:21
What is your question?
– Robbie Averill
Jun 27 '16 at 12:05
What is your question?
– Robbie Averill
Jun 27 '16 at 12:05
How do I get the colour swatch to be automatically selected when the product page loads?
– user2240778
Jun 27 '16 at 13:21
How do I get the colour swatch to be automatically selected when the product page loads?
– user2240778
Jun 27 '16 at 13:21
add a comment |
2 Answers
2
active
oldest
votes
Open this file from appdesignfrontend[your package][your theme]templatecatalogproductviewtypeoptionsconfigurable.phtml
Now add the below javascript code :-
function fireEvent(element,event)
if (document.createEventObject)
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
else
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
Event.observe(window, 'load', function()
spConfig.settings[0].selectedIndex = 1;
obj = spConfig.settings[0]; // this grabs the first select item
Event.observe(obj,'change',function());
fireEvent(obj,'change'); // this simulates selecting the first option, which triggers
spConfig.settings[1].selectedIndex = 1; // this selects the first option of the second attribute drop menu
);
after this code :-
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
and flush magento cache and check.
add a comment |
If you want to go with jQuery in magento
so you can trigger with click on color swatches on document ready
jQuery("document").ready(function()
setTimeout(function()
jQuery("#configurable_swatch li:last-child a span").trigger('click');
,100);
);
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f122954%2fauto-select-colour-swatch-when-configurable-product-page-loads%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Open this file from appdesignfrontend[your package][your theme]templatecatalogproductviewtypeoptionsconfigurable.phtml
Now add the below javascript code :-
function fireEvent(element,event)
if (document.createEventObject)
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
else
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
Event.observe(window, 'load', function()
spConfig.settings[0].selectedIndex = 1;
obj = spConfig.settings[0]; // this grabs the first select item
Event.observe(obj,'change',function());
fireEvent(obj,'change'); // this simulates selecting the first option, which triggers
spConfig.settings[1].selectedIndex = 1; // this selects the first option of the second attribute drop menu
);
after this code :-
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
and flush magento cache and check.
add a comment |
Open this file from appdesignfrontend[your package][your theme]templatecatalogproductviewtypeoptionsconfigurable.phtml
Now add the below javascript code :-
function fireEvent(element,event)
if (document.createEventObject)
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
else
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
Event.observe(window, 'load', function()
spConfig.settings[0].selectedIndex = 1;
obj = spConfig.settings[0]; // this grabs the first select item
Event.observe(obj,'change',function());
fireEvent(obj,'change'); // this simulates selecting the first option, which triggers
spConfig.settings[1].selectedIndex = 1; // this selects the first option of the second attribute drop menu
);
after this code :-
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
and flush magento cache and check.
add a comment |
Open this file from appdesignfrontend[your package][your theme]templatecatalogproductviewtypeoptionsconfigurable.phtml
Now add the below javascript code :-
function fireEvent(element,event)
if (document.createEventObject)
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
else
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
Event.observe(window, 'load', function()
spConfig.settings[0].selectedIndex = 1;
obj = spConfig.settings[0]; // this grabs the first select item
Event.observe(obj,'change',function());
fireEvent(obj,'change'); // this simulates selecting the first option, which triggers
spConfig.settings[1].selectedIndex = 1; // this selects the first option of the second attribute drop menu
);
after this code :-
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
and flush magento cache and check.
Open this file from appdesignfrontend[your package][your theme]templatecatalogproductviewtypeoptionsconfigurable.phtml
Now add the below javascript code :-
function fireEvent(element,event)
if (document.createEventObject)
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
else
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
Event.observe(window, 'load', function()
spConfig.settings[0].selectedIndex = 1;
obj = spConfig.settings[0]; // this grabs the first select item
Event.observe(obj,'change',function());
fireEvent(obj,'change'); // this simulates selecting the first option, which triggers
spConfig.settings[1].selectedIndex = 1; // this selects the first option of the second attribute drop menu
);
after this code :-
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
and flush magento cache and check.
answered May 10 '17 at 13:28
Jaimin PatelJaimin Patel
255
255
add a comment |
add a comment |
If you want to go with jQuery in magento
so you can trigger with click on color swatches on document ready
jQuery("document").ready(function()
setTimeout(function()
jQuery("#configurable_swatch li:last-child a span").trigger('click');
,100);
);
add a comment |
If you want to go with jQuery in magento
so you can trigger with click on color swatches on document ready
jQuery("document").ready(function()
setTimeout(function()
jQuery("#configurable_swatch li:last-child a span").trigger('click');
,100);
);
add a comment |
If you want to go with jQuery in magento
so you can trigger with click on color swatches on document ready
jQuery("document").ready(function()
setTimeout(function()
jQuery("#configurable_swatch li:last-child a span").trigger('click');
,100);
);
If you want to go with jQuery in magento
so you can trigger with click on color swatches on document ready
jQuery("document").ready(function()
setTimeout(function()
jQuery("#configurable_swatch li:last-child a span").trigger('click');
,100);
);
answered Nov 1 '18 at 13:02
Pradip GarcharPradip Garchar
12114
12114
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f122954%2fauto-select-colour-swatch-when-configurable-product-page-loads%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is your question?
– Robbie Averill
Jun 27 '16 at 12:05
How do I get the colour swatch to be automatically selected when the product page loads?
– user2240778
Jun 27 '16 at 13:21