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.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Working on e-commerce for SS 2.4


Go to End


121 Posts   27698 Views

Avatar
mattconfusion

Community Member, 48 Posts

11 June 2010 at 1:30am

hi jeda one question. I'm trying to extend the product page, in a way similar to the one showed in tutorial 2 (when it's extending page). The table is correctly cerated, the php file is placed in mysite folder, but on the cms it's not working, calling it a product page in the create dropdown, and not showing any of the fields I added (for now, Checkboxfield and textfield)... any suggestions? It would be source of problems doing that?

<?php
 
class Agenda extends Product {
 
   static $db = array(
      'Ricambiabile' => 'Boolean',
      'NumeroFogli' => 'Int'
   );
   
   function getCMSFields() {
      $fields = parent::getCMSFields();
 
      $fields->addFieldToTab('Root.Content.Main', new CheckboxField('Ricambiabile'), _t('Agenda.RICAMBIABILE', 'Carta Ricambiabile'));
      $fields->addFieldToTab('Root.Content.Main', new TextField ('NumeroFogli', _t('Agenda.NUMEROFOGLI', 'Product Code'), '', 4),'Content');
 
      return $fields;
   }.
}
?>

Avatar
biapar

Forum Moderator, 435 Posts

11 June 2010 at 2:43am

Where is invoice link on CMS backend?

Avatar
mattconfusion

Community Member, 48 Posts

11 June 2010 at 2:45am

it's in the reports - all orders rows

Avatar
biapar

Forum Moderator, 435 Posts

11 June 2010 at 2:48am

Hi mattconfusion,

after update a class, you must launch /dev/build?flush=1

PS: could you contact me on my mail ( see my profile )?

Avatar
mattconfusion

Community Member, 48 Posts

11 June 2010 at 3:02am

done it, but seems to be not working.
i will contact you but right now i'm gonna leave so it would be tomorrow morning, sorry pal.

Avatar
biapar

Forum Moderator, 435 Posts

11 June 2010 at 3:43am

Hi,

Example:
class News extends Page {

public static $db = array(
'DataNews' => 'Date'
);

static $has_one = array(
'NewsBanner1' => 'News_Image',

);

/**
* Create the fields within the CMS
*/
function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab("Root.Content.Main", new CalendarDateField("DataNews", "Data"));
$fields->addFieldToTab("Root.Content.Images", new ImageField("NewsBanner1", "Immagine News"));
return $fields;

}

}

I see, in you code "}." Is dot a mistake? You must del it.
PS: Matt, I'm italian like you. On my site , you find my contacs ( MSN too ).

Avatar
mattconfusion

Community Member, 48 Posts

11 June 2010 at 7:10pm

Edited: 11/06/2010 7:10pm

actually your code is running, but it's my approach it's incorrect. I'm basically trying to have more customized types of products. a simple extension like the one we have been talking about since now, gives you

[User Warning] ModelAsController::getNestedController() returned bad object type 'ACertainProduct'

(where a certain product is obiviosly the product extension) .

What would be the correct approach to extend the Product Object to make it still recognizable as a product with additional features? In addition to this, an extension like the one posted above gives you, in the dropdown menu of ?create Page'the Product title again. So even if you extended it, it still appears as another Product type page

@biapar: yeah I know you're italian ; ) don't have msn in this place but if you want i made visible my email address too

Avatar
biapar

Forum Moderator, 435 Posts

11 June 2010 at 8:09pm

Hi,

the approach of extend "class Agenda extends Product" is ok.
Have you that error because you made agenda child of agenda?