Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

extra product fields - show only used restrict label and values in dropdown


Recommended Posts

Posted

Hi,

 

Thank you thank you for this contrib! Its wonderful!

I was wondering if anyone would help me to modify the index.php code of this script so that the restrict dropdowns only show if. For example... I have a category of games and a category of movies. I would like the restrict fields to only show if they are used in the category. I dont want the the movies category to show the restrict feilds or labels for game options. I want it to work as the manufacturer and category product list filter, as i see a few lines above in the index.php file. so heres what im messing with.

 

catalog/index.php

        <!-- begin extra product fields -->
         <tr>
           <td class="main" align="left" colspan="2">
           <?php
             $epf_list = array();
             foreach ($epf as $e) {
               if ($e['restrict']) $epf_list[] = $e['field'];
             }
             echo tep_draw_form('epf_restrict', FILENAME_DEFAULT, 'get');
             if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
               reset($HTTP_GET_VARS);
               while (list($key, $value) = each($HTTP_GET_VARS)) {
                 if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $epf_list)) ) {
                   echo tep_draw_hidden_field($key, $value);
                 }
               }
             }
             foreach ($epf as $e) {
               if ($e['restrict']) {
                 echo sprintf(TEXT_RESTRICT_TO, $e['label'], tep_draw_pull_down_menu($e['field'], tep_build_epf_pulldown($e['id'], $languages_id, array(array('id' => '', 'text' => TEXT_ANY_VALUE))),'', 'onchange="this.form.submit()"')) . '<br>';
               }
             }
            ?>
            </form>
           </td>
         </tr>
         <!-- end extra product fields -->

 

and i see how its done here in

product_listing.php

 // begin extra product fields
           $extra = '';
           foreach ($epf as $e) {
             if ($e['listing']) {
               $mt = ($e['uses_list'] ? ($listing[$e['field']] == 0) : !tep_not_null($listing[$e['field']]));
               if (!$mt) { // only list fields that aren't empty
                 $extra .= '<br><b>' . $e['label'] . ': </b>';
                 if ($e['uses_list']) {
                   $extra .= tep_get_extra_field_list_value($listing[$e['field']],$e['show_chain'] == 1);
                 } else {
                   $extra .= $listing[$e['field']];
                 }
               }
             }
           }
           // end extra product fields

 

in then $extra is called in the next get vars line.

 

I am a novice that would greatly appreciate any help.

 

Thanks!

Chad

  • 1 month later...
Posted

Hello

I have added extra product fields. I am creating a bookshop, and would like to add extra description boxes such as ISBN, Page no, etc. opposed to drop down boxes How would I do that?

 

Thank you

First Noor

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...