Advertisement:

Author Topic: Moving multilanguage_attrinbutes just aftercategories  (Read 217 times)

nightfly13

  • Full Member
  • ***
  • Posts: 103
Moving multilanguage_attrinbutes just aftercategories
« on: January 18, 2019, 09:28:20 pm »
Dear community...

Im trying to move the attributes from multilanguage_attributes plugin to the position just after the categories so i use this function

Code: [Select]
<?php
function klass24_pt_move_attributes() { ?>


    <script type="text/javascript">
        $("#plugin-hook").change(function(){
// Create div with id set to moved_custom_attributes, inserted after descshow
            $("<div></div>").attr('id', 'moved_custom_attributes').insertAfter(".catshow");
// At id moved_custom_attributes append (Acrescentar) the form atr-item
            $("#moved_custom_attributes").append($("atr-form"));
        });
</script>

<?php }

$section Rewrite::newInstance()->get_section();

if (
$section == 'item_add' || $section == 'item_edit'osc_add_hook('footer''klass24_pt_move_attributes');

function 
trigger_plugin_hook() { ?>


    <script type="text/javascript">
        $("#atr-form").remove();
        $("#plugin-hook").change();
    </script>

<?php }

osc_add_hook('item_form''trigger_plugin_hook''2');
osc_add_hook('item_edit''trigger_plugin_hook''2');
?>

The part of the code i want move attributes is just after changing the categories

Code: [Select]
          <!-- CATEGORY -->
          <?php if(osc_get_preference('drop_cat''klass24_pt_theme') == 1) { ?>
            <div class="row catshow multiple">
              <div class="multi-left">
                <label for="catId"><span><?php _e('Category''klass24_pt'); ?></span><span class="req">*</span></label>
              </div>
              <div class="multi-right">
                <?php ItemForm::category_multiple_selects(null$def_cat__('Select a category''klass24_pt')); ?>
              </div>
            </div>
          <?php } else { ?>
            <div class="row catshow">
              <label for="catId"><span><?php _e('Category''klass24_pt'); ?></span><span class="req">*</span></label>
              <?php ItemForm::category_select(null$def_cat__('Select a category''klass24_pt')); ?>
            </div>
          <?php ?>

The attributes was removed from the bottom of item-post and are not shown anymore, but after categories i still don't have the attribules like i want


What i'm doing wrong???? Anyone can help???

Best Regards
Nightfly
« Last Edit: January 18, 2019, 10:01:59 pm by nightfly13 »

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: Moving multilanguage_attrinbutes just aftercategories
« Reply #1 on: January 19, 2019, 07:29:22 pm »
Hello,

Can you check for any console errors (F12 -> Console)?

Regards.

nightfly13

  • Full Member
  • ***
  • Posts: 103
Re: Moving multilanguage_attrinbutes just aftercategories
« Reply #2 on: January 20, 2019, 07:22:18 pm »
Im very close and almost there.... But i still have an issue....

Code: [Select]
<?php
function klass24_pt_move_attributes() { ?>


    <script type="text/javascript">
        $("#plugin-hook").change(function(){

var div1Html = $('#atr-form').html();

       
// Create div with id set to moved_custom_attributes, inserted after descshow
            $("<div></div>").attr('id', 'moved_custom_attributes').insertAfter(".attributes_placement");
// At id moved_custom_attributes append (Acrescentar) the form atr-item
$('#moved_custom_attributes').appendTo( ".attributes_placement" ).html(div1Html);
        });
</script>

<?php }

$section Rewrite::newInstance()->get_section();

if (
$section == 'item_add' || $section == 'item_edit'osc_add_hook('footer''klass24_pt_move_attributes');

function 
trigger_plugin_hook() { ?>


    <script type="text/javascript">
        $("#atr-form").hide();
        $("#plugin-hook").change();
    </script>

<?php }

osc_add_hook('item_form''trigger_plugin_hook''1');
osc_add_hook('item_edit''trigger_plugin_hook''1');
?>

At the moment the attributes field disapear from the bottom of publish new ad and it's placed on the position i want (Before price)...

Issue1:I cant post the listing, because i select on moved attribute fiield the attribute i want but the line on bottom of function $("#atr-form").hide(); it's just hidden but still there waiting for selection... I try $("#atr-form").remove(); biut seems the data was lost and not available to be displayed i moved field form....

Issue2: After choose a categorie with attributes, the attribute field is dysplayed, but if i change the category for one with no attributes the field attributes still there...

Any ideas???

Best Regards
Nightfly