I have a problem, i have create a new tab to manage Push Ahead/Highlight product for each category.

But, i want to display all the product Push Ahead/Highlight and when i unChecked the Checkbox on the left and i save the product is no longer push ahead/highlited.

The problem is with JS/Php i don't find a way to do that with magento...

Can someone have an idea ?

Here my JS :

        <input type="hidden" name="push_ahead" id="PushAheadProducts" value="" />
<script type="text/javascript">

<?php if(($block = $this->getLayout()->getBlock('category.product.grid')) && ($_gridJsObject=$block->getJsObjectName())): ?>

    var pushProducts = $H(<?php echo $this->getProductsJson() ?>);
    $('PushAheadProducts').value = pushProducts.toQueryString();

    function registerCategoryProduct(grid, element, checked){
//                            console.log("here");
                element.positionElement.disabled = false;
                pushProducts.set(element.value, element.positionElement.value);
                element.positionElement.disabled = true;
        $('PushAheadProducts').value = pushProducts.toQueryString();
        grid.reloadParams = {'selected_products[]':pushProducts.keys()};
    function categoryProductRowClick(grid, event){
//                    console.log("here");
        var trElement = Event.findElement(event, 'tr');
        var isInput   = Event.element(event).tagName == 'INPUT';
//                        console.log("here");
            var checkbox = Element.getElementsBySelector(trElement, 'input');
                var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
                <?php echo $_gridJsObject ?>.setCheckboxChecked(checkbox[0], checked);
    function positionChange(event){          
//        console.log("here");
        var element = Event.element(event);
        if(element && element.checkboxElement && element.checkboxElement.checked){
            pushProducts.set(element.checkboxElement.value, element.value);
            $('PushAheadProducts').value = '0';

    var tabIndex = 1000;
    function categoryProductRowInit(grid, row){
        var checkbox = $(row).getElementsByClassName('checkbox')[0];
        var position = $(row).getElementsByClassName('input-text')[0];
        if(checkbox && position){
//            console.log("here");
            checkbox.positionElement = position;
            position.checkboxElement = checkbox;
            position.disabled = !checkbox.checked;
            position.tabIndex = tabIndex++;

    <?php echo $_gridJsObject ?>.rowClickCallback = categoryProductRowClick;
    <?php echo $_gridJsObject ?>.initRowCallback = categoryProductRowInit;
    <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerCategoryProduct;
    <?php echo $_gridJsObject ?>.rows.each(function(row){categoryProductRowInit(<?php echo $_gridJsObject ?>, row)});

<?php endif; ?>

closed as unclear what you're asking by Fabian Blechschmidt, 7ochem, Sander Mangel, Rajeev K Tomy, liyakat Jun 29 '15 at 4:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.