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

Thumbnails in shopping cart (0.81)


Go to End


2 Posts   1379 Views

Avatar
MCK

Community Member, 18 Posts

27 January 2011 at 10:08am

I am using ecommerce 0.81 and I would like to use thumbnails of the products to be purchased in the shopping cart. I have tried many ideas but can't seem to be able to reference the product thumbnail in Cart.ss. For example:

<% if Image.ContentImage %>
<img class="productImage" src="$Image.ContentImage.URL" alt="<% sprintf(_t("IMAGE","%s image"),$Title) %>" />
<% else %>
<div class="noimage">$CartID.$Image.Thumbnail </div>
<% end_if %>

is false and gives me "Cart_ProductVariation_OrderItem_DB_69"

Also, is it possible to have an unordered list for Variations of a Product. In the CMS if I enter three Variations, "Small" "Medium" and "Large", it gets sorted in the CMS in alphabetical order (Large --> Small) whereas I would like it to remain in the order I entered (Small --> Large). I know I can put numbers before the text as a kludge but is there a variable setting I can use to make it more elegant?

Avatar
eceers

Community Member, 24 Posts

27 January 2011 at 5:00pm

Not sure about your variations question, this is how I got thumbnails to work in 0.6.1

I added the following function to the Product_OrderItem class in Products.php

class Product_OrderItem extends OrderItem {
	...
	function Image() {
		return $this->Product()->Image();
	}
	...
}

Its highly likely not the correct implementation of the code as it wont stand up to having the ecommerce files updated by future releases.