checking items in cart

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

checking items in cart

Post by clevername » Mon Mar 21, 2011 1:29 pm

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?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: checking items in cart

Post by mazhar » Tue Mar 22, 2011 6:44 am

Try this in your scriptlet

Code: Select all

#if($Token.Instance.User.Basket.Items.Count > 0)
Your Link here
#end

User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Re: checking items in cart

Post by clevername » Tue Mar 22, 2011 10:33 am

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

Code: Select all

#if($Token.Instance.User.Basket.Items.Count > 0)
       [[ConLib:Custom/MiniBasketQuickCart]]
#else
       <div>link link content content</div>
#end
or

Code: Select all

[[ConLib:Custom/MiniBasketPopUp AlternateControl="EmptyCartLinks.ascx"]]
But remember this one will load both the "MiniBasketQuickCart" AND the "EmptyCartLinks.ascx" regardless if anything if is the cart.

User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Re: checking items in cart

Post by clevername » Tue Mar 22, 2011 11:08 am

actually this doesn't work

Code: Select all

#if($Token.Instance.User.Basket.Items.Count > 0)
is there a variable dictionary somewhere for Nvelocity Variables available in AbleCommerce?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: checking items in cart

Post by mazhar » Wed Mar 23, 2011 3:23 am

Try it like this

Code: Select all

#if($User.Basket.Items.Count > 0)
Have a look at this topic for NVelocity parameters http://wiki.ablecommerce.com/index.php/ ... scriptlets

User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Re: checking items in cart

Post by clevername » Wed Mar 23, 2011 8:24 am

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.

User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Re: checking items in cart

Post by clevername » Wed Mar 23, 2011 8:30 am

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.

Post Reply