How to display color name when swatch is chosen
1 Attachment(s)
I already owned the color swatch mod for xcart 5, however I have a question, how do I display color name when swatch is chosen so that it will show next to the "color" attribute? See attachment for sample
When it is in mobile, people cannot see the selected color from the "popover" . Do I change the CSS file or the js script? Any suggestions? Thanks |
Re: How to display color name when swatch is chosen
You could use 'Custom JS', perfectly suits this task.
|
Re: How to display color name when swatch is chosen
Quote:
I put this in the colorswatch/controller.js jQuery(function(){ $(".color-swatches input[type=radio]:").change(function(){ jQuery('.active-color').text($(".color-swatches input[name^="attribute_values"]:checked").val()); }) }) the following in colorswatch/body.twig <span class ="active-color"></label> |
Re: How to display color name when swatch is chosen
1 Attachment(s)
Or if there's any other solutions , basically user complains about not able to see the color option when using mobile. See the attached pic.
If we can use tooltips or if there's a way to enlarge the "caption box"? I cannot find anything from the css file and the xcart techsupport will not help without any payment. Thanks. |
Re: How to display color name when swatch is chosen
1 Attachment(s)
Ok, I've done the following (the better way than JS).
1. Added the following method to XLite/Module/QSL/ColorSwatches/View/Product/AttributeValue/Customer/Select.php PHP Code:
Code:
<h6> {{ this.getSwatchName(v)|raw }} </h6> just after this line Code:
</li> And I got the following (screenshot attached). You can play with CSS a bit to make it look different, but the idea is here. |
Re: How to display color name when swatch is chosen
Thank you very much for your help. The <h6> tag should be right after
{{ this.getModifierTitle(v)|raw }} |
Re: How to display color name when swatch is chosen
Quote:
That's correct. But please remember that you should apply any changes to PHP code as a module, otherwise it will be overwritten during the next update of the cart (or the module in this particular case). What I posted is just an example. |
All times are GMT -8. The time now is 09:13 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.