Skip to main content

Add custom icon before add to cart text

More
12 years 10 months ago #131171 by condorazul
I would like to add the fontawesome icon-shopping-cart before add to cart text using for example <span class="icon-shopping-cart"></span> but i do not know where to insert it.
In wich view and where should i insert the code, thank you

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #131195 by Mohamed Thelji
Hi,
You'll just have to :
- Go to "Hikashop->Display->Views"
- Edit the "Cart" file of the "Product" view of your front-end template
- Add your image at the beginning of the file :
Code:
<img src="YourImgLink" alt="cart" height="42" width="42">

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago - 12 years 10 months ago #131220 by condorazul
I´ve already tried this, first line defined('_JEXEC') or die('Restricted access');
?><span class="icon-cart"></span>
and the button shows in the cart or mini cart
where i want it to be displayed is in the buttom add to cart in the product listing
Last edit: 12 years 10 months ago by condorazul.

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago - 12 years 10 months ago #131229 by Mohamed Thelji
Ok, so you'll just have to edit the "add_to_cart_listing" file of your "product" view of your front-end template via "Hikashop->Display->Views", and add you image at the end of the file.
Last edit: 12 years 10 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #131240 by condorazul
in that case the icon is placed just after the button add to cart and i want it just before the text add to cart

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #131278 by Xavier
Hi,

So you have to place the desired code earlier in that view to have if before the button ;)

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #131343 by condorazul
I´m unable to find it all is php generated and dont have any idea in how to inser a <span> before the add to cart text and where it is.

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #131473 by nicolas
I don't think that you should edit any code for that.
Simply ass a translation override like that:
ADD_TO_CART="<span class='icon-cart'></span>Add to cart"

www.hikashop.com/download/languages.html#modify

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #131485 by condorazul
That was the first thing ive tried but perhaps i wrote it wrong going to try again. Thanks

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #134341 by condorazul
it does not work, it displays <span class="uk-icon-cart"></span>

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #134379 by nicolas
Please make sure that you use simple quotes for the attributes of your HTML like I did in my example as double quotes are reserved for translation text delimitation.

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #134387 by condorazul
Im sure i copy paste you code what i wrote before it is what the page displays

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #134429 by nicolas
Please provide a screenshot of your modification and a link to the page with the button.

Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #135042 by condorazul
here are the screenshots



Please Log in or Create an account to join the conversation.

More
12 years 10 months ago #135153 by nicolas
It's probably because you're using a button and not a link for the buttons.
So if you change the "Button display method" option in the configuration, it should work fine.

Otherwise, you would have to change the line:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
like that:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min,'icon-cart');
in the file "quantity" via the menu Display>views in order to add the class directly to the submit button.

Please Log in or Create an account to join the conversation.

More
11 years 5 months ago #198847 by Jethro
Hi, I would like to bring up this subject again...

I have followed the instructions above... I want to add the font-awesome icon: <i class="fa fa-plus-square"></i> to before the "add to cart" button.

I added <i class="fa fa-plus-square"></i> to the language file to no avail.

Then I edited the view "quantity" changing:

echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);

To...

echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min,'fa-plus-square');
in the file "quantity" via the menu Display>views in order to add the class directly to the submit button.

And this did not help either.

Any thoughts?

Please Log in or Create an account to join the conversation.

More
11 years 5 months ago #198859 by Xavier
Hi,

The second solution can't work because the class must be between "<i> ... </i>" html tags.

Then for the translation override, is the code displayed in the view ?
If it is, so it must maybe not be placed in a <a> tag, or you don't have the files displaying the icon loaded on your website.

Please Log in or Create an account to join the conversation.

Time to create page: 0.325 seconds
Powered by Kunena Forum