2084 Posts in 1005 Topics by 453 members
|Go to End|
17 August 2010 at 10:33am
Are there any plans at all on making a module for easily addable multiple images for ecommerce?
Something like what trademe.co.nz have would be amazingly beneficial.
I would but I don't have anywhere near enough skills to do something like this..
18 August 2010 at 2:23pm
Not sure what the plans are for the ecommerce module and this. But if you look around you'll find some useful posts on DataObjectManager and the gallery.
I got multiple images working on a site I haven't yet made live yet. I like to make a seperate DataObject to handle the images, so I can include captions and fancy stuff. But it might be easier for you to not worry about that to start with.
It'll take some PHP coding on your part, but there is plenty of help around.
If you look in ecommerce/code/products/Product.php on line 28
public static $has_one = array(
'Image' => 'Product_Image'
You'll want many so, change the "has_many" array to include many product images.
public static $has_many = array(
'Variations' => 'ProductVariation',
'Images' => 'Product_Image'
Then you'll need to add a few lines to the getCMSFields function to add a form for you to add mulitple images. This is where I find the DataObjectManager module REALLY useful. If you download it and add it to your site you should be able to add a field like
$MyImageManager= new DataObjectManager(
The next thing will be to print the added images to your template. I think this should work.
<% control Images %>
<% end_control %>
18 October 2010 at 12:12pm
Thanks heaps for that Bambi!
I've installed DataObjectManager and have updated my files like you instructed and it all seems good to go!
One issue remains is that the last bit about adding the images to the template.. Can't get them to show?
I have added: <% control Images %> $Product_Image <% end_control %>
replacing the original call for the images were in my ecommerce/templates/layouts/product.ss:
<% if Image.ContentImage %>
<img class="productImage" src="$Image.LargeImage.URL" alt="<% sprintf(_t("IMAGE","%s image"),$Title) %>" />
<% else %>
<img src="ecommerce/images/productPlaceHolderNormal.gif" alt="<% sprintf(_t("NOIMAGE","Sorry, no product image for "%s""),$Title) %>" />
<% end_if %>
Is this right? Lookin forward to your help. It's already been a huge help!
25 November 2010 at 11:57pm
Hey again guys,
I've made progress with this thanks to Bambi's help. I have the dataobjectmanager showing on each product page in the backend.. But still have not been able to show the additional images I want on the frontend product page.
Have also noticed there is an issue where there is no control over what images show for that specific product in the form where I add mulitple images. It displays all of the files in the assets/uploads folder for ever product.
Could someone please supply the code for their products.php and products.ss files?
|Go to Top|