Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra Product Fields 1.0


Mrstech

Recommended Posts

Is there anyway to change the look of the filter on product listing page from this vertical to nice horizontal, where the description if above the drop down?

 

I have been looking into the code to think about it, but for me as a noob it's quite impossible. The code looks like it's general self repeating creation of drop down if they exist. This way I don't have any clue how I can position the drop downs...

 

If my feeling is right, the piece responsible for that is in product_listing.php:

           // begin extra product fields
           $extra = '';
           foreach ($epf as $e) {
             if ($e['listing']) {
               $mt = ($e['uses_list'] && !$e['multi_select'] ? ($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']) {
                   if ($e['multi_select']) {
                     $epf_values = explode('|', trim($listing[$e['field']], '|'));
                     $epf_string = '';
                     foreach ($epf_values as $v) {
                       $epf_string .= tep_get_extra_field_list_value($v) . ', ';
                     }
                     $extra .= trim($epf_string, ', ');
                   } else {
                     $extra .= tep_get_extra_field_list_value($listing[$e['field']],$e['show_chain'] == 1);
                   }
                 } else {
                   $extra .= $listing[$e['field']];
                 }
               }
             }
           }
           // end extra product fields

 

Anyone did this?

Link to comment
Share on other sites

Is there anyway to change the look of the filter on product listing page from this vertical to nice horizontal, where the description if above the drop down?

 

Ok, as nobody helped, I managed to spend an evening to learn more about PHP and I've found a solution by myself.

 

The idea was to have the filter drop-downs not as a vertical list with the name of each drop down above it, but to compose it in a nice horizontal line side by side with the name of the drop down filter inside it as a default not filtered. To make it you need to:

 

1) Open index.php and to change line:

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 />';

with

echo sprintf(TEXT_RESTRICT_TO, '', tep_draw_pull_down_menu($e['field'], tep_build_epf_pulldown($e['id'], $languages_id, array(array('id' => '', 'text' => $e['label']))),'', 'onchange="this.form.submit()"')) . ' ';

 

2) Open all your main language files (here example of default english) /includes/languages/english.php and change the line:

define('TEXT_RESTRICT_TO', 'Select <b>%s</b> : %s');

with

define('TEXT_RESTRICT_TO', '<b>%s</b>%s');

 

Those mdoification change only the code added with EPF.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...