21474 Posts in 5781 Topics by 2620 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 506 Views |
-
[Solved] One Photo, Several Pages

20 August 2010 at 2:24am Last edited: 23 August 2010 2:18pm
I added a photo to a page with the following method (actually to a Product in the ecommerce module to be more precise):
static $has_one = array(
'Photo' => 'Image'
);and
function getCMSFields($cms) {
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
return $fields;
}I have photos in an asset folder. I can only associate each of these photos to only one page, as soon as the photo is used, it becomes unavailable for selection to other pages.
Could someone please help? I suspect it's a one to many type relationship I need to develop, but I am lost at this stage.
-
Re: [Solved] One Photo, Several Pages

23 August 2010 at 2:18pm
I have a solution.
In ecommerce, Product_Image seems to only attach file to an image, by that I mean that if I add a file from a From the File Store, I can only select one image per specific product.
Changing to this in Product php:
public static $has_one = array(
'MyImage' => 'Image',
);instead of:
public static $has_one = array(
'MyImage' => 'Product_Image',
);solved my issue.
| 506 Views | ||
|
Page:
1
|
Go to Top |

