| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Last Item Added in mini-cart | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() Hi,
Is there any way of showing only the last product added in the mini-cart, rather than all items added? Like a lot of x-cart users, I've got my minicart in the header, to the right of my logo. Obviously, there's not much vertical space, so I need a small box displaying the last added item, along with whatever the minicart normally displays; total, items etc. Any help with this would be much appreciated! n00bert |
|||||||||
#2
|
|||||||
|
|||||||
![]() in minicart.php add the code below before "?>"
Code:
...however when you add a similar product it will not get updated, it requires a bit more code |
|||||||
#3
|
|||||||||
|
|||||||||
![]() Hi inebriate,
Thanks for your quick reply. I need to know one more thing though. ![]() In minicart.tpl, there is a {foreach} which I'm guessing gets the results of an array. Is there any way of reversing those results ? I'd like to display all products added to the minicart in <td>s, but in reverse order, so that the last added item's details would appear in the top most <td>, i.e. first in the HTML source. Again, any help or ideas are much appreciated! n00bert |
|||||||||
#4
|
|||||||||
|
|||||||||
![]() To update, I googled the php function array_flip(), which apparently does what I need. However, I have no idea how to use this...
|
|||||||||
#5
|
|||||||
|
|||||||
![]() i take it that you are using the minicart mod in the completed mod section...what you want is array_reverse instead of array_flip
in minicart.php, replace Code:
Code:
|
|||||||
#6
|
|||||||||
|
|||||||||
![]() Perfect! Thank you so much inebriate. Works like a charm!
|
|||||||||
#7
|
|||||||||
|
|||||||||
![]() OH NO!!
It worked for about 5 minutes, now I get the following smarty error: Warning: array_reverse() [function.array-reverse]: The argument should be an array in /home/username/public_html/minicart.php on line 65 any ideas how to get round this? |
|||||||||
#8
|
|||||||||
|
|||||||||
![]() I was checking out the smarty manual for array_reverse. I applied the sample code to the {foreach} in minicart.tpl.
I changed this line: Code:
to this: Code:
Seems to be working fine. Is there any disadvantage to using smarty rather than PHP? Is it more server-intensive? thanks, n00bert |
|||||||||
|
|||
X-Cart forums © 2001-2020
|