*

kriskoyk

  • *****
  • 399 posts
Prohibition of selling dogs to people without a BREEDING license
« on: September 09, 2026, 09:32:05 PM »
When the user posts an ad and selects "YES" in the "DOG BREEDING LICENSE HOLDER" condition, then and only then should the transaction type display the "SELL" option. How is this done?

*

MB Themes

Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #1 on: September 10, 2026, 11:17:53 AM »
That sounds like very specific requirement for dogs selling. Easiest way will be custom code.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 399 posts
Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #2 on: September 19, 2026, 02:00:35 PM »
Can the product brand and model in the plugin (Products Attributes Plugin) be hidden based on a contition selection—such as "used"—by wrapping them in a function like this?
Code: [Select]
<?php if(!osc_is_web_user_logged_in())  { ?>
----------
<?php } ?>

*

kriskoyk

  • *****
  • 399 posts
Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #3 on: September 19, 2026, 07:03:56 PM »
I am wrapping `Item.edit.php` from `products_attributes` with this code, but it doesn't hide the brand and model when the condition is 'Used'.
Code: [Select]
<?php  if ($item_condition = 'Used') { ?>
------
<?php } ?>

*

MB Themes

Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #4 on: September 21, 2026, 12:31:44 PM »
attrbiutes plugins on item post/edit are called via ajax, advanced technique may be required to manage these data in other then standard way.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 399 posts
Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #5 on: September 22, 2026, 11:18:20 AM »
I replaced the code in the `item.edit` file of the Products Attributes plugin with the code below, which I prepared and which works. Is it correct?

Code: [Select]
<h3 id="title-product-attributes" class="product-attributes-h3"><?php _e('Products attributes', 'products_attributes') ; ?></h3>
<table class="product-attributes">
   
    <tr id="row-make">
        <?php if( Session::newInstance()->_getForm('pp_make') != '' ) { $detail['s_make'] = Session::newInstance()->_getForm('pp_make'); } ?>
        <td><label for="prodMake"><?php _e('Make', 'products_attributes'); ?></label></td>
        <td><input type="text" name="prodMake" id="prodMake" value="<?php if(@$detail['s_make'] != ''){echo @$detail['s_make']; } ?>" size="20" /></td>
    </tr>
   
    <tr id="row-model">
        <?php if( Session::newInstance()->_getForm('pp_model') != '' ) { $detail['s_model'] = Session::newInstance()->_getForm('pp_model'); } ?>
        <td><label for="prodModel"><?php _e('Model', 'products_attributes'); ?></label></td>
        <td><input type="text" name="prodModel" id="prodModel" value="<?php if(@$detail['s_model']){echo @$detail['s_model']; } ?>" size="20" /></td>
    </tr>
</table>

<script type="text/javascript">
    jQuery(document).ready(function($) {
       
        var statusField = $('[name="sCondition"]');
        function checkStatus() {           
            if (statusField.val() == '2') {
                $('#title-product-attributes').show();
                $('#row-make').show();
                $('#row-model').show();
            } else {             
                $('#title-product-attributes').hide();
                $('#row-make').hide();
                $('#row-model').hide();
            }
        }     
        checkStatus();       
        statusField.on('change', function() {
            checkStatus();
        });
    });
</script>
« Last Edit: September 22, 2026, 11:24:12 AM by kriskoyk »

*

MB Themes

Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #6 on: September 22, 2026, 02:56:53 PM »
Plugin was updated, if you had issues with it, try to update it first.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 399 posts
Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #7 on: September 22, 2026, 10:24:55 PM »
The plugin is up to date and working correctly. I modified the `item.edit` file so that the make and model appear in the listing based on the condition (Used). It works very well; I was just asking if the code is correct.
Now I am trying to adjust the code in the plugin's `item.detail` file so that the make and model also appear in the view based on the condition (Used).
Here is the code:
Code: [Select]
[code]<h3 style="margin-top: 20px;" class="product-attributes-h3"><?php _e('Products attributes', 'products_attributes') ; ?></h3>
<table class="product-attributes">
  <tbody>
    <tr>
      <td><label for="make"><?php _e('Make', 'products_attributes'); ?></label></td>
      <td><?php echo osc_esc_html(isset($detail['s_make']) ? $detail['s_make'] : ''); ?></td>
    </tr>
    <tr>
      <td><label for="model"><?php _e('Model', 'products_attributes'); ?></label></td>
      <td><?php echo osc_esc_html(isset($detail['s_model']) ? $detail['s_model'] : ''); ?></td>
    </tr>
  </tbody>
</table>
[/code]
Any help with modifying it would be greatly appreciated!

*

kriskoyk

  • *****
  • 399 posts
Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #8 on: September 23, 2026, 03:33:21 PM »
I modified the `item.detail` code to display the brand and model based on the product status, and it works well. Please take a look and let me know if there are any errors.
The code:
Code: [Select]
<?php
global $item_extra;
if (!isset(
$item_extra['i_condition']) && function_exists('bet_item_extra')) {
    
$item_extra = bet_item_extra(osc_item_id());
}
$condition_id = isset($item_extra['i_condition']) ? $item_extra['i_condition'] : '';
$has_make  = !empty($detail['s_make']);
$has_model = !empty($detail['s_model']);
if (
$condition_id == 2 && ($has_make || $has_model)) : ?>

<h3 style="margin-top: 20px;" class="product-attributes-h3"><?php _e('Products attributes', 'products_attributes') ; ?></h3>
<table class="product-attributes">
  <tbody>
    <?php if ($has_make) : ?>
    <tr>
      <td><label for="make"><?php _e('Make', 'products_attributes'); ?></label></td>
      <td><?php echo osc_esc_html($detail['s_make']); ?></td>
    </tr>
    <?php endif; ?>
    <?php if ($has_model) : ?>
    <tr>
      <td><label for="model"><?php _e('Model', 'products_attributes'); ?></label></td>
      <td><?php echo osc_esc_html($detail['s_model']); ?></td>
    </tr>
    <?php endif; ?>
  </tbody>
</table>
<?php endif; ?>

*

MB Themes

Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #9 on: September 24, 2026, 04:57:42 PM »
It looks to be ok 👌
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

kriskoyk

  • *****
  • 399 posts
Re: Prohibition of selling dogs to people without a BREEDING license
« Reply #10 on: September 24, 2026, 05:29:16 PM »
It works perfectly. I’ve done something similar for the features of the Attributes Osclass Plugin as well.