Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type

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

Page: 1
Go to End
Author Topic: 868 Views
  • pingu
    Avatar
    Community Member
    75 Posts

    [Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type Link to this post

    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 {
       
    }

    ?>

  • schellmax
    Avatar
    Community Member
    126 Posts

    Re: [Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type Link to this post

    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?

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: [Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type Link to this post

    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"

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: [Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type Link to this post

    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.

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: [Resolved] SS 2.3.1 - Issue with CurrencyField in Custom page type Link to this post

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

    868 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.