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.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type


Go to End


5 Posts   1520 Views

Avatar
pingu

Community Member, 75 Posts

8 May 2009 at 1:09am

Edited: 09/05/2009 1:25am

I have a very frustrating issue where Silverstripe won't properly create a custom page type in a section within the CMS.

When I select the page type from the dropdown and click "Go", nothing happens. However, when I refresh the page has been created. This only happens with the custom page type - if I try and create a regular page under the section, it works absolutely fine. The section doesn't have an $allowed_children array defined, so I can create anything within it.

I would really really appreciate some help with this - it's driving me nuts!!!! Code for the extended page type as below:

<?php
class ProductDetail extends Page {

static $db = array(
'Code' => 'Text',
'Price' => 'Currency',
'PriceDescription' => 'Text'
);

static $has_one = array(
'Photo' => 'Image'
);

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('Code'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new CurrencyField('Price'), '');
$fields->addFieldToTab('Root.Content.Main', new TextField('PriceDescription'), '');
$fields->addFieldToTab("Root.Content.Photo", new ImageField('Photo'));

$fields->renameField("PriceDescription", "Price Description");
$fields->renameField("Content","Product Description");

return $fields;
}

}

class ProductDetail_Controller extends Page_Controller {

}

?>

Avatar
schellmax

Community Member, 126 Posts

8 May 2009 at 5:41am

your page code looks ok.
do you get any javascript errors? do you have firebug installed to see what ajax requests are made an what they return?

Avatar
pingu

Community Member, 75 Posts

8 May 2009 at 10:05pm

It makes a call to AddPageOptionsForm and returns an error on that call... I have no further information on the error though, other than "There has been an Error"

Avatar
pingu

Community Member, 75 Posts

9 May 2009 at 12:11am

Okay after reinstalling and dissecting the code I've discovered that it's only the currency field type that's causing this issue. Does anyone have any idea why this would be? I've used this field type in install 3.0 with no problems. Any help with this would be greatly appreciated.

Avatar
pingu

Community Member, 75 Posts

9 May 2009 at 1:25am

Okay it's resolved - MySql was corrupt. It's reinstalled and is now working fine.