Post by dani888 » Fri Apr 27, 2018 9:43 pm

Hello everyone
How do I make this change for the default theme
Opencart version 3.0.2.0
When the cursor is placed on the cart, the shopping cart appears without having to click
tooltip for cart
When the basket is empty it appears to be empty if I put the mouse on the shopping cart.
Thank you

Attachments

image.jpg

image.jpg (129.21 KiB) Viewed 1753 times


Active Member

Posts

Joined
Wed Feb 14, 2018 1:47 am

Post by IP_CAM » Sat Apr 28, 2018 1:40 am

It mostly looks like this by Default, wherever this Function exists:

Code: Select all

<button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
And it looks like this, with a hard-coded ADD TO CART implanted in the TOOLTYP Line, added to this:

Code: Select all

<button type="button" data-toggle="tooltip" title="ADD TO CART" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
And it would look about like this, if a Language Variable $button_add_to_cart; would be defined/declared,
wich is unfortunately NOT the OC 2+ Default Case.

Code: Select all

<button type="button" data-toggle="tooltip" title="<?php echo $button_add_to_cart; ?>" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
Good Luck! ;)
Ernie
---
Image
---

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by xxvirusxx » Sat Apr 28, 2018 2:31 am

I think he want drop down cart on hover not on click.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by sw!tch » Sat Apr 28, 2018 3:28 am

You want the cart to show on hover instead of click? If so, you can easily do this with CSS or JS.

JS below (untested)

Code: Select all

<script>
// @credit to https://codepen.io/bsngr/pen/frDqh
    $(function () {
        $('#cart').hover(function () {
            $(this).find('.dropdown-menu').stop(true, true).delay(100).fadeIn(150);
        }, function () {
            $(this).find('.dropdown-menu').stop(true, true).delay(100).fadeOut(150);
        });
    });
</script>
Post in the Commercial Support if you want something more customized.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by dani888 » Sat Apr 28, 2018 1:31 pm

Hello
Thanks for the tooltip code for add to cart.
I want code for drop down cart on hover.
Now i do not know how to do css or javascript.
Thank you

Active Member

Posts

Joined
Wed Feb 14, 2018 1:47 am

Post by sw!tch » Sun Apr 29, 2018 2:19 am

dani888 wrote:
Sat Apr 28, 2018 1:31 pm
Hello
Thanks for the tooltip code for add to cart.
I want code for drop down cart on hover.
Now i do not know how to do css or javascript.
Thank you
For the hover - I pasted the JS code above I just quickly tested that on a default OC 3.02 install and works fine. If you changed the #cart Element or are running a custom theme then you need to adapt accordingly.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by dani888 » Sun Apr 29, 2018 3:03 pm

Hello
Thanks for the code but I do not know how to add to the default theme
How to add this code
<Script>
// @ credit to https: //codepen.io/bsngr/pen/frDqh ........

Active Member

Posts

Joined
Wed Feb 14, 2018 1:47 am

Post by cyclops12 » Sun Apr 29, 2018 3:37 pm

Just add the above mentioned code into the top of catalog/view/theme/YOUR_THEME/template/common/cart.twig

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by dani888 » Sun Apr 29, 2018 4:17 pm

Hello
It works very well
Thank you

Active Member

Posts

Joined
Wed Feb 14, 2018 1:47 am
Who is online

Users browsing this forum: dparakhiya, Semrush [Bot] and 448 guests