Advertisement:

Author Topic: Extract Number from Telephone plugin.  (Read 1878 times)

why4all

  • Newbie
  • *
  • Posts: 15
Extract Number from Telephone plugin.
« on: May 29, 2017, 03:06:51 pm »
Hi every one,

I am using Telephone plugin. It display
Quote
Phone: 1234566450
. I want to extract the mobile number for make Call/ SMS Button. Please anybody give solution for this.

altavista

  • Full Member
  • ***
  • Posts: 114
Re: Extract Number from Telephone plugin.
« Reply #1 on: May 30, 2017, 04:01:20 am »
Hi every one,

I am using Telephone plugin. It display
Quote
Phone: 1234566450
. I want to extract the mobile number for make Call/ SMS Button. Please anybody give solution for this.

check..

   <a href="sms:<?php echo osc_user_phone(); ?>"</a>

 <a href="tel:<?php echo osc_user_phone(); ?>">

why4all

  • Newbie
  • *
  • Posts: 15
Re: Extract Number from Telephone plugin.
« Reply #2 on: May 30, 2017, 11:19:04 am »
Hi altavista,

Thanks for your suggestion. But  I am using Telephone plugin. it is useful to get the phone nubmer from item post. Because phone Number varies depending on the post. I tried to below code in item post. 
Code: [Select]
osc_user_phone_mobile
Code: [Select]
osc_user_phone But no result. If you know plz suggest me.

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Extract Number from Telephone plugin.
« Reply #3 on: September 15, 2017, 09:09:52 pm »
Hi every one,

I am using Telephone plugin. It display
Quote
Phone: 1234566450
. I want to extract the mobile number for make Call/ SMS Button. Please anybody give solution for this.

I have been looking to do the same for months now. And yet am still unsuccessful.
Any help would be appreciated.

calinbehtuk

  • Sr. Member
  • ****
  • Posts: 450
Re: Extract Number from Telephone plugin.
« Reply #4 on: September 15, 2017, 10:48:15 pm »
you can try like this
Code: [Select]
$phone = '';
$detail = Modelphone::newInstance()->t_check_value(osc_item_id());
if (isset($detail['s_telephone'])) {
$phone = $detail['s_telephone'];
}
Take notes that this is only an example but you have to adapt this with your code. If the telephone plugin is install on your site you can extract the phone number of an items like this, but only if that item has a phone number set with telephone plugin.
« Last Edit: September 16, 2017, 01:19:45 pm by calinbehtuk »

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Extract Number from Telephone plugin.
« Reply #5 on: September 17, 2017, 10:54:34 pm »
Thank you Calinbehtuk for the solution.

Bu those of us who are still struggling with coding don't really know how to use to code you provided.

The following is what I tried and was unsuccessful. I believe I am not far from getting the whole thing working, but I just don't know how to include your code in what I already have. Can you help?
Below is what I have at the moment:

Code: [Select]
<!-- CALL BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<a href="tel:<?php echo $detail['s_telephone']; ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php } else { ?>
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>

<!-- SEND SMS  BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<a href="sms:<?php echo $detail['s_telephone']; ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php } else { ?>
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>

calinbehtuk

  • Sr. Member
  • ****
  • Posts: 450
Re: Extract Number from Telephone plugin.
« Reply #6 on: September 18, 2017, 11:21:33 am »
Code: [Select]
<?php 
$phone 
'';
$detail Modelphone::newInstance()->t_check_value(osc_item_id());
if (isset(
$detail['s_telephone'])) {
$phone $detail['s_telephone'];
}
?>

<!-- CALL BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="tel:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>

<!-- SEND SMS  BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="sms:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="sms:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Extract Number from Telephone plugin.
« Reply #7 on: September 18, 2017, 02:56:42 pm »
Code: [Select]
<?php 
$phone 
'';
$detail Modelphone::newInstance()->t_check_value(osc_item_id());
if (isset(
$detail['s_telephone'])) {
$phone $detail['s_telephone'];
}
?>

<!-- CALL BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="tel:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>

<!-- SEND SMS  BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="sms:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="sms:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>

Wonderfull!!! Works like a charm.
Thanks a lot

Starpryde

  • Newbie
  • *
  • Posts: 4
Re: Extract Number from Telephone plugin.
« Reply #8 on: January 06, 2018, 07:07:53 pm »
Code: [Select]
<?php 
$phone 
'';
$detail Modelphone::newInstance()->t_check_value(osc_item_id());
if (isset(
$detail['s_telephone'])) {
$phone $detail['s_telephone'];
}
?>

<!-- CALL BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="tel:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>

<!-- SEND SMS  BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="sms:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="sms:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>

Wonderfull!!! Works like a charm.
Thanks a lot
I have been looking for this for a while now. Pls can anybody tell me where to put this?

calinbehtuk

  • Sr. Member
  • ****
  • Posts: 450
Re: Extract Number from Telephone plugin.
« Reply #9 on: January 06, 2018, 07:13:43 pm »
@Starpryde
In area that you want to display the phone, but please take note that the telephone plugin has to be installed on your site and the item has to have a number set with this plugin.
The file that is responsible for item page is item.php

Starpryde

  • Newbie
  • *
  • Posts: 4
Re: Extract Number from Telephone plugin.
« Reply #10 on: January 07, 2018, 08:45:52 pm »
@Starpryde
In the area that you want to display the phone, but please take note that the telephone plugin has to be installed on your site and the item has to have a number set with this plugin.
The file that is responsible for item page is item.php
Thank you, It works. But how can I make this work only on mobile view as desktops are not meant to work that way? Also, I don't know whether I did something wrong, It only shows on only one listing.
« Last Edit: January 08, 2018, 03:49:21 pm by Starpryde »

moinuddin

  • Full Member
  • ***
  • Posts: 102
Re: Extract Number from Telephone plugin.
« Reply #11 on: May 27, 2019, 01:08:16 pm »
Code: [Select]
<?php 
$phone 
'';
$detail Modelphone::newInstance()->t_check_value(osc_item_id());
if (isset(
$detail['s_telephone'])) {
$phone $detail['s_telephone'];
}
?>

<!-- CALL BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="tel:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="tel:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Call Owner') ; ?></strong></a>
<?php ?>

<!-- SEND SMS  BUTTON -->
<?php if (( osc_user_phone_land() == '' ) && ( osc_user_phone_mobile() == '' )) { ?>
<?php if(!empty($phone)){ ?>
<a href="sms:<?php echo $phone?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>
<?php } else { ?>
<a href="sms:<?php echo osc_user_phone(); ?>" class="btn btn-primary-custom col-xs-12"><i class="fa fa-phone-o"></i><strong> <?php _e('Text Owner') ; ?></strong></a>
<?php ?>



your code works fantastically ..but is possible to load pre text sms body ..for example if a person clicks on a sms button ..it should open sms with default text message (link of the page from where sms button was clicked) as many users in osclass are there who post multiple product items ..hence it would be useful for them to know that the sms has came for the particular product which is mentioned on the page with link in the sms body...the whle sms would be like - hi, is this product available - link.