1

we are using an extension , so that the extension provides a text box in the admin panel.

if we enter the numbers in the admin panel text field means automatically it will save in the database table

we saved list of numbers in the database .

if the number is present in the database, than we have to display the message if condition

" available", if it is not present means than we have to display else condition "un avaialble"

please give me the php code for these kind of feature

please don't clsoe this question as un clear, if you have any doubts , please comment here, so that i will try to to clear it.....

4
  • 1
    Your question is too vague, could you please explain what is this "number" stored in the database ? Is that related to an object/model you created ? How did you store it in the first place ? Please elaborate Commented Oct 5, 2015 at 13:40
  • @DigitalPianism please check updated question Commented Oct 5, 2015 at 13:42
  • 1
    Thanks for the update, could you tell me if the admin field is a configuration field or if it's related to an entity (product, order, customer..). Please post a screenshot of the field if possible. Commented Oct 5, 2015 at 13:45
  • its an configuration field prntscr.com/8nzfna Commented Oct 5, 2015 at 13:47

1 Answer 1

1

If it's a configuration field, you need to find out what is the path of the field by looking at the system.xml file of the module.

You should find something like this:

<sections>
        <yourmodule translate="label" module="yourmodule">
            ...
            <groups>
                <group_tag translate="label">
                     ...   
                     <fields>
                        <your_field translate="label">
                            <label>Label of the field</label>
                            ...
                         </your_field>
                    </fields>                               
                </group_tag>
            </groups>                   
        </yourmodule>
    </sections>

Thus, with the example above you can retrieve the value of the field using the following PHP code:

Mage::getStoreConfig('yourmodule/group_tag/your_field');

Edit: according to the system.xml file, here is how you can retrieve the values of your field:

Mage::getStoreConfig('checkdelivery/general/pincode');

However this field is comma separated so if you want an array you can just do:

$myArray = explode(',',Mage::getStoreConfig('checkdelivery/general/pincode'));

Then if you want to test if a number is in this array:

if (in_array($myNumber,$myArray))
{
// Number is present in the array
}
else
{
// Number is not in the array
}
7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.