0

we are using following script and in console we are getting these errors :

we have magento site 1.9.0

we provide an option to save the values from frontend.

here in frontend, values are not saving in database.

is it problem with jquery errors ? I followed 1st answer this link : Uncaught ReferenceError: $ is not defined? but it didt worked for me

enter image description here

html code

<span class="label qty" id="valueqty_<?php echo $assinproducts->getId(); ?>">
        <?php echo intval($assinproducts['qty']); ?>
    </span>

    <input type = "text" id = "qty_<?php echo $assinproducts->getId(); ?>" onkeydown="validateNumbers(event)" 
    name="stock" value="<?php echo intval($assinproducts['qty']); ?>" style="display:none;"/>

    <span class="label wk_action" id="edit_link_<?php echo $assinproducts->getId(); ?>">
        <img onclick="showField('<?php echo $assinproducts->getId(); ?>'); return false;" 
        src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
    </span>

    <p id="updatedqty_<?php echo $assinproducts->getId(); ?>" style = "display:none;color:red;">Updated</p><br/>

    <button id="update_button_<?php echo $assinproducts->getId(); ?>" class="button wk_mp_btn1" 
    onclick="updateField('<?php echo $assinproducts->getId(); ?>',<?php echo intval($assinproducts['qty']); ?>); return false;" style="display:none" >
        <span>
            <span style="font-size:12px;"><?php echo $helper->__('Update') ?></span>
        </span>
    </button>

    <button id="reset_button_<?php echo $assinproducts->getId(); ?>" type="reset" class="cancel" 
    onclick="hideReset('<?php echo $assinproducts->getId(); ?>'); return false;" style="display:none"></button>

Script

<script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.jcarousel.min.js"></script>

<!-- to remove console js errors end -->


<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>


<script language="JavaScript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js">
    function validateNumbers(e)
    {
        if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
            // Allow: Ctrl+A, Command+A
            (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || 
            // Allow: home, end, left, right, down, up
            (e.keyCode >= 35 && e.keyCode <= 40)) {
                // let it happen, don't do anything
                return;
        }

        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
            e.preventDefault();
        }
    }

    var $wk_jq = jQuery.noConflict();

    (function($wk_jq){
            $wk_jq( "#special_from_date" ).datepicker({dateFormat: "yy-mm-dd"});
            $wk_jq( "#special_to_date" ).datepicker({dateFormat: "yy-mm-dd"});
            $wk_jq('#mpselecctall').click(function(event) {
            if(this.checked) {
                $wk_jq('.mpcheckbox').each(function() {
                    this.checked = true;      
                });
            }else{
                $wk_jq('.mpcheckbox').each(function() {
                    this.checked = false;           
                });         
            }
        });

        $wk_jq('body').delegate('.mp_edit','click',function(){
            var id=$wk_jq(this).attr("data-type");  
                    var dicision=confirm('<?php echo $helper->__(" Are you sure you want to edit this product ? ")?>');
                    if(dicision==true){         
                            var $type_id=$wk_jq(this).attr('data-type');                
                            window.location = "<?php echo $this->getUrl('mpassignproduct/index/edit/') ?>".concat("id/",id);    
                    }
        });

        $wk_jq('.mp_delete').click(function(){
                    var id=$wk_jq(this).attr("data-type");
                    var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this product ? ")?>');
                    if(dicisionapp==true)
                            window.location = "<?php echo $this->getUrl('mpassignproduct/index/delete/') ?>".concat("id/",id);
            });

            $wk_jq('#mass_delete_butn').click(function(e){
                    var flag =0;
                    $wk_jq('.mpcheckbox').each(function(){
                            if (this.checked == true){
                                    flag =1;
                            }
                    });
                    if (flag == 0){
                            alert("<?php echo $helper->__(' No Checkbox is checked') ?>");
                            return false;
                    }
                    else{
                            var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete these product ? ")?>');
                            if(dicisionapp==true){
                                    $wk_jq('#form-customer-product-delete').submit();
                            }else{
                                    return false;
                            }
                    }
            });
    })($wk_jq);


    function hideReset(product_id)
    {
        var qtyId='#qty_'+ product_id;
        var editLink="#edit_link_"+ product_id;
        var updateButton="#update_button_"+ product_id;
        var resetButton="#reset_button_"+ product_id;

        $wk_jq(qtyId).hide();
        $wk_jq(editLink).show();
        $wk_jq(updateButton).hide();
        $wk_jq(resetButton).hide();
    }

    function showField(product_id)
    {
        var qtyId           = '#qty_'+ product_id;
        var editLink        = "#edit_link_"+ product_id;
        var updateButton    = "#update_button_"+ product_id;
        var resetButton     = "#reset_button_"+ product_id;

        $wk_jq(qtyId).show();
        $wk_jq(editLink).hide();
        $wk_jq(updateButton).show();
        $wk_jq(updateButton).prop('disabled', false);//just in case
        $wk_jq(resetButton).show();

        return false;
    }



    function updateField(product_id,assignqty)
    {

    //  alert("Hello! I am an alert box!!");
        var qtyId           = '#qty_'+ product_id;
        var valueId         = '#valueqty_'+ product_id;
        var updatedqty      = '#updatedqty_'+ product_id;
        var editLink        = "#edit_link_"+ product_id;
        var updateButton    = "#update_button_"+ product_id;
        var resetButton     = "#reset_button"+ product_id;
        var url             = '<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';

        $wk_jq(qtyId).toggle();
        $wk_jq(editLink).hide();
        $wk_jq(updateButton).show();
        $wk_jq(resetButton).show();

        $qty = $wk_jq(qtyId).val();
        jQuery(valueId).html($qty);
        hideReset(product_id);

        var tmpQty = assignqty+parseInt($qty) ;

        new Ajax.Request(url, {
            method: 'post',
            parameters: {id: product_id, qty: tmpQty},
            onComplete: function (transport) {
            //  alert(tmpQty);
                jQuery(priceId).val($price);                
        jQuery(updatedqty).show().delay(2000).fadeOut();
                $updateButton.prop('disabled', false);
            }
        });
    }






</script>

complete html and js code of the file :

<script type="text/javascript" src="/test/wp-content/themes/child/script/jquery.jcarousel.min.js"></script>

<!-- to remove console js errors end -->


<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>








<?php
$helper=Mage::helper('mpassignproduct');
$isPartner= Mage::getModel('marketplace/userprofile')->isPartner(); 
if($isPartner==1){ ?>
    <script type="text/javascript">
    if (typeof jQuery == 'undefined'){
        document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
    }
    </script>
    <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <div>   
        <div class="page-title">
            <h1><?php echo $helper->__('My Assign Product List') ?></h1>
        </div>
        <div class="wk_mp_design">
            <div class="block block-account">   
                <div class="block-title">   
                    <strong><span><h4><?php echo $helper->__('My Assign Product List'); ?></h4></span></strong>
                </div>
            </div>
            <div class="fieldset wk_mp_fieldset">
                <div class="grid">
                    <div class="hor-scroll">
                        <?php 
                            if(count($this->getCollection())==0): ?>        
                                <div class="fieldset wk_mp_fieldset">
                                    <div class="wk_emptymsg">
                                        <?php echo $helper->__('No Product Available') ?>
                                    </div>
                                </div>
                        <?php else: ?>
                            <form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
                                <table cellspacing="0" class="border wk_mp_list_table">
                                    <thead>
                                        <tr id="wk_mp_tr_heading">
                                            <th><span><?php echo $helper->__('Product Name') ?></span></th>
                                            <th><span><?php echo $helper->__('Date') ?></span></th>
                                            <th><span><?php echo $helper->__('Product Status') ?></span></th>
                                            <th><span>&nbsp;</span></th>
                                        </tr>
                                    </thead>
                                    <tbody class="wk_mp_body">
                                        <tr>
                                            <td>
                                                <input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by product name') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
                                            </td>
                                            <td>
                                                <span class="wk_mp_td_span">
                                                    <?php echo $helper->__('From: ') ?>
                                                    <input name="from_date" id="special_from_date" class="input-text" value="<?php echo $this->getRequest()->getParam('from_date')?>" />
                                                </span>                             
                                                <span class="wk_mp_td_span">
                                                    <?php echo $helper->__('To: ') ?>
                                                    <input name="to_date" id="special_to_date" class="input-text" value="<?php echo $this->getRequest()->getParam('to_date')?>" />
                                                </span>
                                            </td>
                                            <td>
                                                <select name="prostatus" class="input-text">
                                                    <option value=""><?php echo $helper->__('All') ?></option>
                                                    <option value="1" <?php if($this->getRequest()->getParam('prostatus') == 1) echo 'selected="selected"'?>>
                                                        <?php echo $helper->__('Approved') ?>
                                                    </option>
                                                    <option value="2" <?php if($this->getRequest()->getParam('prostatus') == 2) echo 'selected="selected"'?>>
                                                        <?php echo $helper->__('Unapproved') ?>
                                                    </option>
                                                </select>
                                            </td>
                                            <td>
                                                <button class="button" title="Save" type="submit">
                                                    <span><span><span><?php echo $helper->__('Submit') ?></span></span></span>
                                                </button>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                            <form name="formmassdelete" id="form-customer-product-delete" method="post" action="<?php echo $this->getUrl('mpassignproduct/index/massdeletepro') ?>">
                                <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
                                <button id="mass_delete_butn" style="float: left;padding: 5px 5px 5px 0;" type="submit" title="Delete Sellers" class="button">
                                    <span><span>Delete Products</span></span>
                                </button>
                                <table cellspacing="0" class="border wk_mp_list_table wk_mp_list_container_table">
                                    <thead>
                                        <tr class="wk_content">
                                            <th class="wk_check_first_td">
                                                <span><input type="checkbox" id="mpselecctall" value="all" name="mpselecctall"></span>
                                            </th>
                                            <th class="wk_first_td">
                                                <span class="label "><?php echo $helper->__('Product Name')?></span>
                                            </th>
                                            <th>
                                                <span class="label name"><?php echo $helper->__('Price')?></span>
                                            </th>

                                            <th>
                                                <span class="label name"><?php echo $helper->__('SKU')?></span>
                                            </th>

                                            <th>
                                                <span class="label name"><?php echo $helper->__('Delivery Time')?></span>
                                            </th>

                                            <th>
                                                <span class="label name"><?php echo $helper->__('Replacement Guarantee')?></span>
                                            </th>

                                            <th>
                                                <span class="label qty"><?php echo $helper->__('Status')?></span>
                                            </th>  


                                            <th>
                                                <span class="label qty"><?php echo $helper->__('Qty.')?></span>
                                            </th> 


                                            <th>
                                                <span class="label qty"><?php echo $helper->__('Condition')?></span>
                                            </th> 

                                            <th>
                                                <span class="label"><?php echo $helper->__('Action')?></span>
                                            </th>   

                                        </tr>
                                    </thead>

                                    <tbody>
                                        <?php foreach($this->getCollection() as $assinproducts):  ?>
                                            <?php $products=Mage::getModel('catalog/product')->load($assinproducts->getProductId()); ?>
                                            <tr class="wk_row_view ">
                                                <td class="wk_check_first_td">
                                                    <span>
                                                        <input type="checkbox" value="<?php echo $assinproducts->getMpassignproductId(); ?>" class="mpcheckbox" name="product_mass_delete[]">
                                                    </span>
                                                </td>
                                                <td class="wk_first_td">
                                                    <span class="label name" title="<?php echo $products->getName(); ?>">
                                                        <?php 
                                                            $productname=strlen($products->getName())>7?substr($products->getName(),0,7)."..":$products->getName();
                                                            echo $products->getName();
                                                        ?>
                                                    </span>
                                                </td>
                                                <td>
                                                    <span class="label price">
                                                        <?php echo Mage::helper('core')->currency($assinproducts->getPrice(), true, false);?>
                                                    </span> 
                                                </td>

                                                <td>
                                                    <span class="label sku">
                                                        <?php echo $assinproducts->getsku() ?>
                                                    </span> 
                                                </td>

                                                <td>
                                                    <span class="label replacement">
                                                        <?php echo $assinproducts->getdeliverytime() ?>
                                                    </span> 
                                                </td>

                                                <td>
                                                    <span class="label delivery">
                                                        <?php echo $assinproducts->getreplacement() ?>
                                                    </span> 
                                                </td>


                                                <td>
                                                    <span class="label pro_status">
                                                        <?php if($assinproducts['flag']==1): ?>
                                                            <?php echo Mage::helper('mpassignproduct')->__('Approved')?>
                                                        <?php else: ?>
                                                            <?php echo Mage::helper('mpassignproduct')->__('Un-Approved')?>
                                                        <?php endif; ?>
                                                    </span> 


    </td>


<td>
    <span class="label qty" id="valueqty_<?php echo $assinproducts->getId(); ?>">
        <?php echo intval($assinproducts['qty']); ?>
    </span>

    <input type = "text" id = "qty_<?php echo $assinproducts->getId(); ?>" onkeydown="validateNumbers(event)" 
    name="stock" value="<?php echo intval($assinproducts['qty']); ?>" style="display:none;"/>

    <span class="label wk_action" id="edit_link_<?php echo $assinproducts->getId(); ?>">
        <img onclick="showField('<?php echo $assinproducts->getId(); ?>'); return false;" 
        src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
    </span>

    <p id="updatedqty_<?php echo $assinproducts->getId(); ?>" style = "display:none;color:red;">Updated</p><br/>

    <button id="update_button_<?php echo $assinproducts->getId(); ?>" class="button wk_mp_btn1" 
    onclick="updateField('<?php echo $assinproducts->getId(); ?>',<?php echo intval($assinproducts['qty']); ?>); return false;" style="display:none" >
        <span>
            <span style="font-size:12px;"><?php echo $helper->__('Update') ?></span>
        </span>
    </button>

    <button id="reset_button_<?php echo $assinproducts->getId(); ?>" type="reset" class="cancel" 
    onclick="hideReset('<?php echo $assinproducts->getId(); ?>'); return false;" style="display:none"></button> 
</td>



                                                <td>
                                                    <span class="label">
                                                        <?php 
                                                            if($assinproducts['product_condition']=='new')
                                                                echo Mage::helper('mpassignproduct')->__('New');
                                                            else
                                                                echo Mage::helper('mpassignproduct')->__('Used');
                                                        ?>
                                                    </span> 
                                                </td>
                                                <td>
                                                    <span class="label wk_action">
                                                        <img src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>" data-type="<?php echo $assinproducts->getMpassignproductId(); ?>" alt="<?php echo $helper->__('Edit')?>" title="<?php echo $helper->__('Edit')?>" class="mp_edit"/>
                                                        <img data-type="<?php echo $assinproducts->getMpassignproductId(); ?>" src="<?php echo $this->getSkinUrl('marketplace/images/icon-trash.png'); ?>" alt="<?php echo $helper->__('Delete')?>" title="<?php echo $helper->__('Delete')?>" class="mp_delete"/>
                                                    </span> 
                                                </td>                       
                                            </tr>               
                                        <?php endforeach; ?>                            
                                    </tbody>

                                </table>
                            </form>
                        <?php endif; ?>
                    </div>
                </div>
                <?php echo $this->getPagerHtml(); ?>
            </div>
        </div>
        <div class="buttons-set">
            <p class="back-link">
                <a href="javascript:;" onclick="javascript: window.history.back();" class="left">&laquo; <?php echo Mage::helper('marketplace')->__('Back') ?></a>
            </p>
        </div>
    </div>
<?php }else{
    echo "<h2 class='wk_new_msg'>".$helper->__("To BECOME SELLER PLEASE CONTACT TO ADMIN.")."</h2>";
}?>

<!-- to remove console js errors -->


<script language="JavaScript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js">
    function validateNumbers(e)
    {
        if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
            // Allow: Ctrl+A, Command+A
            (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || 
            // Allow: home, end, left, right, down, up
            (e.keyCode >= 35 && e.keyCode <= 40)) {
                // let it happen, don't do anything
                return;
        }

        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
            e.preventDefault();
        }
    }

    var $wk_jq = jQuery.noConflict();

    (function($wk_jq){
            $wk_jq( "#special_from_date" ).datepicker({dateFormat: "yy-mm-dd"});
            $wk_jq( "#special_to_date" ).datepicker({dateFormat: "yy-mm-dd"});
            $wk_jq('#mpselecctall').click(function(event) {
            if(this.checked) {
                $wk_jq('.mpcheckbox').each(function() {
                    this.checked = true;      
                });
            }else{
                $wk_jq('.mpcheckbox').each(function() {
                    this.checked = false;           
                });         
            }
        });

        $wk_jq('body').delegate('.mp_edit','click',function(){
            var id=$wk_jq(this).attr("data-type");  
                    var dicision=confirm('<?php echo $helper->__(" Are you sure you want to edit this product ? ")?>');
                    if(dicision==true){         
                            var $type_id=$wk_jq(this).attr('data-type');                
                            window.location = "<?php echo $this->getUrl('mpassignproduct/index/edit/') ?>".concat("id/",id);    
                    }
        });

        $wk_jq('.mp_delete').click(function(){
                    var id=$wk_jq(this).attr("data-type");
                    var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this product ? ")?>');
                    if(dicisionapp==true)
                            window.location = "<?php echo $this->getUrl('mpassignproduct/index/delete/') ?>".concat("id/",id);
            });

            $wk_jq('#mass_delete_butn').click(function(e){
                    var flag =0;
                    $wk_jq('.mpcheckbox').each(function(){
                            if (this.checked == true){
                                    flag =1;
                            }
                    });
                    if (flag == 0){
                            alert("<?php echo $helper->__(' No Checkbox is checked') ?>");
                            return false;
                    }
                    else{
                            var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete these product ? ")?>');
                            if(dicisionapp==true){
                                    $wk_jq('#form-customer-product-delete').submit();
                            }else{
                                    return false;
                            }
                    }
            });
    })($wk_jq);


    function hideReset(product_id)
    {
        var qtyId='#qty_'+ product_id;
        var editLink="#edit_link_"+ product_id;
        var updateButton="#update_button_"+ product_id;
        var resetButton="#reset_button_"+ product_id;

        $wk_jq(qtyId).hide();
        $wk_jq(editLink).show();
        $wk_jq(updateButton).hide();
        $wk_jq(resetButton).hide();
    }

    function showField(product_id)
    {
        var qtyId           = '#qty_'+ product_id;
        var editLink        = "#edit_link_"+ product_id;
        var updateButton    = "#update_button_"+ product_id;
        var resetButton     = "#reset_button_"+ product_id;

        $wk_jq(qtyId).show();
        $wk_jq(editLink).hide();
        $wk_jq(updateButton).show();
        $wk_jq(updateButton).prop('disabled', false);//just in case
        $wk_jq(resetButton).show();

        return false;
    }



    function updateField(product_id,assignqty)
    {

    //  alert("Hello! I am an alert box!!");
        var qtyId           = '#qty_'+ product_id;
        var valueId         = '#valueqty_'+ product_id;
        var updatedqty      = '#updatedqty_'+ product_id;
        var editLink        = "#edit_link_"+ product_id;
        var updateButton    = "#update_button_"+ product_id;
        var resetButton     = "#reset_button"+ product_id;
        var url             = '<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';

        $wk_jq(qtyId).toggle();
        $wk_jq(editLink).hide();
        $wk_jq(updateButton).show();
        $wk_jq(resetButton).show();

        $qty = $wk_jq(qtyId).val();
        jQuery(valueId).html($qty);
        hideReset(product_id);

        var tmpQty = assignqty+parseInt($qty) ;

        new Ajax.Request(url, {
            method: 'post',
            parameters: {id: product_id, qty: tmpQty},
            onComplete: function (transport) {
            //  alert(tmpQty);
                jQuery(priceId).val($price);                
        jQuery(updatedqty).show().delay(2000).fadeOut();
                $updateButton.prop('disabled', false);
            }
        });
    }






</script>

<style>
.social-icons {
      display:none !important; 
    }
</style>
Community
  • 1
  • 1
fresher
  • 917
  • 2
  • 20
  • 55

5 Answers5

3

you error message clearly indicate that your jQuery variable is not defined. simply change this

var $wk_jq = jQuery.noConflict();

to

var $wk_jq = $.noConflict();

Qaisar Satti
  • 2,742
  • 2
  • 18
  • 36
2

uses by default. Since it uses jquery, it is recommended to stick with this default jquery package.

Default jquery is loading from the directory js/lib/jquery/jquery-1.10.2.min.js. If you inspect further you can also see an another jquery file (at /js/lib/jquery/noconflict.js) which is using to avoid jquery conflicts. This is the content of that js file.

// Avoid PrototypeJS conflicts, assign jQuery to $j instead of $
var $j = jQuery.noConflict();

Look at the comment. It says, you should use $j istead of $. That means in order to avoid conflicts, you need to ensure three things.

1) Do not use new jquery package, stick with default one. You dont bother about this step. Magento will load its jquery for you. So please dont add jquery again.

2) Make sure noconflict.js is loading just after default jquery library. This is also managed by default Magento.

3) Now add your magnifier library js file if any (optional step. Requires only when magnifier technique is relying on any jquery package).

4) Use your custom js file which uses magnifier js library. In this file, instead of using $, you should use $j everywhere. This way Magento will not make any jquery conflicts.

rayphi
  • 503
  • 2
  • 14
  • 30
  • i am checking now. will let you know soon. – fresher Mar 17 '16 at 13:13
  • i didt found jquery folder under js/lib folder , i am checking from root of the site. can you please confirm me the path. – fresher Mar 17 '16 at 13:19
  • [Magento Mirror /js/lib/jquery](https://github.com/OpenMage/magento-mirror/tree/magento-1.9/js/lib/jquery) - possibly your magento installation is not clean!? – rayphi Mar 17 '16 at 14:08
2

Likely you aren't loading jQuery on the page. Instead of including jQuery on the page, you should do it through the layout xml. You can even do it for every page on the frontend by adding it to page.xml in your app/design/frontend/package/theme/layout. Once you are sure that you have jQuery loaded on the page, you can choose to either use noconflict as you are, or just replace the '$' with the work jQuery. Please, make sure you're being consistant, I noticed this in your code:

function updateField(product_id,assignqty)
{

//  alert("Hello! I am an alert box!!");
    var qtyId           = '#qty_'+ product_id;
    var valueId         = '#valueqty_'+ product_id;
    var updatedqty      = '#updatedqty_'+ product_id;
    var editLink        = "#edit_link_"+ product_id;
    var updateButton    = "#update_button_"+ product_id;
    var resetButton     = "#reset_button"+ product_id;
    var url             = '<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';

    $wk_jq(qtyId).toggle();
    $wk_jq(editLink).hide();
    $wk_jq(updateButton).show();
    $wk_jq(resetButton).show();

    $qty = $wk_jq(qtyId).val();
    jQuery(valueId).html($qty);
    hideReset(product_id);

    var tmpQty = assignqty+parseInt($qty) ;

    new Ajax.Request(url, {
        method: 'post',
        parameters: {id: product_id, qty: tmpQty},
        onComplete: function (transport) {
        //  alert(tmpQty);
            jQuery(priceId).val($price);                
    jQuery(updatedqty).show().delay(2000).fadeOut();
            $updateButton.prop('disabled', false);
        }
    });
}

You're mixing your noconflict with normal $ variable which are being used by prototype. Examples are $qty, $price, and updatebutton. If you are trying to use php variable here, you must wrap them in a php tag and echo them out.

Zach L
  • 712
  • 4
  • 18
1

The error which you are facing is because you have not given a proper path of jQuery library,that's why your page is not getting jQuery and hence it is showing error jQuery is not defined and $ is not defined.

Kunal Gadhia
  • 350
  • 2
  • 14
1

As i can see jQuery.js is just below the carrousal.js file. Please put the jQuery at the top of the page then use no.Conflict hope this will helps you.

Thnaks

Avik Roy
  • 149
  • 5