Page 1 of 1
Updating Minicart
Posted: Wed Feb 19, 2014 11:21 pm
by hecticben
Hey guys,
Here's my shop:
http://www.make-lace-with-us.com/shop/i ... uct_id=186
When you add basket it comes up saying it's been added, but it doesn't automatically show in the mini cart till you reload the page... is there a way around this?
Thanks,
Ben
Re: Updating Minicart
Posted: Thu Feb 20, 2014 12:12 am
by ShaneTFletcher
I had a similar and having an issue to get around it.
Basically, you have edited the cart.tpl in module/cart.tpl. Changing the id - cart-total will stop the cart from refreshing. However, if you add the cart-total back in, you will lose your style.
But anywho, that's how you fix it.
Re: Updating Minicart
Posted: Thu Feb 20, 2014 12:32 am
by hecticben
Ah damn, so basically no way to fix it lol
Re: Updating Minicart
Posted: Thu Feb 20, 2014 12:35 am
by ShaneTFletcher
Oh, there's a fix.
See my post -
http://forum.opencart.com/viewtopic.php?f=20&t=120181
Basically, I can move the total around but I can't change the text styles, nor remove the hyperlink.
I just simply made a div called cart-text and used that to move the total around.
Re: Updating Minicart
Posted: Thu Feb 20, 2014 12:39 am
by hecticben
I'm confused as to what I'm missing/supposed to do? I already have the cart total in there..?
My current cart.tpl looks like this:
Code: Select all
<?php if ($products || $vouchers) { ?>
<table class="cart">
<?php foreach ($products as $product) { ?>
<tr>
<td class="image">
<?php if ($product['thumb']) { ?>
<a href="<?php echo $product['href']; ?>">
<img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" />
</a>
<?php } ?>
</td>
<td class="name">
<a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
<div>
<?php foreach ($product['option'] as $option) { ?>
- <small><?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
<br />
<?php } ?>
</div>
</td>
<td class="quantity">
x <?php echo $product['quantity']; ?>
</td>
<td class="total">
<?php echo $product['total']; ?>
</td>
<td class="remove">
<img src="catalog/view/theme/default/image/close.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="removeCart('<?php echo $product['key']; ?>');" />
</td>
</tr>
<?php } ?>
<?php foreach ($vouchers as $voucher) { ?>
<tr>
<td class="image"></td>
<td class="name"><?php echo $voucher['description']; ?></td>
<td class="quantity">x 1</td>
<td class="total"><?php echo $voucher['amount']; ?></td>
<td class="remove">
<img src="catalog/view/theme/default/image/close.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="removeVoucher('<?php echo $voucher['key']; ?>');" />
</td>
</tr>
<?php } ?>
</table>
<table class="total">
<?php foreach ($totals as $total) { ?>
<tr>
<td align="right">
<b><?php echo $total['title']; ?></b>
</td>
<td align="right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
</table>
<div class="checkout">
<a href="<?php echo $checkout; ?>" class="button"><?php echo $button_checkout; ?></a>
</div>
<?php } else { ?>
<div class="empty"><?php echo $text_empty; ?></div>
<?php } ?>
Re: Updating Minicart
Posted: Thu Feb 20, 2014 12:43 am
by ShaneTFletcher
Here is my cart.tpl -
Code: Select all
<div id="cartwrapper">
<div id="cart">
<div id="cart-text">
<a href="<?php echo $cart; ?>"><span id="cart-total"><?php echo $text_items; ?></span></a></div>
</div>
<a href="<?php echo $cart; ?>"><img src="catalog/view/theme/theme/image/shopping_cart.png" height="50" style="position: relative; top: -16px; float: right;" /></a>
</div>
</div>
You need to keep the <span id="cart-total">, this edited the total won't update itself.
As you can see with mine, I have added 2 wrappers, 1 where the cart text and picture is placed and the other for the text.
Now, the issue i've got is on my post, which I provided in my last reply.
So basically, you need to add <span id="cart-total"> into your code again as you've deleted it.
Re: Updating Minicart
Posted: Thu Feb 20, 2014 12:56 am
by hecticben
Sorry that was the wrong code I pasted..
In my template > module > cart.tpl it's code is simply:
Code: Select all
<div id="cart">
<div class="heading">
<a class="shopLink" href="<?php echo $cart; ?>"><span id="cart-total"><?php echo $text_items; ?></span></a>
</div>
</div>
which as you can see has the span you were talking about...
Re: Updating Minicart
Posted: Thu Feb 20, 2014 1:18 am
by ShaneTFletcher
Remove the shopLink to see if that works. Maybe that's somehow stopping the refresh. Of course its not going to look pretty but just for testing reasons.
Re: Updating Minicart
Posted: Thu Feb 20, 2014 1:21 am
by hecticben
Nop, made no difference :/