Advertisement:

Author Topic: BUG, price disable not working  (Read 5922 times)

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: BUG, price disable not working
« Reply #15 on: April 26, 2014, 09:19:40 pm »
@searchweb
Ok, found the code that is hiding price:
Code: [Select]
<script type="text/javascript">
var catPriceEnabled = new Array();
catPriceEnabled[75] = 1;catPriceEnabled[76] = 1;catPriceEnabled[82] = 1;catPriceEnabled[85] = 1;catPriceEnabled[91] = 1;catPriceEnabled[93] = 1;catPriceEnabled[94] = 1;   

$("#catId").change(function(){
        var cat_id = $(this).val();
                var url = 'http://demo.osclass.org/jobboard/index.php';
                var result = '';

        if(cat_id != '') {
if(catPriceEnabled[cat_id] == 1) {
$("#price").closest("div").show();
} else {
$("#price").closest("div").hide();
$('#price').val('') ;
}

            $.ajax({
                type: "POST",
                url: url,
                data: 'page=ajax&action=runhook&hook=item_form&catId='   cat_id,
                dataType: 'html',
                success: function(data){
                    $("#plugin-hook").html(data);
                }
            });
        }
    });


    $(document).ready(function(){
        var cat_id = $("#catId").val();
                var url = 'http://demo.osclass.org/jobboard/index.php';
                var result = '';

        if(cat_id != '') {
if(catPriceEnabled[cat_id] == 1) {
$("#price").closest("div").show();
} else {
$("#price").closest("div").hide();
$('#price').val('') ;
}

            $.ajax({
                type: "POST",
                url: url,
                data: 'page=ajax&action=runhook&hook=item_form&catId='   cat_id,
                dataType: 'html',
                success: function(data){
                    $("#plugin-hook").html(data);
                }
            });
        }
    });
</script>

But I am not sure which part of code generate field which category is enabled (catPriceEnabled[75] = 1;catPriceEnabled[76] = 1;catPriceEnabled[82] = 1;catPriceEnabled[85] = 1;catPriceEnabled[91] = 1;catPriceEnabled[93] = 1;catPriceEnabled[94] = 1; ), probably this one:
Code: [Select]
<?php
    $edit 
false;
    if(
Params::getParam('action') == 'item_edit'){
        
$action 'item_edit_post';
        
$edit true;
    }

                        if(
$edit) {
                            
ItemForm::plugin_edit_item();
                        } else {
                            
ItemForm::plugin_post_item();
                        }
?>


searchweb

  • Jr. Member
  • **
  • Posts: 69
Re: BUG, price disable not working
« Reply #16 on: April 27, 2014, 05:19:00 pm »
really thanks for your help.