Search

Subsection Manager 2 updated to version 2.1.2 on 3rd of February 2012

  • Fix invalid extension.meta.xml and solve merging errors

I think there is a small bug when using Subsection Manager in conjunction with the Breadcrumb Field.

It seems that subsection manager modifies the datasources $dsParamINCLUDEDELEMENTS array elements.

I have a test DS, with just one output element selected, which is a Breadcrumb Children element. The array definition in the DS source like this:

        public $dsParamINCLUDEDELEMENTS = array(
            'structure: children'
    );

When the DataSourceEntriesBuilt delegate fires, SSM executes the __prepareSubsection method, which in turn runs __parseSubsectionFields. On line 275 of extension.driver.php, the dsParamINCLUDEDELEMENTS array is re-written for some reason (I don't fully understand the inner workings of SSM), and structure: children changes to structure: test-ds-name

If I modify line 275 of extension.driver.php from:

$storage = $subsection . ': ' . $context;

to:

$storage = $included;

the breadcrumb field output is corrected, however, subsection output ceases to work.

If I understood the inner workings of SSM a little more I could probably fix this myself, but alas I don't, so I'm hoping Nils might have a better idea :)

Hmm, I just realised it's probably got something to do with the hardcoded field name exclusions which already exist for 'formatted', ''increment' etc.

I'll add the breadcrumb mode names to the exclusion list...

Ninja edit: Yeah, that worked. I'll Send a pull request shortly.

Edit 2: Pull request submitted: https://github.com/hananils/subsectionmanager/pull/183

My client is having issues in IE9. See this bugreport: https://github.com/hananils/subsectionmanager/issues/182

Anybody know how to fix this?

hi there,

is it possible to filter by the handle of a field of a subsection rather than the id? i basically want to have a url like so:

domain.de/store/artist-name/artist-genre

where artist and genre are subsections of the store section which is filtered by the subsections, params {$artist-name} and {$genre-name}

what i got is:

domain.de/store/6/23

which for obvious reasons i dont want to use ;)

thanks guys,
daniel

You'll have to use Data Source chaining to get what you want:

  • Create one Data Source that filters your subsection (not the Subsection Manager field) by your handles.
  • Let this Data Source return the needed ID as parameter output.
  • Create a second Data Source that filters the Subsection Manager field by this parameter ($ds-something).

Has anyone ever user Cachable Datasources on a datasource from a section with a Subsection manager field?

  • Subsection manager: 2.2.1 (https://github.com/hananils/subsectionmanager/tree/2.1.1)
  • Cachable Datasources: 0.5 (https://github.com/nickdunn/cacheabledatasource/tree/0.5)
  • Symphony 2.2.5

When a section with a subsection gets cached, none of the susections fields appear to have made it into the cached version. Has anybody else experienced this problem?

Before caching, the subsection field in my datasource looks like:

 <images field-id="28" subsection-id="3" items="1">
   <item id="78">
     <image size="139 KB" path="/Media/Images" type="image/jpeg">
       <filename>94812princerupertimg_2975.jpg</filename>
        <meta creation="2012-03-19T17:07:24-07:00" width="725" height="483" />
     </image>
    </item>
 </images>

After modifying the generated datasource to extend CacheableDatasource rather than Datasource, it looks like:

 <images field-id="28" subsection-id="3" items="1">
   <item id="78" />
 </images>

Interestingly, even if I turn caching off for this datasource (setting $dsParamCACHE to 0 [zero] or leaving the grab function in there I still get the result above, indicating that the problem is somewhere in the CacheableDatasource class (even though it's an extension of the Datasource class).

I upgraded from SSM 1.x and lost the xml just like @liamegan describes above. I have two questions regarding the new SSM:

  • How does one get more than the item ID in the SSM xml output?
  • How does the "Nested Subsections" work?

Nested Subsections

Attachments:
Screen Shot 2012-03-21 at 12.24.28 PM.png

These are two different issues:

  • SSM 2 is caching internally which is certainly the cause why Cacheable Data Sources don't work.
  • Regarding the XML output after upgrading: please read the release notes! You have to select subsection items in the Data Source editor now.

Thank you Nils! I had read the release notes but didn't catch the switch from editing in the section editor to the datasource editor. Thanks for cuing me in.

Fatal Error when registering new member

Fatal error: Class 'extension_subsectionmanager' not found in /Users/home/Sites/paladinnetwork.com/public/extensions/subsectionmanager/fields/field.subsectionmanager.php on line 680

Synopsis

  1. I'm running Symphony 2.2.5 and recently upgraded from Subsection Manager (SSM) 1 to SSM2.
  2. I'm using the Members extension v 1.1.1 to allow users to register an account.
  3. When the form is submitted successfully the error (above) occurs; however, the registration is entered into the members section successfully including all data for the subsection fields.

Questions

  • Is this a possible bug in SSM2?
  • Is there something I'm doing incorrectly (more likely)?
  • Is this a conflict between Members and SSM2?

Thank you in advance for your help. It is much appreciated.

Personally, I don't have enough experience with Members so maybe this is best asked in the Members thread. I not aware of any incompatibilities but maybe Members does something fancy here?

The error you see implies that the extension driver is not available in the context appendFormattedElement() is called. But I'm not sure how that is related to Members at all.

Thanks for your reply, Nills.

  1. Why do you (or does anyone) think this error would be thrown after writing to the database (DB)?
  2. Why is SSM2 called when posting from a frontend form to the DB (this is a question of ignorance on my part)?
  1. How is the database related to this?
  2. Subsection Manager is registered to the DataSourceEntriesBuilt delegate to check for included elements – but this is related to displaying a frontend page not to front-end editing.

Sorry about the confusion. I'll try and be more clear.

When I post a front end form via modal/lightbox to the database it successfully creates a new entry in my members section and then gives me this subsection manager Fatal Error. Upon successful form entry a success message should be displayed and then the modal/lightbox closes and returns the user to the page to which the form was linked. However, I'm getting the Fatal Error before the success message (which reads from the /data/events/ node).

I do not believe that this did not happen on this form before the upgrade to SSM2.

I added a require_once line at the top of the fields/field.subsectionmanager.php where the initial Fatal Error on line 680 from where the error was originating ((see above)[http://getsymphony.com/discuss/thread/83270/2/#position-31]):

require_once(EXTENSIONS . '/subsectionmanager/extension.driver.php');

That solved the first Fatal Error since the class is contained in the extension.driver.php file. However, now I get a new Fatal Error which is related to a type mismatch:

Fatal error: Call to a member function fetch() on a non-object in /Users/wjn/Sites/paladinnetwork.com/public/extensions/subsectionmanager/fields/field.subsectionmanager.php 

Both errors are being generated from within the appendFormattedElement() method.

The error identifies line 685 (with the extra line at the top for the require_once), likely line 684 in the original field.subsectionmanager.php as its source:

// Fetch missing entries
if(empty($entry)) {
    $entry = extension_subsectionmanager::$entryManager->fetch($entry_id, $this->get('subsection_id'));

    // Store entry
    $entry = $entry[0];
    extension_subsectionmanager::$storage['entries'][$entry_id] = $entry;
}

This sounds a bit strange at first glance ... Are you using other extensions that might interfer?

This sounds a bit strange at first glance ... Are you using other extensions that might interfer?

Such as?

Here's a table of the extensions rolling in the installation I'm working with.

Nils, is there any way around my issue that you can think of?

Narrowing the scope of the Fatal Error

What I have been able to determine is that Subsection Manager 2 throws the error when there are no values to insert into the Members section subsection fields. In other words, it appears to be balking at null values.

Obviously, I don't know this extension super well, not being the extension's developer and count Nils a markedly better developer than myself; however, the following changes to /fields/field.subsectionmanager.php seem to have got things working for me:

1. Require the extension.driver.php file


At the very top of /fields/field.subsectionmanager.php (line 11) find this line of code:

require_once(EXTENSIONS . '/subsectionmanager/lib/class.subsectionmanager.php');

and add the following line of code above it:

require_once(EXTENSIONS . '/subsectionmanager/extension.driver.php');

so that the very top of the file (prior to the Class declaration looks like this:

<?php

    /**
     * @package subsectionmanager
     */
    /**
     * This field provides inline subsection management.
     */
    if(!defined('__IN_SYMPHONY__')) die('<h2>Symphony Error</h2><p>You cannot directly access this file</p>');

    require_once(EXTENSIONS . '/subsectionmanager/extension.driver.php');
    require_once(EXTENSIONS . '/subsectionmanager/lib/class.subsectionmanager.php');
    if(!class_exists('Stage')) {
        require_once(EXTENSIONS . '/subsectionmanager/lib/stage/class.stage.php');
    }

2. Require the extension.driver.php file


On about line 683, find this block of code:

// Fetch missing entries
if(empty($entry)) {
    $entry = extension_subsectionmanager::$entryManager->fetch($entry_id, $this->get('subsection_id'));
    // Store entry
    $entry = $entry[0];
    extension_subsectionmanager::$storage['entries'][$entry_id] = $entry;
}

and add … && !is_null($entry)… so that the block looks like this:

// Fetch missing entries
if(empty($entry) && !is_null($entry)) { // <------------ Here's the change
    $entry = extension_subsectionmanager::$entryManager->fetch($entry_id, $this->get('subsection_id'));
    // Store entry
    $entry = $entry[0];
    extension_subsectionmanager::$storage['entries'][$entry_id] = $entry;
}

Nils, can you confirm if this is an actual fix or if it is going to mess up the extension in ways unforeseen to me?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details