Jump to content

Community

Downloads extra fields issue


Recommended Posts

I need some help to make the look of my downloads better, currently because of the extra fields we need the sidebar looks terrible and is difficult to read,5aae4986a2155_ScreenShot2018-03-18at11_09_57.thumb.jpg.2db8024daf1ff4cac97ea787b47cd270.jpg

 

is there a way I can place the extra fields into the main body rather than the side bar? or alternatively could somebody make a plugin that would do this?

 

Link to post
Share on other sites

Open applications\downloads\modules\front\downloads\view.php and find:

		/* Custom Field Formatting */
		$cfields	= array();
		$fields		= $this->file->customFields();

		foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( 'pfd.*', array( 'downloads_cfields', 'pfd' ), NULL, 'pfd.cf_position' ), 'IPS\downloads\Field' ) as $field )
		{
			if( array_key_exists( 'field_' . $field->id, $this->file->customFields() ) )
			{
				if ( $fields[ 'field_' . $field->id ] !== null AND $fields[ 'field_' . $field->id ] !== '' )
				{
					$cfields[ 'field_' . $field->id ] = $field->displayValue( $fields[ 'field_' . $field->id ] );
				}
			}
		}

Change to:

		/* Custom Field Formatting */
		$cfields	= array();
		$longCFields= array();
		$fields		= $this->file->customFields();

		foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( 'pfd.*', array( 'downloads_cfields', 'pfd' ), NULL, 'pfd.cf_position' ), 'IPS\downloads\Field' ) as $field )
		{
			if( array_key_exists( 'field_' . $field->id, $this->file->customFields() ) )
			{
				if ( $fields[ 'field_' . $field->id ] !== null AND $fields[ 'field_' . $field->id ] !== '' AND $field->type != 'Editor' )
				{
					$cfields[ 'field_' . $field->id ] = $field->displayValue( $fields[ 'field_' . $field->id ] );
				}

				if ( $fields[ 'field_' . $field->id ] !== null AND $fields[ 'field_' . $field->id ] !== '' AND $field->type == 'Editor' )
				{
					$longCFields[ 'field_' . $field->id ] = $field->displayValue( $fields[ 'field_' . $field->id ] );
				}
			}
		}

A few lines below, find:

		\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->file, $commentsAndReviews, $versionData, $previousVersions, $this->file->nextItem(), $this->file->prevItem(), $cfields );

Change to:

		\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->file, $commentsAndReviews, $versionData, $previousVersions, $this->file->nextItem(), $this->file->prevItem(), $cfields, $longCFields );

Then on ACP, edit the file view (Downloads -> front -> view -> view) template. Click in the VARIABLES... button and change from:

$file, $commentsAndReviews, $versionData, $previousVersions, $next=NULL, $prev=NULL, $cfields=array()

to:

$file, $commentsAndReviews, $versionData, $previousVersions, $next=NULL, $prev=NULL, $cfields=array(), $longCFields=array()

Then find:

						<div class='ipsType_richText ipsContained ipsType_break' itemprop='text' data-controller='core.front.core.lightboxedImages'>
							{$file->content()|raw}
						</div>

Add below:

						<div class="ipsClearfix">
							<div class='ipsType_richText ipsType_break' itemprop='text' data-controller='core.front.core.lightboxedImages'>
								{{foreach $longCFields as $k => $v}}
									<hr class='ipsHr ipsSpacer_top'>
									<strong>{lang="downloads_{$k}"}</strong><br>
									{$v|raw}
								{{endforeach}}
							</div>
						</div>

So you go from:

a6B7o2F.png

to:

oViAgMh.png

 

But FILE and TEMPLATE edits are NOT recommended. You better find someone to make it as a plugin to you.

?

Btw, it will happen only if the EXTRA FIELD is from EDITOR type.

Edited by Adriano Faria
Link to post
Share on other sites

@Adriano Faria I have tried  a couple of times but I get this error message 

Error: Class 'IPS\downloads\modules\front\downloads\\IPS\Output' not found (0)
#0 /home/pcsg/public_html/system/Dispatcher/Controller.php(96): IPS\downloads\modules\front\downloads\_view->manage()
#1 /home/pcsg/public_html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
#2 /home/pcsg/public_html/applications/downloads/modules/front/downloads/view.php(60): IPS\Content\_Controller->execute()
#3 /home/pcsg/public_html/system/Dispatcher/Dispatcher.php(146): IPS\downloads\modules\front\downloads\_view->execute()
#4 /home/pcsg/public_html/index.php(12): IPS\_Dispatcher->run()
#5 {main}

also when I put in the last piece of code there appears to be a </span> tag extra

probably a error on my part 

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy