Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding font-awesome icons to category sidebar

 
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-02-2018, 07:25 AM
 
mcupka mcupka is offline
 

eXpert
  
Join Date: Jan 2013
Posts: 204
 

Default Adding font-awesome icons to category sidebar & labels

Hello,

What would be the best way to add font-awesome icons to the names of my category pages that are listed in the sidebar? Would this require making a custom module? For example, say I had a category 'Settings'. I'd much rather have a gear icon before the actual wording.

Using 5.3.4.7 on Standard theme.
  #2  
Old 05-04-2018, 09:06 AM
 
mcupka mcupka is offline
 

eXpert
  
Join Date: Jan 2013
Posts: 204
 

Default Re: Adding font-awesome icons to category sidebar & labels

This is also a problem with the Label editor.

Please see my screenshot attached. It works fine while in the editor, then as soon as you X out and refresh the page, it renders incorrectly.

https://i.imgur.com/jCaERG4.jpg
  #3  
Old 05-07-2018, 02:43 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Adding font-awesome icons to category sidebar & labels

Quote:
Originally Posted by mcupka
What would be the best way to add font-awesome icons to the names of my category pages that are listed in the sidebar? Would this require making a custom module? For example, say I had a category 'Settings'. I'd much rather have a gear icon before the actual wording.

Using 5.3.4.7 on Standard theme.

I believe FontAwesome is already enabled in the standard theme, so you can use the following markup to add FontAwesome icons (change the "fa-arrow-right" class to yours):
HTML Code:
<i class="fa fa-arrow-right"></i>


Quote:
Originally Posted by mcupka
This is also a problem with the Label editor.
Please see my screenshot attached. It works fine while in the editor, then as soon as you X out and refresh the page, it renders incorrectly.
https://i.imgur.com/jCaERG4.jpg

As far as I see the template that displays the block does not accept HTML tags:
skins/customer/modules/XC/NewsletterSubscriptions/form/parts/form.twig
HTML Code:
... <div class="subscription-form-label"> {{ this.getFormLabel() }} </div> ...

However, you can enable the webmaster mode and edit the template as follows:
HTML Code:
... <div class="subscription-form-label"> {{ this.getFormLabel()|raw }} </div> ...
__________________
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

Last edited by qualiteam : 05-07-2018 at 02:49 AM.
  #4  
Old 05-07-2018, 05:47 AM
 
mcupka mcupka is offline
 

eXpert
  
Join Date: Jan 2013
Posts: 204
 

Default Re: Adding font-awesome icons to category sidebar & labels

Quote:
Originally Posted by qualiteam
I believe FontAwesome is already enabled in the standard theme, so you can use the following markup to add FontAwesome icons (change the "fa-arrow-right" class to yours):
HTML Code:
<i class="fa fa-arrow-right"></i>
I was able to get the category list to work by editing the HTML of {{ this._category.name }} using |raw. Now I just I'm going to have to find a way to create a variable and add a box to each category page under the Title such as 'Icon' or something.



Quote:
Originally Posted by qualiteam
As far as I see the template that displays the block does not accept HTML tags:
skins/customer/modules/XC/NewsletterSubscriptions/form/parts/form.twig
HTML Code:
... <div class="subscription-form-label"> {{ this.getFormLabel() }} </div> ...

However, you can enable the webmaster mode and edit the template as follows:
HTML Code:
... <div class="subscription-form-label"> {{ this.getFormLabel()|raw }} </div> ...
Thanks, now it works properly.
  #5  
Old 05-07-2018, 06:15 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Adding font-awesome icons to category sidebar & labels

Quote:
Originally Posted by mcupka
Now I just I'm going to have to find a way to create a variable and add a box to each category page under the Title such as 'Icon' or something.

This requires creating a custom module.
First, you should add a new field to the category model class. Model classes are discussed here:
https://devs.x-cart.com/basics/understanding_models.html
But you don't create a new module. Instead, you add a new field to an existing model class. To do so you should not just "extend" and existing class, but "decorate" it by adding "implements \XLite\Base\IDecorator".
You may also check an article explaining how to add an extra field to the existing OrderItem model class.

Adding the field to the UI may tricky, though.
__________________
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
  #6  
Old 05-09-2018, 11:53 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Adding font-awesome icons to category sidebar

I've moved the question about adding a new category field into its own forum thread:
https://forum.x-cart.com/showthread.php?t=76178
__________________
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
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:52 AM.

   

 
X-Cart forums © 2001-2020