1

I am using a amasty extension https://amasty.com/order-flags.html

to set specific data to my orders

and there are 2 columns on the order screen i dont want my employees to see

I was thinking i could just use css to hide them since non of my employees know how to inspect css and say turn off display: none; even my knowledge is limited in this area so my question would be how to hide specific columns i create using that exstension from my employees a example of the code for the 2 columns i wish to hide is

<div id="orderflag-6203-column-2" onclick="javascript: openFlagDialog(6203, '100005533', '2', 'Order Profit');">
    <div>
                    <img src="https://domain.com/skin/adminhtml/default/default/images/amflags/empty.gif" id="flagimg-6203-column-2" title="No Flag" alt="No Flag" border="0">
            </div>
    <input type="hidden" id="orderflag-6203-column-2" name="orderflag-6203-column-2" value="">
    <input type="hidden" id="flag_entity_id" name="flag_entity_id" value="">
    <input type="hidden" id="column_entity_id" name="column_entity_id" value="2">
</div>

and

<div id="orderflag-6203-column-6" onclick="javascript: openFlagDialog(6203, '100005533', '6', 'Commision');">
    <div>
                    <img src="https://domain.com/skin/adminhtml/default/default/images/amflags/empty.gif" id="flagimg-6203-column-6" title="No Flag" alt="No Flag" border="0">
            </div>
    <input type="hidden" id="orderflag-6203-column-6" name="orderflag-6203-column-6" value="">
    <input type="hidden" id="flag_entity_id" name="flag_entity_id" value="">
    <input type="hidden" id="column_entity_id" name="column_entity_id" value="6">
</div>

so my question how can i hide these from my employees using css or ?

would it be better to create a sub admin role? seems complicated. I need a way to hide these and reveal them to myself when i need to

how could i hide these 2 columns from the order summary and order screen

<?php

/**

 * @author Amasty Team

 * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)

 * @package Amasty_Flags

 */

$_order         = $this->getOrder();

$_currentFlag   = $this->getCurrentFlag();

$_currentColumn = $this->getCurrentColumn();

$_columnFlags   = $this->getApplyFlags();

?>



<div id="orderflag-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" onclick="javascript: openFlagDialog(<?php echo $_order->getId(); ?>, '<?php echo $_order->getIncrementId(); ?>', '<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>', '<?php echo $_currentColumn->getHeader(); ?>');">

    <div>

        <?php if (($_currentFlag) && (in_array($_currentFlag->getId(), $_columnFlags))): ?>

            <img src="<?php echo $_currentFlag->getUrl(); ?>" id="flagimg-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" title="<?php echo $_currentFlag->getComment(); ?>" alt="<?php echo $_currentFlag->getAlias(); ?>" border="0" /><?php echo "<p>".$_currentFlag->getComment()."</p>"; ?>

        <?php else: ?>

            <img src="<?php echo $this->getEmptyFlagUrl(); ?>" id="flagimg-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" title="No Flag" alt="No Flag" border="0" />

        <?php endif; ?>

    </div>

    <input type="hidden" id="orderflag-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" name="orderflag-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" value="<?php if ($_currentFlag): echo $_currentFlag->getId(); endif; ?>" />

    <input type="hidden" id="flag_entity_id" name="flag_entity_id" value="<?php if ($_currentFlag): echo $_currentFlag->getId(); endif; ?>" />

    <input type="hidden" id="column_entity_id" name="column_entity_id" value="<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" />

</div>



<div id="flaglist-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>" style="display: none;">

    <?php if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/assign_flags')): ?>

        <div style="margin-top: 8px; margin-bottom: 8px;">

            <?php echo $this->__('Enter/modify comment for the flag you want to assign, and click "Set" button.'); ?>

        </div>

        <table>

            <tr class="amflags-tr">

                <td></td>

                <td><strong><?php echo $this->__('NO FLAG'); ?></strong></td>

                <td>

                    <button onclick="setOrderFlag('<?php echo $this->getSetFlagUrl(); ?>', <?php echo $_order->getId(); ?>, 0, <?php echo str_replace('priority', '', $_currentColumn->getId()); ?>, '<?php echo $this->getEmptyFlagUrl(); ?>');" class="scalable go" type="button"><span><?php echo $this->__('Set'); ?></span></button>

                </td>

            </tr>

            <?php foreach ($this->getFlagCollection() as $flag): ?>

                <?php if (in_array($flag->getId(), $_columnFlags)):?>

                <tr class="amflags-tr"><td colspan="3" height="5"></td></tr>

                <tr class="amflags-tr">

                    <td>

                        <img src="<?php echo $flag->getUrl(); ?>" alt="" border="0" id="flagselect-img-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>-<?php echo $flag->getId(); ?>" />

                    </td>

                    <td>

                        <input type="text" value="<?php if ($_currentFlag && $flag->getId() == $_currentFlag->getId()): ?><?php echo $_currentFlag->getComment()."2"; ?><?php else: ?><?php echo $flag->getComment(); ?><?php endif; ?>" id="flagselect-comment-<?php echo $_order->getId(); ?>-column-<?php echo str_replace('priority', '', $_currentColumn->getId()); ?>-<?php echo $flag->getId(); ?>" class="input-text" style="width: 230px;" />

                    </td>

                    <td>

                        <button onclick="setOrderFlag('<?php echo $this->getSetFlagUrl(); ?>', <?php echo $_order->getId(); ?>, <?php echo $flag->getId(); ?>, <?php echo str_replace('priority', '', $_currentColumn->getId()); ?>, '<?php echo $flag->getAlias(); ?>');" class="scalable go" type="button"><span><?php echo $this->__('Set'); ?></span></button>

                    </td>

                </tr>

                <?php endif; ?>

            <?php endforeach; ?>

        </table>

    <?php else: ?>

        <div id="popup-messages" style="margin-top: 16px;">

            <ul class="messages">

                <li class="error-msg">

                    <ul>

                        <li>

                            <span><?php echo $this->__('Access denied.'); ?></span>

                        </li>

                    </ul>

                </li>

            </ul>

        </div>

    <?php endif; ?>



</div>
  • Have you contacted Amasty? I doubt highly that they have this feature built in but it's an interesting requirement. As it stands this question is probably going to be marked for close because it mentions a 3rd party extension - that said - it's a curious business requirement which I would love to hear some creative solutions for. – philwinkle Jul 5 '16 at 18:36
  • everytime i contact amasty they just try to sell me more stuff :) have a love hate relationship with them. I was thinking a simple css display none would fit my immediate needs but in the long run a super admin sub admin would be a much better approach where as we could display or hide order fields etc on a role basis. But until then if i could say hide the column with css by either the column-2 column-6 or by some other specific factor as they do have a id as well. – user3677211 Jul 5 '16 at 18:41
  • orderflag-6093-column-2 and orderflag-6093-column-6 seems the common denominator is -column-2 and -column-6 the next ordr is orderflag-6094-column-2 so the order flag # changes – user3677211 Jul 5 '16 at 18:42
  • Looks like there are some fun code approaches here that could work. I could blog about this later but in the meantime Demac has a good approach: demacmedia.com/magento-commerce/restrict-admin-roles-in-magento – philwinkle Jul 5 '16 at 18:45
  • heres the code for the exstension I think this is where its being displayed couldnt i do somehting in php like if column 2 or cuolumn 6 display none then i can remove with the inspector and view those columns? – user3677211 Jul 5 '16 at 19:04
0

Please open app/code/local/Amasty/Flags/Model/Observer.php

Find line

$grid->addColumnAfter($column['index'], $column, $after);

Change with:

$isAdmin = (Mage::getSingleton('admin/session')->getUser()->getId() == 5);
$isSecret = ($column['header'] == "Hidden Flag Name");

if ($isAdmin && $isSecret){
    $grid->addColumnAfter($column['index'], $column, $after);
}

Where 5 is your user ID and "Hidden Flag Name" is the secret flag alias.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.