VM 2.0.2 custom field allway display, not work only admin, public on-off not

Started by reproteq, March 02, 2012, 12:25:48 PM

Previous topic - Next topic

reproteq

i make customs but allways display on , not work only admin see, i change but not respond.
i see change value  in db but allway displayed.

bug?

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

reproteq

i place this

if ($field->display AND $this->product->customfieldsSorted['normal'][$field->virtuemart_custom_id]->admin_only=='0' ) {

now not see customer this fields.
but not good solution.

one can test whether a customfield toggles, is shown only for admin or always shown.
I think it's a bug or possibly when installing or modifying any file has stopped working.
but it seems strange that something as basic com will not work well.

the custom fields are always visible to everyone?
it works to publish or unpublish in vm 2.0.2 and joomla 2.5.1

reproteq

SOLUtion work 100%

comonents/com_virtuemart/views/podructdetails/tpl/default_customfields.php

<div class="product-fields">
       <?php
      
      $user =& JFactory::getUser();   // <--- recupera user
      
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[$this->position] as $field) {

      //if ($field->display ) {
      if ($field->display AND ( $this->product->customfieldsSorted['normal'][$field->virtuemart_custom_id]->admin_only=='0' OR $user->get('isRoot') ) ) {    // checkea el tipo normal y solo muestra si es ROOT
          ?><div class="product-field product-field-type-<?php echo $field->field_type ?>">
          <?php if ($field->custom_title != $custom_title) { ?>
             <span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></span>
             <?php
             if ($field->custom_tip)
            echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png');
         }
         ?>
              <span class="product-field-display"><?php echo $field->display ?></span>
              <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>
          </div>
          <?php
          $custom_title = $field->custom_title;
      }
       }
       ?>
        </div>

solution by salva gregori  info@undiez.es