How to add new dropdown field in Post Ads

Hi Everyone

 

I want to add a new dropdown input field in post ad page. I have already added a new column in bx_ads_main database table where values of that field will be stored.

Please see attachment.

Can anyone give me code for BxAdsModule.php

So that while posting new ad it ll process new field data and save it to database.

Thanks in advance. 

#If any developer helps me in this, I ll also have further Boonex paid job for him.

boonex post ads.png · 14.3K · 199 views
Quote · 8 Oct 2013

in BxAdsModule.php around line 966 there should be an existing Select Field for Country, just copy that and paste where you want your new field and edit to fit what you want.

caredesign.net
Quote · 8 Oct 2013

Hi Thanks for replying but still its not adding new field.

 

For example I added same array code of country after its code but its still not showing any new input field in frontend.

 

This was the code what i added 

'Country' => array(

                    'type' => 'select',

                    'name' => 'Country',

                    'caption' => _t('_bx_ads_caption_country'),

                    'values' => $aCountries,

                    'value' => $sCountry,

                    'required' => true,

                    'checker' => array (

                        'func' => 'preg',

                        'params' => array('/^[a-zA-Z]{2}$/'),

                        'error' => _t ('_bx_ads_err_country'),

                    ),

                    'db' => array (

                        'pass' => 'Preg',

                        'params' => array('/([a-zA-Z]{2})/'),

                    ),

                ), 

Quote · 8 Oct 2013

Try to use different name, the same name just overwrites previous entry and still one filed is displayed, for example:

'Country2' => array(

Rules → http://www.boonex.com/terms
Quote · 9 Oct 2013

Thanks Its showing dropdown field in the frontend but now can you tell me how to add value of this field to database table.

 

thnx in advance :)

Quote · 9 Oct 2013

Can anyone tell me , where is the SQL INSERT statement or function where i can add the value of my new field so that it stores value of new field in ads module database table. 

 

I have already made a table column in ads database table to store value of this new field. But I cant find the function or INSERT statement used to store the values of post ads other input fields.

 

Thank you

Quote · 10 Oct 2013

if you copied one of the existing fields and edited to create your own, there is no sql query to add it to the database, the functions do all of that - as long as you have the field in the ads table - not your own table- it should work as is.

caredesign.net
Quote · 10 Oct 2013

Can anyone explain me by giving an example, if i want to create a new select field like country 

for example : my new field name is 'products' and i have already defined values for this field in admin predefined values.

I am able to get all predefined values in this new field, only problem is I am not able to post an ad so that value of this field will be stored in bx_ads_main database table. I have already made a new column name 'products' in bx_ads_main database table. So why its not inserting value to database. I am getting error message defined in array error=''

 

Thank you

Quote · 11 Oct 2013

could you post your code for that new field you created?

caredesign.net
Quote · 11 Oct 2013

                           'Metro' => array(
                    'type' => 'select',
                    'name' => 'Metro',
                    'caption' => 'Metro Caption',
                    'values' => $aMetros,
                    'value' => $sMetro,
                    'required' => true,
                    'checker' => array (
                        'func' => 'preg',
                        'params' => array('/^[a-zA-Z]{2}$/'),
                        'error' =>'Enter your Metro',
                    ),
                    'db' => array (
                        'pass' => 'Preg',
                        'params' => array('/([a-zA-Z]{2})/'),
                    ),
                ),

 

I am not 100% sure, but are your metro entries in the predefined values table more than 2 characters long. I believe those items i highlighted in red are looking for a 2 character entry. For a quick test, try the following instead:

                           'Metro' => array(
                    'type' => 'select',
                    'name' => 'Metro',
                    'caption' => 'Metro Caption',
                    'values' => $aMetros,
                    'value' => $sMetro,
                    'required' => true,
                    'checker' => array (
                        'func' => 'length',
                        'params' => array(1, 455),
                        'error' =>'Enter your Metro',
                    ),
                    'db' => array (
                        'pass' => 'Xss',
                    ),
                ),

also, make sure the field in your ads table has a capital M and not a lowercase m - aslo, what is the exact error you are getting

caredesign.net
Quote · 12 Oct 2013

And thank you. Its working now. :)

Quote · 12 Oct 2013

thats good to hear

caredesign.net
Quote · 12 Oct 2013

check your messages here. I can do what I can to try to help you out, and I dont charge. I just like doing it.

caredesign.net
Quote · 12 Oct 2013

Okay Thank you :)

Quote · 12 Oct 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.