Jump to content
SCH_001

Undefined index:

Recommended Posts

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');

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

In the code in your first post you seem to be mixing quotes....some single and others double.  Sorting that out might help.

Dan

Share this post


Link to post
Share on other sites

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');

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@supercheaphobbGive this a try:

tep_db_query("delete from stock_notification where snid = '" . (int)$_GET['delete'] . "' and sn_customer_id = '" . (int)$customer_id .  "'");

 

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×