Hi there,
I have a DataExtension, which is named in _config.php as:
Product::add_extension('ProductImages');
this is done to extend the "Product" class which in turn is a page type that extends Page.php.
I have also created an "UploadField" in ProductImages.php
<?php
class ProductImages extends DataExtension {
private static $db = array(
);
private static $many_many = array(
'ProductImages' => 'Image'
);
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab(
'Root.UploadImages',
$uploadField = new UploadField(
$name = 'ProductImages',
$title = 'Upload 1-8 images'
)
);
$uploadField->setAllowedMaxFileNumber(8);
$uploadField->setFolderName('products');
}
}
the CMS for the Product page has the new tab (Product Images) and the images upload to the the assets/uploads/products folder no problem and are held in the database.
My problem is getting the images to show at the frontend,
using:
<ul>
<% loop $ProductImages %>
<li>$SetWidth(100)</li>
<% end_loop %>
</ul>
or
<ul>
<% loop $ProductImages %>
<li>$Image.SetWidth(100)</li>
<% end_loop %>
</ul>
return nothing,
i am guessing i am missing something out in my ProductImages.php file, being a SS3.1 virgin i have been stuck deep in the docs and cannot find as to where i am going wrong, any pointers would be appreciated.
thanks