Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Swipestripe questions


Go to End


4 Posts   3385 Views

Avatar
wilsonStaff

Community Member, 143 Posts

22 February 2013 at 4:44pm

Edited: 22/02/2013 4:48pm

Hi to all, i am building a site using SS 3.0.3 along Swipestripe. I have two questions. Ive serached to no avail.

1) HOW TO RETRIEVE THE NUMBER OF ITEMS IN CART

This line

<a href="cart" title="Cart | Panier d'chat"/>CART | PANIER D'ACHAT | <span>$WhichVariable????</span> ITEMS</a>

sits right corner of site. All i want to do is show the number of items in cart. If none, display 0 (zero).

2) HOW TO HAVE USER SWAP CURRENCY

Demo shows a pop-up menu where users can swap currency. Any recipie somewhere?

Thanks!

Avatar
helenclarko

Community Member, 166 Posts

27 February 2013 at 2:19pm

Hi Wilsonstaff,

I'll try and get the ball rolling on this discussion.
Hopefully I can help to push you in the right direction.

I'm not sure there is a direct answer for question number 1, as I don't think there is a total items variable available for you to use.
you may need to write something that takes advantage of the quantity variable, adding them together to give you a total.

to answer question 2, you will need to open the CMS and use the shop tab.
here's a few link to help you out:
http://swipestripe.com/dev/docs/swipestripe/en/Extensions/Currency
http://en.wikipedia.org/wiki/ISO_4217#Active_codes

thanks,
-helenclarko

Avatar
frankmullenger

Forum Moderator, 53 Posts

5 March 2013 at 10:26am

Sorry I missed this question although I think we've sorted it out via email, for anyone else searching..

1)
The Cart extension class is applied to Page_Controller so you should be able to access $Cart on all your pages (in this case some pages were directly inheriting from MultiLingualPage iirc which meant $Cart was not accessible on those page types). $Cart returns an object of type Order so $Cart.Items and $Cart.Products can be used in the template.

<ul class="shop-links">
  <% if CurrentMember %>
    <li><a href="$CartLink(Logout)" class="rev">log out</a></li>
    <li><a href="$CartLink(Account)" class="rev">your account</a></li>
  <% else %>
    <li><a href="$CartLink(Login)" class="rev">log in</a></li>
  <% end_if %>
 
  <li><a href="$CartLink">
    <i class="icon-shopping-cart icon-white"></i>
    $Cart.Products.Count
  </a></li>
</ul>

2)
Multiple currency support is a seperate module/extension for SwipeStripe: http://swipestripe.com/products/extensions/currency/. There is an extension class that is also applied to Page_Controller so to get the currency select form you just need to add: $CurrencyForm to a template.

The $CurrencyForm uses a select field that submits the form using javascript when the selected option changes.

Avatar
Tama

Community Member, 138 Posts

3 April 2014 at 9:51am

Hi Frank

Is there a similar short code we can use to display the total value of the cart contents?

Cheers
Tama