Osclass forums

Development => Themes => Topic started by: byteGator on September 15, 2013, 03:28:36 am

Title: Add Phone Number and other field for Bender Theme
Post by: byteGator on September 15, 2013, 03:28:36 am
To add phone number, we can use custom fields.
But we can also add this field by modify the oc_t_items database.
This is what we must do to add phone number for unregistered user:

Part 1: Modify core

1.1 Modify oc_t_items, add s_contact_phone
see attachment

1.2 Modify oc-include/osclass/installer/struct.sql
add :  s_contact_phone VARCHAR(45) NULL
Code: [Select]
CREATE TABLE /*TABLE_PREFIX*/t_item (
    pk_i_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    fk_i_user_id INT(10) UNSIGNED NULL,
    fk_i_category_id INT(10) UNSIGNED NOT NULL,
    dt_pub_date DATETIME NOT NULL,
    dt_mod_date DATETIME NULL,
    f_price FLOAT NULL,
    i_price BIGINT(20) NULL,
    fk_c_currency_code CHAR(3) NULL,
    s_contact_name VARCHAR(100) NULL,
    s_contact_email VARCHAR(140) NULL,
    s_contact_phone VARCHAR(45) NULL,        <------------ add this line
    s_ip VARCHAR(64) NOT NULL DEFAULT '',
    b_premium TINYINT(1) NOT NULL DEFAULT 0,
    b_enabled TINYINT(1) NOT NULL DEFAULT 1,
    b_active TINYINT(1) NOT NULL DEFAULT 0,
    b_spam TINYINT(1) NOT NULL DEFAULT 0,
    s_secret VARCHAR(40) NULL,
    b_show_email TINYINT(1) NULL,
    dt_expiration datetime NOT NULL DEFAULT '9999-12-31 23:59:59',

1.3 Modify oc-includes/osclass/model/item.php
add: s_contact_phone
Code: [Select]
        function __construct()
        {
            parent::__construct();
            $this->setTableName('t_item');
            $this->setPrimaryKey('pk_i_id');
            $array_fields = array(
                'pk_i_id',
                'fk_i_user_id',
                'fk_i_category_id',
                'dt_pub_date',
                'dt_mod_date',
                'f_price',
                'i_price',
                'fk_c_currency_code',
                's_contact_name',
                's_contact_email',
                's_contact_phone', <---------------- add this line
                'b_premium',
                's_ip',
                'b_enabled',
                'b_active',
                'b_spam',
                's_secret',
                'b_show_email',
                'dt_expiration'
            );
            $this->setFields($array_fields);
        }

1.4 Modify oc-includes/osclass/helpers/hitems.php
Add new function
Code: [Select]
    function osc_item_contact_phone() {
        return (string) osc_item_field("s_contact_phone");
    }

1.5 Modify oc-includes/osclass/helpers/hpremium.php
Add new function
Code: [Select]
    function osc_premium_contact_phone() {
        return (string) osc_premium_field("s_contact_phone");
    }

1.6 Modify oc-includes/osclass/ItemActions.php
1.6.1 at add()
modify from
Code: [Select]
            $contactName       = strip_tags( trim( $aItem['contactName'] ) );
            $contactEmail      = strip_tags( trim( $aItem['contactEmail'] ) );
            $aItem['cityArea'] = osc_sanitize_name( strip_tags( trim( $aItem['cityArea'] ) ) );
            $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );
to
Code: [Select]
            $contactName       = strip_tags( trim( $aItem['contactName'] ) );
            $contactEmail      = strip_tags( trim( $aItem['contactEmail'] ) );
            $contactPhone      = strip_tags( trim( $aItem['contactPhone'] ) );
            $aItem['cityArea'] = osc_sanitize_name( strip_tags( trim( $aItem['cityArea'] ) ) );
            $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );

And from:
Code: [Select]
                $this->manager->insert(array(
                    'fk_i_user_id'          => $aItem['userId'],
                    'dt_pub_date'           => date('Y-m-d H:i:s'),
                    'fk_i_category_id'      => $aItem['catId'],
                    'i_price'               => $aItem['price'],
                    'fk_c_currency_code'    => $aItem['currency'],
                    's_contact_name'        => $contactName,
                    's_contact_email'       => $contactEmail,
                    's_secret'              => $code,
                    'b_active'              => ($active=='ACTIVE'?1:0),
                    'b_enabled'             => $enabled,
                    'b_show_email'          => $aItem['showEmail'],
                    'b_spam'                => $is_spam,
                    's_ip'                  => $aItem['s_ip']
                ));
to
Code: [Select]
                $this->manager->insert(array(
                    'fk_i_user_id'          => $aItem['userId'],
                    'dt_pub_date'           => date('Y-m-d H:i:s'),
                    'fk_i_category_id'      => $aItem['catId'],
                    'i_price'               => $aItem['price'],
                    'fk_c_currency_code'    => $aItem['currency'],
                    's_contact_name'        => $contactName,
                    's_contact_email'       => $contactEmail,
                    's_contact_phone'       => $contactPhone,
                    's_secret'              => $code,
                    'b_active'              => ($active=='ACTIVE'?1:0),
                    'b_enabled'             => $enabled,
                    'b_show_email'          => $aItem['showEmail'],
                    'b_spam'                => $is_spam,
                    's_ip'                  => $aItem['s_ip']
                ));

and from
Code: [Select]
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");
to
Code: [Select]
           $flash_error .=
                ((!osc_validate_text($aItem['contactPhone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['contactPhone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
           
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

1.6.2 at edit()
modify from:
Code: [Select]
                if($aItem['userId'] != '') {
                    $user = User::newInstance()->findByPrimaryKey( $aItem['userId'] );
                    $aItem['userId']      = $aItem['userId'];
                    $aItem['contactName'] = $user['s_name'];
                    $aItem['contactEmail'] = $user['s_email'];
                } else {
                    $aItem['userId']      = NULL;
                }
to
Code: [Select]
                if($aItem['userId'] != '') {
                    $user = User::newInstance()->findByPrimaryKey( $aItem['userId'] );
                    $aItem['userId']      = $aItem['userId'];
                    $aItem['contactName'] = $user['s_name'];
                    $aItem['contactEmail'] = $user['s_email'];
                    $aItem['contactPhone'] = ($user['s_phone_mobile'])? $user['s_phone_mobile'] : $user['s_phone_land'];
                } else {
                    $aItem['userId']      = NULL;
                }

and from:
Code: [Select]
                if( $this->is_admin ) {
                    $aUpdate['fk_i_user_id']    = $aItem['userId'];
                    $aUpdate['s_contact_name']  = $aItem['contactName'];
                    $aUpdate['s_contact_email'] = $aItem['contactEmail'];
                } else {
                    $aUpdate['s_ip'] = $aItem['s_ip'];
                }
to
Code: [Select]
                if( $this->is_admin ) {
                    $aUpdate['fk_i_user_id']    = $aItem['userId'];
                    $aUpdate['s_contact_name']  = $aItem['contactName'];
                    $aUpdate['s_contact_email'] = $aItem['contactEmail'];
                    $aUpdate['s_contact_phone'] = $aItem['contactPhone'];
                } else {
                    $aUpdate['s_ip'] = $aItem['s_ip'];
                }

and from
Code: [Select]
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");
to
Code: [Select]
           $flash_error .=
                ((!osc_validate_text($aItem['contactPhone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['contactPhone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
           
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

1.6.3 at preparedata()
from:
Code: [Select]
            if($userId != null) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
            }
to
Code: [Select]
            if($userId != null) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                $aItem['contactPhone']  = ($data['s_phone_mobile'])? $data['s_phone_mobile'] : $data['s_phone_land'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
                Params::setParam('contactPhone', ($data['s_phone_mobile'])? $data['s_phone_mobile'] : $data['s_phone_land']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
                $aItem['contactPhone']  = Params::getParam('contactPhone');
            }

1.7 Modify oc-includes/osclass/frm/item.form.class.php
add function contact_phone_text()
Code: [Select]
        static public function contact_phone_text($item = null) {
            if($item==null) { $item = osc_item(); };
            if( Session::newInstance()->_getForm('contactPhone') != "" ) {
                $item['s_contact_phone'] = Session::newInstance()->_getForm('contactPhone');
            }
            parent::generic_input_text('contactPhone', (isset($item['s_contact_phone'])) ? $item['s_contact_phone'] : null);
            return true;
        }

continue..........
Title: Re: Add Phone Number field for Bender Theme
Post by: strata on September 15, 2013, 03:32:07 am
Waiting for the next part bro (ane tunggu kelanjutannya gan)...salam kenal ya bang :)
Title: Re: Add Phone Number field for Bender Theme
Post by: byteGator on September 15, 2013, 03:46:48 am
Part 2 Modify Themes

2.1 Modify oc-content/themes/bender/item-sidebar.php
under
Code: [Select]
                <h2><?php _e("Contact publisher"'bender'); ?></h2>
                <p class="name"><?php echo osc_item_contact_name(); ?><p>
add this to show phone number
Code: [Select]
                $phoneuser = osc_item_contact_phone();
                if ($phoneuser != "") { ?>
                        <p>Phone: <?php echo $phoneuser?></p>
                <?php ?>

2.2 Modify oc-content/themes/bender/item-post.php
below email field.
Code: [Select]
                            <div class="control-group">
                                <label class="control-label" for="contactEmail"><?php _e('E-mail''bender'); ?></label>
                                <div class="controls">
                                <?php ItemForm::contact_email_text(); ?>
                                </div>
                            </div>
add phone field.
Code: [Select]
                            <div class="control-group">
                                <label class="control-label" for="contactEmail"><?php _e('E-mail''bender'); ?></label>
                                <div class="controls">
                                <?php ItemForm::contact_email_text(); ?>
                                </div>
                            </div>

                            <div class="control-group">
                                <label class="control-label" for="contactPhone"><?php _e('Phone''bender'); ?></label>
                                <div class="controls">
                                <?php ItemForm::contact_phone_text(); ?>
                                </div>
                            </div>

2.3 Modify oc-admin/themes/modern/items/frm.php
below
Code: [Select]
                                <div class="input-has-placeholder input-separate-top">
                                    <label><?php _e('E-mail'); ?></label>
                                    <?php ItemForm::contact_email_text(); ?>
                                </div>
add phone field.
Code: [Select]
                                <div class="input-has-placeholder input-separate-top">
                                    <label><?php _e('E-mail'); ?></label>
                                    <?php ItemForm::contact_email_text(); ?>
                                </div>

                                <?php if( osc_item_user_id() == null ) { ?>
                                    <div class="input-has-placeholder input-separate-top">
                                        <label><?php _e('Phone'); ?></label>
                                        <?php ItemForm::contact_phone_text(); ?>
                                    </div>
                                <?php ?>

Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on September 15, 2013, 04:02:00 am
Part 3: to add other field

We can follow tutorial Part1 and Part2 above to add other text field, with very little differences below.
I can explain in detail. It must be adjusted according to your need.

3.1 at oc-admin/themes/modern/items/frm.php
We don't need "if (osc_item_user_id() == null) so change
Code: [Select]
                                <?php if( osc_item_user_id() == null ) { ?>
                                    <div class="input-has-placeholder input-separate-top">
                                        <label><?php _e('Phone'); ?></label>
                                        <?php ItemForm::contact_phone_text(); ?>
                                    </div>
                                <?php ?>
to
Code: [Select]
                                    <div>
                                        <label><?php _e('Sometext'); ?></label>
                                        <?php ItemForm::sometext_text(); ?>
                                    </div>
and place it where you want to add this field.

3.2 at oc-content/themes/bender/item-post.php
Place it outside Seller Info.
If you place <?php ItemForm::some_text(); ?> at Seller Info, it will only appear for non registered user.

3.3 be carefull at ItemActions.php
You must put your code outside "if" condition.
Adjust it according to your need.

3.4 for Buy / Sell option
For buy sell option you can use this field at struct.sql
Code: [Select]
    e_newused ENUM('NEW', 'USED') NOT NULL DEFAULT 'NEW',
and adjust your code.
Title: Re: Add Phone Number field for Bender Theme
Post by: byteGator on September 15, 2013, 04:52:18 am
Waiting for the next part bro (ane tunggu kelanjutannya gan)...salam kenal ya bang :)

Thank you
Title: Re: Add Phone Number and other field for Bender Theme
Post by: TheDeadLives on September 15, 2013, 06:44:15 pm
Quote
3.4 for Buy / Sell option
For buy sell option you can use this field at struct.sql
Code: [Select]
    e_newused ENUM('NEW', 'USED') NOT NULL DEFAULT 'NEW',
and adjust your code.

Thanks for sharing it.

If you want to create a phone field for non-registered users with a checkbox to hide/show phone in item.php see here the code

http://forums.osclass.org/development/new-field-in-item-post-php-help (http://forums.osclass.org/development/new-field-in-item-post-php-help)
Title: Re: Add Phone Number and other field for Bender Theme
Post by: TheDeadLives on September 15, 2013, 10:56:57 pm
At your themes folder, go to item-post.php and add this code where you want the box for contact phone to appear (in this version, the code has a button for hide or show the contact phone in the item page):

Code: [Select]
<div class="row">
                            <label for="contactPhone"><?php _e('Phone''modern'); ?> *</label>
                            <?php ItemForm::contact_phone_text(); ?>
                        </div>
                          <div class="row">
                            <div style="width: 120px;text-align: right;float:left;">
                                <?php ItemForm::show_phone_checkbox(); ?>
                            </div>
                             <label for="showPhone" style="width: 250px;"><?php _e('Show e-mail on the listing page''modern'); ?></label>
                        </div>

Go to you themes folder, item.php and add this where you want the contact phone to appear:

Code: [Select]
<?php if( osc_item_show_phone() ) { ?>
                            <p class="phone"><?php _e('Phone''modern'); ?>: <?php echo osc_item_contact_phone(); ?></p>
                        <?php ?>

Now, the hard part. Go to osclass/oc-includes/osclass/frm and open Item.form.class.php. Add:

Code: [Select]
static public function contact_phone_text($item = null) {
            if($item==null) { $item = osc_item(); };
            if( Session::newInstance()->_getForm('contactPhone') != "" ) {
                $item['s_contact_phone'] = Session::newInstance()->_getForm('contactPhone');
            }
            parent::generic_input_text('contactPhone', (isset($item['s_contact_phone'])) ? $item['s_contact_phone'] : null);
            return true;
        }
static public function show_phone_checkbox($item = null) {
            if($item==null) { $item = osc_item(); };
            if( Session::newInstance()->_getForm('showPhone') != 0) {
                $item['b_show_phone'] = Session::newInstance()->_getForm('showPhone');
            }
            parent::generic_input_checkbox('showPhone', '1', (isset($item['b_show_phone']) ) ? $item['b_show_phone'] : false );
            return true;
        }

Now go to osclass/oc-includes/osclass/ItemActions.php

Change this:

Code: [Select]
if($userId != null) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
            }

For this:
Code: [Select]
if($userId != null) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
$aItem['contactPhone']  = Params::getParam('contactPhone');
            }
This:

 
Code: [Select]
$aItem['price']    = !is_null($aItem['price']) ? strip_tags( trim( $aItem['price'] ) ) : $aItem['price'];
            $contactName       = osc_sanitize_name( strip_tags( trim( $aItem['contactName'] ) ) );
            $contactEmail      = strip_tags( trim( $aItem['contactEmail'] ) );
            $aItem['cityArea'] = osc_sanitize_name( strip_tags( trim( $aItem['cityArea'] ) ) );
            $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );

For this:

Code: [Select]
$aItem['price']    = !is_null($aItem['price']) ? strip_tags( trim( $aItem['price'] ) ) : $aItem['price'];
            $contactName       = osc_sanitize_name( strip_tags( trim( $aItem['contactName'] ) ) );
            $contactEmail      = strip_tags( trim( $aItem['contactEmail'] ) );
$contactPhone      = strip_tags( trim( $aItem['contactPhone'] ) );
            $aItem['cityArea'] = osc_sanitize_name( strip_tags( trim( $aItem['cityArea'] ) ) );
            $aItem['address']  = osc_sanitize_name( strip_tags( trim( $aItem['address'] ) ) );

This:

Code: [Select]
'fk_i_user_id'          => $aItem['userId'],
                    'dt_pub_date'           => date('Y-m-d H:i:s'),
                    'fk_i_category_id'      => $aItem['catId'],
                    'i_price'               => $aItem['price'],
                    'fk_c_currency_code'    => $aItem['currency'],
                    's_contact_name'        => $contactName,
                    's_contact_email'       => $contactEmail,
                    's_secret'              => $code,
                    'b_active'              => ($active=='ACTIVE'?1:0),
                    'b_enabled'             => 1,
                    'b_show_email'          => $aItem['showEmail'],
                    's_ip'                  => $aItem['s_ip']

For this:

Code: [Select]
'fk_i_user_id'          => $aItem['userId'],
                    'dt_pub_date'           => date('Y-m-d H:i:s'),
                    'fk_i_category_id'      => $aItem['catId'],
                    'i_price'               => $aItem['price'],
                    'fk_c_currency_code'    => $aItem['currency'],
                    's_contact_name'        => $contactName,
                    's_contact_email'       => $contactEmail,
    's_contact_phone'       => $contactPhone,
                    's_secret'              => $code,
                    'b_active'              => ($active=='ACTIVE'?1:0),
                    'b_enabled'             => 1,
                    'b_show_email'          => $aItem['showEmail'],
    'b_show_phone'          => $aItem['showPhone'],
                    's_ip'                  => $aItem['s_ip']
This:

 
Code: [Select]
if( $this->is_admin ) {
                    $aUpdate['fk_i_user_id']    = $aItem['userId'];
                    $aUpdate['s_contact_name']  = $aItem['contactName'];
                    $aUpdate['s_contact_email'] = $aItem['contactEmail'];
                } else {
                    $aUpdate['s_ip'] = $aItem['s_ip'];
                }

For this:

Code: [Select]
  if( $this->is_admin ) {
                    $aUpdate['fk_i_user_id']    = $aItem['userId'];
                    $aUpdate['s_contact_name']  = $aItem['contactName'];
                    $aUpdate['s_contact_email'] = $aItem['contactEmail'];
                    $aUpdate['s_contact_phone'] = $aItem['contactPhone'];
                } else {
                    $aUpdate['s_ip'] = $aItem['s_ip'];
                }

Now in osclass/oc-includes/osclass/installer/struct.sql. Modify this:

Code: [Select]
CREATE TABLE /*TABLE_PREFIX*/t_item (
    pk_i_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    fk_i_user_id INT(10) UNSIGNED NULL,
    fk_i_category_id INT(10) UNSIGNED NOT NULL,
    dt_pub_date DATETIME NOT NULL,
    dt_mod_date DATETIME NULL,
    f_price FLOAT NULL,
    i_price BIGINT(20) NULL,
    fk_c_currency_code CHAR(3) NULL,
    s_contact_name VARCHAR(100) NULL,
    s_contact_email VARCHAR(140) NULL,
    s_ip VARCHAR(64) NOT NULL DEFAULT '',
    b_premium TINYINT(1) NOT NULL DEFAULT 0,
    b_enabled TINYINT(1) NOT NULL DEFAULT 1,
    b_active TINYINT(1) NOT NULL DEFAULT 0,
    b_spam TINYINT(1) NOT NULL DEFAULT 0,
    s_secret VARCHAR(40) NULL,
    b_show_email TINYINT(1) NULL,
    dt_expiration datetime NOT NULL DEFAULT '9999-12-31 23:59:59',

        PRIMARY KEY (pk_i_id),
        FOREIGN KEY (fk_i_user_id) REFERENCES /*TABLE_PREFIX*/t_user (pk_i_id),
        FOREIGN KEY (fk_i_category_id) REFERENCES /*TABLE_PREFIX*/t_category (pk_i_id),
        FOREIGN KEY (fk_c_currency_code) REFERENCES /*TABLE_PREFIX*/t_currency (pk_c_code),

        INDEX (fk_i_user_id),
        INDEX idx_s_contact_email (s_contact_email(10)),
        INDEX (fk_i_category_id),
        INDEX (fk_c_currency_code),
        INDEX idx_pub_date (dt_pub_date),
        INDEX idx_price (i_price)
) ENGINE=InnoDB DEFAULT CHARACTER SET 'UTF8' COLLATE 'UTF8_GENERAL_CI';

For this:

Code: [Select]
CREATE TABLE /*TABLE_PREFIX*/t_item (
    pk_i_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    fk_i_user_id INT(10) UNSIGNED NULL,
    fk_i_category_id INT(10) UNSIGNED NOT NULL,
    dt_pub_date DATETIME NOT NULL,
    dt_mod_date DATETIME NULL,
    f_price FLOAT NULL,
    i_price BIGINT(20) NULL,
    fk_c_currency_code CHAR(3) NULL,
    s_contact_name VARCHAR(100) NULL,
    s_contact_email VARCHAR(140) NULL,
    s_contact_phone VARCHAR(15) NULL,
    s_ip VARCHAR(64) NOT NULL DEFAULT '',
    b_premium TINYINT(1) NOT NULL DEFAULT 0,
    b_enabled TINYINT(1) NOT NULL DEFAULT 1,
    b_active TINYINT(1) NOT NULL DEFAULT 0,
    b_spam TINYINT(1) NOT NULL DEFAULT 0,
    s_secret VARCHAR(40) NULL,
    b_show_email TINYINT(1) NULL,
    b_show_phone TINYINT(1) NULL,
    dt_expiration datetime NOT NULL DEFAULT '9999-12-31 23:59:59',

        PRIMARY KEY (pk_i_id),
        FOREIGN KEY (fk_i_user_id) REFERENCES /*TABLE_PREFIX*/t_user (pk_i_id),
        FOREIGN KEY (fk_i_category_id) REFERENCES /*TABLE_PREFIX*/t_category (pk_i_id),
        FOREIGN KEY (fk_c_currency_code) REFERENCES /*TABLE_PREFIX*/t_currency (pk_c_code),

        INDEX (fk_i_user_id),
        INDEX idx_s_contact_email (s_contact_email(10)),
        INDEX (fk_i_category_id),
        INDEX (fk_c_currency_code),
        INDEX idx_pub_date (dt_pub_date),
        INDEX idx_price (i_price)
) ENGINE=InnoDB DEFAULT CHARACTER SET 'UTF8' COLLATE 'UTF8_GENERAL_CI';

In helpers, open hPreference.php. And add:

Code: [Select]
function osc_contact_phone() {
        return(getPreference('contactPhone'));
    }

And, still in the helpers paste, open hItems.php and add this:

Code: [Select]
function osc_item_show_phone() {
        return (boolean) osc_item_field("b_show_phone");
    }

Very IMPORTANT - go to your themes folder and open style.css Add this code:

Code: [Select]
.add_item input#showPhone { border:1px solid #BBB; padding:7px 7px 6px; width:20px; }
Title: Re: Add Phone Number and other field for Bender Theme
Post by: lexosc on October 01, 2013, 07:26:28 pm
Thanks a lot bytegator! works nice!
if you have time can you show how to make phone and mail hide like you have in http://iklangratis.org ?
Title: Re: Add Phone Number and other field for Bender Theme
Post by: blue_man on October 08, 2013, 08:48:04 pm
I made the changes specified, but can not add ads. I using version 3.2.1.
Rhank you all
Title: Re: Add Phone Number and other field for Bender Theme
Post by: rahulk on October 12, 2013, 07:41:01 pm
Hello byteGator

Can you share code for browsing categories with subcategories like this site http://iklangratis.org/

I am using osclass 3.2.1 with default bender theme.

Thank you!
Title: Re: Add Phone Number and other field for Bender Theme
Post by: shamim_biplob on October 13, 2013, 01:48:18 am
how can i make phone field required (server side validation)?
please help me.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on October 14, 2013, 03:11:16 am
Hello byteGator

Can you share code for browsing categories with subcategories like this site http://iklangratis.org/

I am using osclass 3.2.1 with default bender theme.

Thank you!

Hi rahulk,

I don't know what you mean. Need more explaination.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on October 14, 2013, 03:26:11 am
how can i make phone field required (server side validation)?
please help me.

Hi shamim_biplob
nice catch.

At ItemAction.php, function add() and edit(), above
Code: [Select]
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

add this

Code: [Select]
            $flash_error .=
                ((!osc_validate_text($aItem['contactPhone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['contactPhone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
           
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");
Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on October 14, 2013, 06:22:13 am
Thanks a lot bytegator! works nice!
if you have time can you show how to make phone and mail hide like you have in http://iklangratis.org ?

hi alexgr

I have answer it in :

http://forums.osclass.org/themes/%28tips%29-how-to-hide-last-4-digit-phone-number/msg71105
Title: Re: Add Phone Number and other field for Bender Theme
Post by: shamim_biplob on October 14, 2013, 01:13:01 pm
Thanks a lot bytegator! works nice!
if you have time can you show how to make phone and mail hide like you have in http://iklangratis.org ?

you like this type of phone number hide?
http://www.banglardokan.com/electronics/laptopstablets/dell-vostro-1014-i4521

i can share code.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: shamim_biplob on October 14, 2013, 02:22:53 pm
Quote
At ItemAction.php, function add() and edit(), above
Code: [Select]
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

add this

Code: [Select]
            $flash_error .=
                ((!osc_validate_text($aItem['s_contact_phone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['s_contact_phone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
           
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

I tried this before. but dont know why this is not working for me. if my client side validation failed, item publish. my server side validation work for location, title, description.. i tried following code but no result.
Code: [Select]
$flash_error .=
((!osc_validate_text($aItem['s_contact_phone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
((!osc_validate_number($aItem['s_contact_phone'])) ? _m("Invalid phone number.") . PHP_EOL : '' ) .
                                ((!osc_validate_max($aItem['s_contact_phone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );

i tried the code after ((!osc_validate_email($contactEmail)) ? _m("Email invalid.") . PHP_EOL : '' ) . also(without $flash_error .=)  but no result.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on October 15, 2013, 08:06:29 am
Thanks a lot bytegator! works nice!
if you have time can you show how to make phone and mail hide like you have in http://iklangratis.org ?

you like this type of phone number hide?
http://www.banglardokan.com/electronics/laptopstablets/dell-vostro-1014-i4521

i can share code.

Hi Shamim...

Yes, it is nice. Please share it.

Thanks.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on October 15, 2013, 09:07:17 am
Quote
At ItemAction.php, function add() and edit(), above
Code: [Select]
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

add this

Code: [Select]
            $flash_error .=
                ((!osc_validate_text($aItem['s_contact_phone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['s_contact_phone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
           
            $_meta = Field::newInstance()->findByCategory($aItem['catId']);
            $meta = Params::getParam("meta");

I tried this before. but dont know why this is not working for me. if my client side validation failed, item publish. my server side validation work for location, title, description.. i tried following code but no result.
Code: [Select]
$flash_error .=
((!osc_validate_text($aItem['s_contact_phone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
((!osc_validate_number($aItem['s_contact_phone'])) ? _m("Invalid phone number.") . PHP_EOL : '' ) .
                                ((!osc_validate_max($aItem['s_contact_phone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );

i tried the code after ((!osc_validate_email($contactEmail)) ? _m("Email invalid.") . PHP_EOL : '' ) . also(without $flash_error .=)  but no result.

Hi shamim_biplob

Sorry, I made a mistake.
Please change 's_contact_phone' to 'contactPhone'

Code: [Select]
            $flash_error .=
                ((!osc_validate_text($aItem['contactPhone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['contactPhone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );
Title: Re: Add Phone Number and other field for Bender Theme
Post by: shamim_biplob on October 15, 2013, 12:36:51 pm
Quote
Hi shamim_biplob

Sorry, I made a mistake.
Please change 's_contact_phone' to 'contactPhone'

Code: [Select]
            $flash_error .=
                ((!osc_validate_text($aItem['contactPhone'], 7, false)) ? _m("Phone Number too short.") . PHP_EOL : '' ) .
                ((!osc_validate_max($aItem['contactPhone'], 20)) ? _m("Phone Number too long.") . PHP_EOL : '' );

thank you for your reply and it is working nice..


can u help me little more?

in item-post.php

we use <?php ItemForm::title_input('title',osc_locale_code(), osc_esc_html( bender_item_title() )); ?>

but if we see the source code of publish ad page we find <input id="title[en_US]" type="text" name="title[en_US]" value=""/>

how we get that?
in item.form.class.php i can not find anything. can you help me? i want to make more like placeholder, maxlength etc but dont know how?
what does it mean by generic_input_text?
                   
Title: Re: Add Phone Number and other field for Bender Theme
Post by: byteGator on October 16, 2013, 06:00:15 am
Quote
in item-post.php

we use <?php ItemForm::title_input('title',osc_locale_code(), osc_esc_html( bender_item_title() )); ?>

but if we see the source code of publish ad page we find <input id="title[en_US]" type="text" name="title[en_US]" value=""/>

how we get that?
in item.form.class.php i can not find anything. can you help me? i want to make more like placeholder, maxlength etc but dont know how?
what does it mean by generic_input_text?
                 

Osclass is design for multilanguage. Therefore an item can have more than one title and description. Each one have different languange. For example, an Item can have title[en_US] = 'Car', title[id_ID] = 'Mobil', title[spain] = 'Coche'.

If you want to add placeholder and maxlength, you can not use default generic_input_text. Or you must modify it.

For example:
Code: [Select]
        static protected function generic_textarea($name, $value, $maxLength = null, $rowlen = 10) {
            echo '<textarea id="' . preg_replace('|([^_a-zA-Z0-9-]+)|', '', $name) . '" name="' . $name . '" rows="' . $rowlen . '" ';
            if (isset($maxLength)) echo 'maxlength="' . $maxLength . '" ';
            echo '>' . $value . '</textarea>';
        }

Or modify just item.form.class / user.form.class:

Code: [Select]
        static public function info_textarea($name, $locale = 'en_US', $value = '') {
            echo '<textarea id="' . $name . $locale. '" name="' . $name . '[' . $locale . ']" rows="10" maxlength="512" placeholder="Put your information here....">' . $value . '</textarea>';
        }


 
Title: Re: Add Phone Number and other field for Bender Theme
Post by: shamim_biplob on October 16, 2013, 07:40:02 am
thank you so much. i didn't know in form.form.class there is everything. i searched, but didn't get it before.

this is multilanguage script thats why after title there is like [en_US]. but for that my following script is not working for title or description field, it is working for price field. if i remove [en_US] than it works but in database nothing save. any way to make it works for description field?

Code: [Select]
<script>

$(document).ready(function () {

  $('#price').keypress(function (event) {
    var max = 250;
    var len = $(this).val().length;

    if (event.which < 0x20) {
      // e.which < 0x20, then it's not a printable character
      // e.which === 0 - Not a character
      return; // Do nothing
    }

    if (len >= max) {
      event.preventDefault();
    }

  });

  $('#price').keyup(function (event) {
    var max = 250;
    var len = $(this).val().length;
    var char = max - len;

    $('#textleft').text(char + ' characters left');

  });

});

</script>
Code: [Select]
<div id="textleft">250 characters left</div>
Title: Re: Add Phone Number and other field for Bender Theme
Post by: res909 on October 19, 2013, 01:02:21 am
Thank very much for this! I used it to add Phone number and web.

It doesn't work when a user goes back to edit them though.  It does work when I edit it in admin.

Please can you help?
Title: Re: Add Phone Number and other field for Bender Theme
Post by: plesk on October 27, 2013, 06:51:36 pm
hello

I use the themes I have not France that item-sidebar.php file and the line item-post.php
how? thank you
<div class="control-group">
                                 <label class="control-label" for="contactEmail"> <php _e? ('E-mail', 'bender')> </ label>
                                 <div class = "contrĂ´les"> <ItemForm php? Contact_email_text :: ()> </ div>
Title: Re: Add Phone Number and other field for Bender Theme
Post by: plesk on October 28, 2013, 02:21:19 am
you like this type of phone number hide?
http://www.banglardokan.com/electronics/laptopstablets/dell-vostro-1014-i4521
Title: Re: Add Phone Number and other field for Bender Theme
Post by: lexosc on October 28, 2013, 03:15:41 am
you like this type of phone number hide?
http://www.banglardokan.com/electronics/laptopstablets/dell-vostro-1014-i4521
how did you do that?
Title: Re: Add Phone Number and other field for Bender Theme
Post by: shamim_biplob on October 28, 2013, 09:14:39 am
find in item-sidebar.php

Code: [Select]
<?php if( osc_item_show_email() ) { ?>
                <p class="email"><?php printf(__('E-mail: %s''bender'), osc_item_contact_email()); ?></p>
            <?php ?>
For phone number hide ad the following code bellow this code in item-sidebar.php (or wherever you want)
Code: [Select]
<?php if ( osc_item_contact_phone() ) { ?>
<div><button>Click for Mobile Number</button>      <p style="display: none"> <img src="<?php echo osc_current_web_theme_url('images/tel.png') ; ?>" alt="" title="custom_fields" style="float:left; margin-right:4px; margin-top:0px;">
 <?php echo osc_item_contact_phone(); ?></p>
        <script>$("button").click(function () {  $("p").show("slow");  $(this).hide();});</script></div>
            <?php ?>

and attachment image in your theme image folder

you can also change itemAction.php if you want.(remember this is core file and all change will be gone after update.)

find code
Code: [Select]
        if($aItem['userId'] != '') {
                    $user = User::newInstance()->findByPrimaryKey( $aItem['userId'] );
                    $aItem['userId']      = $aItem['userId'];
                    $aItem['contactName'] = $user['s_name'];
                    $aItem['contactEmail'] = $user['s_email'];

replace with
Code: [Select]
        if($aItem['userId'] != '') {
                    $user = User::newInstance()->findByPrimaryKey( $aItem['userId'] );
                    $aItem['userId']      = $aItem['userId'];
                    $aItem['contactName'] = $user['s_name'];
                    $aItem['contactEmail'] = $user['s_email'];
                    $aItem['contactPhone'] = ($user['s_phone_mobile'])? $user['s_phone_mobile'] : $user['s_phone_land'];





can anyone help us about this topic?

http://forums.osclass.org/general-help/refine-location-like-refine-category
Title: Re: Add Phone Number and other field for Bender Theme
Post by: plesk on October 28, 2013, 10:53:29 pm
good evening
weird is the line the other I can not find

I have not the line <p class="name"> <osc_item_contact_name php echo ()?> <p>


Code: [Select]
Part 2 Modify Themes

2.1 Modify oc-content/themes/bender/item-sidebar.php
under
Code: [Select]
                <h2><?php _e("Contact publisher"'bender'); ?></h2>
                <p class="name"><?php echo osc_item_contact_name(); ?><p>
add this to show phone number
Code: [Select]
                $phoneuser = osc_item_contact_phone();
                if ($phoneuser != "") { ?>
                        <p>Phone: <?php echo $phoneuser?></p>
                <?php ?>


I am not here understands what I do right? I am French

if can be

I have found this code
<? php if (osc_item_user_id () == null) {>
                                     <div class="input-has-placeholder input-separate-top">
                                         <label> <php _e ('Phone');?> </ label>
                                         <php ItemForm :: contact_phone_text ();?>
                                     </ div>
                                 <? php}>

So if I understand I renplacer by one the is his?

<div>
                                         <label> <php _e ('sometext');?> </ label>
                                         <php ItemForm :: sometext_text ();?>
                                     </ div>

or do you have any picture that I understand better

thank you


Code: [Select]
Part 3: to add other field

We can follow tutorial Part1 and Part2 above to add other text field, with very little differences below.
I can explain in detail. It must be adjusted according to your need.

3.1 at oc-admin/themes/modern/items/frm.php
We don't need "if (osc_item_user_id() == null) so change
Code: [Select]
                                <?php if( osc_item_user_id() == null ) { ?>
                                    <div class="input-has-placeholder input-separate-top">
                                        <label><?php _e('Phone'); ?></label>
                                        <?php ItemForm::contact_phone_text(); ?>
                                    </div>
                                <?php ?>
to
Code: [Select]
                                    <div>
                                        <label><?php _e('Sometext'); ?></label>
                                        <?php ItemForm::sometext_text(); ?>
                                    </div>
and place it where you want to add this field.

3.2 at oc-content/themes/bender/item-post.php
Place it outside Seller Info.
If you place <?php ItemForm::some_text(); ?> at Seller Info, it will only appear for non registered user.

3.3 be carefull at ItemActions.php
You must put your code outside "if" condition.
Adjust it according to your need.

3.4 for Buy / Sell option
For buy sell option you can use this field at struct.sql
Code: [Select]
    e_newused ENUM('NEW', 'USED') NOT NULL DEFAULT 'NEW',
and adjust your code.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: plesk on November 01, 2013, 09:22:30 pm
hello to the other topics moden France etc. thank you
Title: Re: Add Phone Number and other field for Bender Theme
Post by: govind129 on February 01, 2014, 04:16:28 pm
help
only non registered user's mobile number is saving in database
and registered user's not
please help me
Title: Re: Add Phone Number and other field for Bender Theme
Post by: abatahir on February 10, 2014, 10:21:35 pm
I am  using bender theme. I find <div class="control-group">
                                <label class="control-label" for="contactName"><?php _e('Name', 'bender'); ?></label>
                                <div class="controls">
                                    <?php ItemForm::contact_name_text(); ?>
                                </div>
                            </div>   

for name i want like this for phone number ... any one can help me.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Nicolas30 on March 15, 2014, 08:14:33 pm
Hello everyone,

Fields telephone does not appear for the users registered student

How can I show it fields (for the addition of an announcement)?

Thanks for your answers

Regards
Title: Re: Add Phone Number and other field for Bender Theme
Post by: soymarketing on March 18, 2014, 09:13:27 am
Hello everyone! I need some help here... I don't know exactly what went wrong, the item sidebar disappears and i get the following error: Parse error: syntax error, unexpected '}' in /oc-content/themes/bender/item-sidebar.php on line 45

Any clues??
Title: Re: Add Phone Number and other field for Bender Theme
Post by: diegomonse on March 25, 2014, 01:47:04 am
good evening
weird is the line the other I can not find

I have not the line <p class="name"> <osc_item_contact_name php echo ()?> <p>


Code: [Select]
Part 2 Modify Themes

2.1 Modify oc-content/themes/bender/item-sidebar.php
under
Code: [Select]
                <h2><?php _e("Contact publisher"'bender'); ?></h2>
                <p class="name"><?php echo osc_item_contact_name(); ?><p>
add this to show phone number
Code: [Select]
                $phoneuser = osc_item_contact_phone();
                if ($phoneuser != "") { ?>
                        <p>Phone: <?php echo $phoneuser?></p>
                <?php ?>


I am not here understands what I do right? I am French

In Osclass 3.3.2, in line 59 approximately

Code: [Select]
<?php if( osc_item_user_id() != null ) { ?>
                <p class="name"><?php _e('Name''bender'?>: <a href="<?php echo osc_user_public_profile_urlosc_item_user_id() ); ?>" ><?php echo osc_item_contact_name(); ?></a></p>

               <?php $phoneuser osc_item_contact_phone();
                if (
$phoneuser != "") { ?>

                        <p>Phone: <?php echo $phoneuser?></p>
                <?php ?>

add <?php before $phoneuser
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Media DMJ on March 26, 2014, 10:16:09 pm
Thank you  :)
Title: Re: Add Phone Number and other field for Bender Theme
Post by: leboncoin on March 27, 2014, 09:47:54 pm
I think phone number filed for non registered users is a necessity - and should be added in the next update of osclass!
Title: Re: Add Phone Number and other field for Bender Theme
Post by: strata on March 28, 2014, 04:28:30 am
Hello everyone! I need some help here... I don't know exactly what went wrong, the item sidebar disappears and i get the following error: Parse error: syntax error, unexpected '}' in /oc-content/themes/bender/item-sidebar.php on line 45

Any clues??
You missing the closing bracket
Code: [Select]
<?php ?>
Title: Re: Add Phone Number and other field for Bender Theme
Post by: boboclock on July 01, 2014, 12:25:27 am
I used this guide to create both a phone number field and a confirm email field. Followed it exactly. It works for confirm email but not the phone number..



The problem is, no matter what I do, the phone number field is turning up null.

Any guesses?
Title: Re: Add Phone Number and other field for Bender Theme
Post by: fog on July 01, 2014, 05:45:25 am
Hi, how I can insert the new table (number phone) manually in my database backup? Somebody can explain set by step, please?

Regards
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Media DMJ on July 04, 2014, 05:03:52 pm
@ADMIN make sticky this post please
Title: Re: Add Phone Number and other field for Bender Theme
Post by: salamon on July 13, 2014, 10:41:57 am
Hello I very like this mod,

But I want to know is there any way to achieve it without modifying the core?

If I apply the changes now and then I update osclass will my site function correctly?

Thanks
Title: Re: Add Phone Number and other field for Bender Theme
Post by: mtcore on July 18, 2014, 03:41:36 am
Hi byteGator,

Your website, iklangratis.net use bender theme with custom code right? Can you share with us? It's really good to have one like yours.

Title: Re: Add Phone Number field for Bender Theme
Post by: Valeriu on August 05, 2014, 09:51:51 am
Hi byteGator,

I have added the phone number field following the exact steps you have indicated. Everything works fine, i can add the phone number when i post a new ad, but the number does not appear in the sidebar as expected. Also, i get an error (please see attachment) instead of the registered user phone number.  I'm using version v 3.2.2 where the instructions and the code in item-sidebar.php are a little bit different from what you have posted.

Please can you help me to correct this problem?

Thank you. :)
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Harish Singh on August 07, 2014, 05:50:32 pm
Hello,

Why everyone here editing theme for phone number when you can easily add Custom fields on manage listings menu ?
Title: Re: Add Phone Number field for Bender Theme
Post by: Valeriu on August 13, 2014, 02:43:15 pm
Hi byteGator,

I have added the phone number field following the exact steps you have indicated. Everything works fine, i can add the phone number when i post a new ad, but the number does not appear in the sidebar as expected. Also, i get an error (please see attachment) instead of the registered user phone number.  I'm using version v 3.2.2 where the instructions and the code in item-sidebar.php are a little bit different from what you have posted.

Please can you help me to correct this problem?

Thank you. :)


Ohh... c'mon nobody knows how to add in item-sidebar a phone number for unregistered users?

I don't want to use custom fields for contact info, i use custom fields for other specific info for the item on sale.

I'm stuck with this problem for over a month.


I have tried the solution posted a the beginning of this thread but it does not work in 3.4.1.


Help? :)
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Pavanc on September 17, 2014, 04:39:51 am
Hi, nice tutorial, plz explan how add radio buttons add item-post page. (Without custem feild), thanks.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: bernascoginger on September 23, 2014, 05:39:21 pm
Hi byteGator,

I am inspired by your procedures of adding phone number.
I am working on WAMP server to make the editing.

I followed your steps perfectly but after the editing whenever an ad is published it is never displayed.
This started occurring when i edited the itermAction.php following your steps.

Please help me correct this problem
Title: Re: Add Phone Number and other field for Bender Theme
Post by: bernascoginger on September 23, 2014, 10:09:32 pm
Hello byte
I have done all the steps, but when ads are submitted they are never displayed or saved
Please help me on this .
It started happening when I made changes to itermAction.php following your procedure.
Thanks for your cooperation
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Media DMJ on September 24, 2014, 11:42:08 am
@byteGator,

This turotial works with osclass 3.4 ?  :o
Title: Re: Add Phone Number and other field for Bender Theme
Post by: moinshaikh1726 on November 13, 2014, 10:44:32 am
Hi All,


How can user change mobile number after publish post as unregisterd user


pls reply me soon as possible
Title: Re: Add Phone Number and other field for Bender Theme
Post by: pausa on January 27, 2015, 08:44:49 pm
Hello,
how to add phone and registered?
Not every registered user add numbers to your account.
Title: Re: Add Phone Number and other field for Bender Theme
Post by: pausa on January 28, 2015, 05:52:53 pm
Is there no one to help?
Title: Re: Add Phone Number and other field for Bender Theme
Post by: dp @ clickadd.in on January 28, 2015, 06:59:23 pm
Great Work !
   
Thanks


dp @ clickadd.in (http://clickadd.in)
Title: Re: Add Phone Number and other field for Bender Theme
Post by: gary.wds on March 08, 2015, 12:47:55 am
hi.. could anyone help me with this.. i did all the steps and everything looks ok but when i post an ad and ticket to show phone number it doesnt show on the ad.. but in item-sidebar.php if i change this osc_item_show_phone to osc_item_contact_phone it shows the phone number but i need the ticket box working..  this is the code:

<div class="widget-box">
          <h3><?php _e("Publisher", 'azul'); ?></h3>
            <?php if( osc_item_user_id() != null ) { ?>
                    <p class="name"><img src="https://cdn3.iconfinder.com/data/icons/wpzoom-developer-icon-set/500/88-16.png" style="opacity:0.6" />&nbsp;&nbsp;<a href="<?php echo osc_user_public_profile_url( osc_item_user_id() ); ?>" ><?php echo osc_item_contact_name(); ?></a></p>
                <?php } else { ?>
                    <p class="name"><img src="https://cdn3.iconfinder.com/data/icons/wpzoom-developer-icon-set/500/88-16.png" style="opacity:0.6" />&nbsp;&nbsp;<?php echo osc_item_contact_name(); ?></p>
                <?php } ?>
            
            <?php if ( osc_user_phone() != '' ) { ?>
                    <p class="phone"><img src="https://cdn4.iconfinder.com/data/icons/aiga-symbol-signs/613/aiga_telephone_bg-16.png" style="opacity:0.6" />&nbsp;&nbsp;<?php echo osc_user_phone(); ?></p>
             <?php } ?>
            
            <?php if( osc_item_show_phone() ) { ?>
                    <p class="contactphone"><img src="https://cdn4.iconfinder.com/data/icons/pictype-free-vector-icons/16/contact-16.png" style="opacity:0.6" />&nbsp;&nbsp;<?php echo osc_item_contact_phone(); ?></p>
                <?php } ?>
            
                <?php if( osc_item_show_email() ) { ?>
                    <p class="email"><img src="https://cdn4.iconfinder.com/data/icons/pictype-free-vector-icons/16/contact-16.png" style="opacity:0.6" />&nbsp;&nbsp;<?php echo osc_item_contact_email(); ?></p>
                <?php } ?>
               
         </div>


Title: Re: Add Phone Number and other field for Bender Theme
Post by: ccar0462 on July 30, 2016, 09:12:39 am
To resolve the problem, phone number requeried.

 <input title="Need Phone Number" id="telephone" type="text" value="<?php echo $detail; ?>" name="telephone" required></input>
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Rhoda on January 13, 2017, 07:42:17 pm
Hi,

I try to add extra fields on user register!

I find this code in oc-includes/osclass/helpers/hUsers.php

        //can already be a logged user or not, we'll take a look into the cookie
        if ( Cookie::newInstance()->get_value('oc_userId') != '' && Cookie::newInstance()->get_value('oc_userSecret') != '') {
            $user = User::newInstance()->findByIdSecret( Cookie::newInstance()->get_value('oc_userId'), Cookie::newInstance()->get_value('oc_userSecret') );
            View::newInstance()->_exportVariableToView('_loggedUser', $user);
            if(isset($user['b_enabled']) && $user['b_enabled']==1) {
                Session::newInstance()->_set('userId', $user['pk_i_id']);
                Session::newInstance()->_set('userName', $user['s_name']);
                Session::newInstance()->_set('userEmail', $user['s_email']);
                $phone = ($user['s_phone_mobile'])? $user['s_phone_mobile'] : $user['s_phone_land'];
                Session::newInstance()->_set('userPhone', $phone);

                return true;
            } else {
                return false;
            }
        }

        return false;
    }


How to modify this ?

                $phone = ($user['s_phone_mobile'])? $user['s_phone_mobile'] : $user['s_phone_land'];
                Session::newInstance()->_set('userPhone', $phone);

we need 3 fields:
                s_phone_verified
                s_phone_mobile
                s_phone_land


Thanks
Title: Re: Add Phone Number and other field for Bender Theme
Post by: Rhoda on January 13, 2017, 08:07:52 pm
Guys i'm a student and needs some help on this!

Is this right what i try?

The s_phone verified i use for RingCaptcha plugin on registration!
Than i have 2 extra fields s_phone_mobile and s_phone_land


       if(!$this->is_admin) {
                Session::newInstance()->_set('userName', $input['s_name']);
                $phone = ($input['s_phone_verified'])? $input['s_phone_mobile'] : $input['s_phone_land'];
                Session::newInstance()->_set('userPhone', $phone);
            }   


Thanks