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.....

  • 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 – Raphael at Digital Pianism Oct 5 '15 at 13:40
  • @DigitalPianism please check updated question – Baby in Magento Oct 5 '15 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. – Raphael at Digital Pianism Oct 5 '15 at 13:45
  • its an configuration field prntscr.com/8nzfna – Baby in Magento Oct 5 '15 at 13:47
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
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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