This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

Locan

  • ****
  • 166 posts
hi dear!
i want to show some text when enable user to sell product in osclasspay like safety tip

like show some text like in user group like this


  <?php if(osc_item_user_id() <> 0) { ?>
                    <?php $group_id = ModelOSP::newInstance()->getUserGroup(osc_item_user_id()); ?>
                    <?php if(in_array($group_id, array(3))) { ?>
               
                    <i class="fa fa-check-circle" aria-hidden="true"></i>

                    <?php } else { ?>
                    <?php } ?>

*

MB Themes

In functions.php you should be able to find correct function to check if item is enabled for sale.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Locan

  • ****
  • 166 posts
         i use this code but not work dear. can you help me ?


  <?php if (function_exists('osp_product_to_cart_link')){ ?>
text here
               <?php } else { ?>
text here
               <?php } ?>   

*

MB Themes

name of function says it is not what are you looking for... will check it tomorrow
« Last Edit: June 20, 2018, 01:46:10 PM by MB Themes »
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Locan

  • ****
  • 166 posts
hi dear can you help me

*

MB Themes

Code: [Select]
  $sellers = explode(',', osp_param('seller_users'));
  $html = '';

  if($item_id == -1) {
    $item_id = osc_item_id();
  }

  if(osp_param('selling_allow') == 1 && $item_id <> '' && $item_id > 0) {
    $item = Item::newInstance()->findByPrimaryKey($item_id);
    $data = ModelOSP::newInstance()->getItemData($item_id);
    $qty = @$data['i_quantity'] > 0 ? @$data['i_quantity'] : 0;
    $title = '';

    if(@$data['i_sell'] == 1 && (in_array($item['fk_i_user_id'], $sellers) || osp_param('seller_all') == 1)) {
      if($item['i_price'] <> '' && $item['i_price'] > 0) {
        //$html .= '<div class="osp-product ' . ($is_hook == 1 ? 'osp-is-hook' : '') . '">';

        if(($qty <= 0 && osp_param('stock_management') == 1) || ($item['fk_i_user_id'] == osc_logged_user_id() && osc_is_web_user_logged_in())) {

        } else {
          // yes yes yes, for sale
         
         
        }
      }
    }
  }
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Locan

  • ****
  • 166 posts
not work dear ! not show any thing

Marked as best answer by frosticek on June 20, 2018, 09:24:07 PM
*

Locan

  • ****
  • 166 posts
Code: [Select]
function osp_product_to_cart_link_safety() {
  $sellers = explode(',', osp_param('seller_users'));
  $html = '';

  if($item_id == -1) {
    $item_id = osc_item_id();
  }

  if(osp_param('selling_allow') == 1 && $item_id <> '' && $item_id > 0) {
    $item = Item::newInstance()->findByPrimaryKey($item_id);
    $data = ModelOSP::newInstance()->getItemData($item_id);
    $qty = @$data['i_quantity'] > 0 ? @$data['i_quantity'] : 0;
    $title = '';

    if(@$data['i_sell'] == 1 && (in_array($item['fk_i_user_id'], $sellers) || osp_param('seller_all') == 1)) {
      if($item['i_price'] <> '' && $item['i_price'] > 0) {
        //$html .= '<div class="osp-product ' . ($is_hook == 1 ? 'osp-is-hook' : '') . '">';

        if(($qty <= 0 && osp_param('stock_management') == 1) || ($item['fk_i_user_id'] == osc_logged_user_id() && osc_is_web_user_logged_in())) {

        } else {
                  $html .= 'txt here';

         
         
        }
      }
    }
  }
}
« Last Edit: June 20, 2018, 03:39:49 PM by dom reysor »

*

Locan

  • ****
  • 166 posts
Code: [Select]
        <?php if (function_exists('osp_product_to_cart_link_safety')){ ?>
<?php echo osp_product_to_cart_link_safety(); ?>
           
                    <?php } else { ?>
///text else

                 <?php ?>