Skip to main content

is it possible change "add to cart" to "added"

More
4 years 7 months ago - 4 years 7 months ago #339788 by sadaf3d
hi
I want to change "add to cart" text after user click on that button , means after added to cart. is it possible?
"add to cart" => "added"
how to do it? i can write some code and please advise me if this is higher than normal user support.
thank's alot
(excuse me i send this post to incorrect topic and can not edit)
Last edit: 4 years 7 months ago by sadaf3d.

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

More
4 years 7 months ago - 4 years 7 months ago #339790 by nicolas
Hi,

I think (not tested) you can do that with such javascript:
Code:
window.Oby.registerAjax(["cart.updated"],function(params){ if(params.el) { params.el.innerHTML = 'added'; } });
Last edit: 4 years 7 months ago by nicolas.
The following user(s) said Thank You: sadaf3d

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

More
4 years 5 months ago #340801 by sadaf3d
Is it possible when the page loaded and user has that product in his card from previous then show added label?

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

More
4 years 5 months ago #340808 by nicolas
Hi,

It's possible but more complex.
You need to customize the file product / listing_add_to_cart_ajax and the file product / quantity.php which display the add to cart button on the listings and on the product page.
There, you have this code for the text of the add to cart button:
Code:
$content = JText::_('ADD_TO_CART');
So just after that line, you can add something like that:
Code:
$cartClass = hikashop_get('class.cart'); $cart = $cartClass->getFullCart(); if(!empty($cart->products)) { foreach($cart->products as $p) { if($p->product_code == $this->row->product_code) { $content .= ' added'; } } }
The following user(s) said Thank You: sadaf3d

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

Time to create page: 0.212 seconds
Powered by Kunena Forum