checking items in cart
- clevername
- Lieutenant (LT)
- Posts: 54
- Joined: Tue Jan 11, 2011 8:54 am
checking items in cart
I am designing something to allow a link if there are items in the cart. I am wondering, is there an easy way to check if there are at least 1 item in there? Maybe NVelocity in the scriplet?
Re: checking items in cart
Try this in your scriptlet
Code: Select all
#if($Token.Instance.User.Basket.Items.Count > 0)
Your Link here
#end
- clevername
- Lieutenant (LT)
- Posts: 54
- Joined: Tue Jan 11, 2011 8:54 am
Re: checking items in cart
The thing I am designing is just a different way to show the minibasket. I, since Iposted this question, redid the Minibasket and an alternate control. Do you think it would be better to do it using the conlib? or using the scriplet?
The alternate control, I found only changes the display for the cart, either its hidden or its visible, but it does not stop it from loading all of the conlib parts. And I know using the NVelocity is not good practice because it will slow the site down, which do you think would be a little faster or better? because I know if I use that NVelocity it will only show what passes the IF/ELSE
or
But remember this one will load both the "MiniBasketQuickCart" AND the "EmptyCartLinks.ascx" regardless if anything if is the cart.
The alternate control, I found only changes the display for the cart, either its hidden or its visible, but it does not stop it from loading all of the conlib parts. And I know using the NVelocity is not good practice because it will slow the site down, which do you think would be a little faster or better? because I know if I use that NVelocity it will only show what passes the IF/ELSE
Code: Select all
#if($Token.Instance.User.Basket.Items.Count > 0)
[[ConLib:Custom/MiniBasketQuickCart]]
#else
<div>link link content content</div>
#end
Code: Select all
[[ConLib:Custom/MiniBasketPopUp AlternateControl="EmptyCartLinks.ascx"]]
- clevername
- Lieutenant (LT)
- Posts: 54
- Joined: Tue Jan 11, 2011 8:54 am
Re: checking items in cart
actually this doesn't work
is there a variable dictionary somewhere for Nvelocity Variables available in AbleCommerce?
Code: Select all
#if($Token.Instance.User.Basket.Items.Count > 0)
Re: checking items in cart
Try it like this
Have a look at this topic for NVelocity parameters http://wiki.ablecommerce.com/index.php/ ... scriptlets
Code: Select all
#if($User.Basket.Items.Count > 0)
- clevername
- Lieutenant (LT)
- Posts: 54
- Joined: Tue Jan 11, 2011 8:54 am
Re: checking items in cart
Yea I have been to that page plenty of times in search of a more indepth look at the Nvelocity variables but those are really just the top level parts. The only way I could drill down the correct variable string would be trail and error and I would hope there is a better way.
- clevername
- Lieutenant (LT)
- Posts: 54
- Joined: Tue Jan 11, 2011 8:54 am
Re: checking items in cart
That Nvelocity was correct, and thank you for helping me with that. However, it will not work as effciently as the alternate content because that conlib is built in ajax and will automatically switch it to that alternate content without having to refresh the page.