View Single Post
  #5  
Old 01-05-2019, 12:22 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How to display color name when swatch is chosen

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:
protected function getSwatchName(\XLite\Model\AttributeValue\AttributeValueSelect $value)
    {
        return 
$this->getOptionTitle($value);
      } 
2. In template customer/modules/QSL/ColorSwatches/product/attribute_value/select/body.twig added the following line

Code:
<h6> {{ this.getSwatchName(v)|raw }} </h6>


just after this line


Code:
</li> {% endfor %}


And I got the following (screenshot attached).
You can play with CSS a bit to make it look different, but the idea is here.
Attached Thumbnails
Click image for larger version

Name:	swatches.png
Views:	396
Size:	81.4 KB
ID:	5278  
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote