Advertisement:

Author Topic: [SOLVED] How to display attachment only for two categories ?  (Read 677 times)

m.elmasghouni

  • Newbie
  • *
  • Posts: 8
[SOLVED] How to display attachment only for two categories ?
« on: December 21, 2014, 05:54:38 pm »
Hello everybody,

Someone know how to display attachment in announcer contact for only two categories. (I use Bender Theme)

Thank's for help !
« Last Edit: December 21, 2014, 11:00:44 pm by m.elmasghouni »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to display attachment only for two categories ?
« Reply #1 on: December 21, 2014, 07:23:18 pm »
Hi,

You need to edit item-sidebar.php inside bender folder:

1.- Locate this block:

Code: [Select]
<form action="<?php echo osc_base_url(true); ?>" method="post" name="contact_form" id="contact_form" <?php if(osc_item_attachment()) { echo 'enctype="multipart/form-data"'; };?> >

and replace it with:

Code: [Select]
            <?php $allowed_attachment_cats = array(XXYY);
            
$attachment = (in_array(osc_item_category_id(), $allowed_attachment_cats) ? true false); ?>

            <form action="<?php echo osc_base_url(true); ?>" method="post" name="contact_form" id="contact_form" <?php if(osc_item_attachment() && $attachment) { echo 'enctype="multipart/form-data"'; };?> >

Change XX,YY to the ID's of the categories for which you want to allow attachments.

2.- Below, locate this line:

Code: [Select]
<?php if(osc_item_attachment()) { ?>
Replace it with:

Code: [Select]
<?php if(osc_item_attachment() && $attachment) { ?>
Regards

m.elmasghouni

  • Newbie
  • *
  • Posts: 8
Re: How to display attachment only for two categories ?
« Reply #2 on: December 21, 2014, 08:30:49 pm »
Oh thank you very very much teseo :)

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to display attachment only for two categories ?
« Reply #3 on: December 21, 2014, 09:45:40 pm »
You're welcome :)

Please add [SOLVED] to the title of this thread.