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.....
-
1Your 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 elaborateRaphael at Digital Pianism– Raphael at Digital Pianism2015年10月05日 13:40:13 +00:00Commented Oct 5, 2015 at 13:40
-
@DigitalPianism please check updated questionBaby in Magento– Baby in Magento2015年10月05日 13:42:13 +00:00Commented Oct 5, 2015 at 13:42
-
1Thanks 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– Raphael at Digital Pianism2015年10月05日 13:45:00 +00:00Commented Oct 5, 2015 at 13:45
-
its an configuration field prntscr.com/8nzfnaBaby in Magento– Baby in Magento2015年10月05日 13:47:24 +00:00Commented Oct 5, 2015 at 13:47
1 Answer 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
}
-
this is the system.xml = pastebin.com/WgistWSJBaby in Magento– Baby in Magento2015年10月05日 14:00:26 +00:00Commented Oct 5, 2015 at 14:00
-
1Is your field the Available ZIP code field ?Raphael at Digital Pianism– Raphael at Digital Pianism2015年10月05日 14:01:13 +00:00Commented Oct 5, 2015 at 14:01
-
1See my edit in my answerRaphael at Digital Pianism– Raphael at Digital Pianism2015年10月05日 14:06:33 +00:00Commented Oct 5, 2015 at 14:06
-
1Yes, it is. No need to call getStoreConfig again when setting the $myArray variable you can just do $myArray = explode(',',$myNumber); Actually my bad, $myNumber is supposed to be the number you want to check. I don't know exactly what is this number.Raphael at Digital Pianism– Raphael at Digital Pianism2015年10月05日 14:16:02 +00:00Commented Oct 5, 2015 at 14:16
-
1Let us continue this discussion in chat.Raphael at Digital Pianism– Raphael at Digital Pianism2015年10月05日 14:17:39 +00:00Commented Oct 5, 2015 at 14:17