SCH_001 Posted June 30, 2019 Share Posted June 30, 2019 Hi all can anyone see any issue with this line getting Notice: Undefined index: delete in /home/xxxxx/public_html/frozen/sn_notifications.php on line 23 tep_db_query("delete from " . TABLE_STOCK_NOTIFICATION . " where snid = " . (int)$_GET['delete'] . " and " . $customer_id . '= sn_customer_id'); Link to comment Share on other sites More sharing options...
SCH_001 Posted June 30, 2019 Author Share Posted June 30, 2019 Dont worry I worked out it's the where snid= It might be some bad code as the table at the moment is 100% empty so there is not even 1 snid to find But I will try and let you know if I can get the rest of the module to work Link to comment Share on other sites More sharing options...
Dan Cole Posted June 30, 2019 Share Posted June 30, 2019 In the code in your first post you seem to be mixing quotes....some single and others double. Sorting that out might help. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
SCH_001 Posted July 1, 2019 Author Share Posted July 1, 2019 Thanks for that @Dan Cole changed it to the below but still same error tep_db_query('delete from ' . TABLE_STOCK_NOTIFICATION . ' where snid = ' . (int)$_GET['delete'] . ' and ' . $customer_id . '= sn_customer_id'); Link to comment Share on other sites More sharing options...
MrPhil Posted July 1, 2019 Share Posted July 1, 2019 The "mixed" quotes have nothing to do with it (will still properly assemble into a string). It's reporting that there is no delete=xxx in the URL Query String. You will need to check that $_GET['delete'] exists, before you can run this query. Also, $customer_id=sn_customer_id is an odd construct (assuming sn_customer_id is a DB field name), and might not work on all databases. It should be sn_customer_id='$customer_id' with $customer_id checked for validity if it's a user input. Link to comment Share on other sites More sharing options...
Dan Cole Posted July 1, 2019 Share Posted July 1, 2019 Based on the add on that line should look like this.... tep_db_query("delete from " . TABLE_STOCK_NOTIFICATION . " where snid = " . (int)$_GET['delete'] . " and " . $customer_id . '= sn_customer_id'); I still don't like that single quote at the end but let's assume it's okay. Are you getting any MySQL error messages? One of the things I like to do when I have trouble with queries is to run them from phpmyadmin, adding the actual variables to see where things are failing and why. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
SCH_001 Posted July 1, 2019 Author Share Posted July 1, 2019 I am still thinking the error is being thrown cuz stock_notification is total empty I have tried the line Dan has recommended and also My Phil it's a click button Here are your notifications for current out of stock items To remove a product stock notification, click the Delete Button. I will continue working threw all the code section related as a lot needs to be updated in it. I may come across the problem Link to comment Share on other sites More sharing options...
Jack_mcs Posted July 1, 2019 Share Posted July 1, 2019 @supercheaphobbGive this a try: tep_db_query("delete from stock_notification where snid = '" . (int)$_GET['delete'] . "' and sn_customer_id = '" . (int)$customer_id . "'"); Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
SCH_001 Posted July 1, 2019 Author Share Posted July 1, 2019 Nope same error Mrphil says $_GET['delete'] need to be exist I can only find it in admin/categories.php but I think think it's the one we want... This addon is so broken... Link to comment Share on other sites More sharing options...
Jack_mcs Posted July 1, 2019 Share Posted July 1, 2019 You're mixing notices and errors. The former may not matter, depending upon the version of php but the latter is a must fix. You showed a notice in the first post so I assumed you were saying there was some other error. If you are referring to that notice, it is because the delete parameter isn't declared prior to being used. That can be added but as @MrPhilstated, you have to be sure it exists first. If it is an addon, please post a link to it. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
SCH_001 Posted July 1, 2019 Author Share Posted July 1, 2019 The add_on have so much old code. I added an item via php and the delete button worked and only showed the error. Are you saying that not an error and only a notice? https://apps.oscommerce.com/WNvd3&notify-when-back-in-stock Link to comment Share on other sites More sharing options...
YePix Posted July 1, 2019 Share Posted July 1, 2019 @supercheaphobb Before you use this contrib, first check whether oscommerce sends emails to individual customers properly or whether all the addresses of your customers are inserted in the email header. Link to comment Share on other sites More sharing options...
SCH_001 Posted July 1, 2019 Author Share Posted July 1, 2019 @jack_mcs Jack don't worry about it I have suppressed error on the test site and all is working... I am learning next time I will try and learn the different from a notice and a error Link to comment Share on other sites More sharing options...
SCH_001 Posted July 1, 2019 Author Share Posted July 1, 2019 @YePix Thanks for that, I found the old thread for this add_on and read all the issue's. I am working in a sand pit install at the moment to see how far I can get in getting it even installed. I have given up now as the frozen uses actions and this is all in the application top.php I think this would be a very sought after add_on but needs to run from cron and remove all the code from the osc code... Link to comment Share on other sites More sharing options...
MrPhil Posted July 1, 2019 Share Posted July 1, 2019 What PHP version, what osC version, and what was this add-on built for (PHP and osC versions)? The wrong combination might leave you without $_GET and $_POST defined, while $HTTP_GET/POST_VARS are, or vice-versa. Or, it could be that just the 'delete' element is missing. A button could certainly use the GET method to transfer form data, but what it will do if the table is empty, I don't know (whether delete=xxxx is in the form data). One thing that could be done is to verify that $_GET['delete'] exists, before attempting to run this query that depends on it. If there were no entries to select for deletion, there isn't much sense in trying to run the query. Link to comment Share on other sites More sharing options...
SCH_001 Posted July 2, 2019 Author Share Posted July 2, 2019 Frozen osC, PHP 7.1 add_on for oscom-stock-notification-bootstrap-version 2.3 but it still has so many hard coded items which needed to be removed and a mix of $_GET and $HTTP_GET in different files which I changed all to $_GET But we will let this go, as the add_on it self is rather broken in many area's and need work past what I can handle. I was install to see how it basically works Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.