can not save product while adding discount price in opencart - php

I am working with opencart and I am learning right now.
When I add discount price in product and save it then I received notice like :
Notice: Undefined index: points in /home/eyelens/public_html/admin/model/catalog/product.php on line 131Notice: Undefined index: points in /home/eyelens/public_html/admin/model/catalog/product.php on line 177Notice: Undefined index: weight in /home/eyelens/public_html/admin/model/catalog/product.php on line 177Notice: Undefined index: weight_prefix in /home/eyelens/public_html/admin/model/catalog/product.php on line 177Warning: Cannot modify header information - headers already sent by (output started at /home/eyelens/public_html/admin/index.php:80) in /home/eyelens/public_html/system/library/response.php on line 12
Here, I got error because my array is full so it can not return point and weight therefor it gives an error. So how can I increase array size ?

Undefined index : Even though php does not need variables to be declared first you must have some values in it before using a variable. So it is recommended that you should initialise the variables or use isset(variablename) before using the variable.
Inorder to solve headers already sent error, you should not print any output before using functions that modify headers like header() session_start()

I have write below two variable in php.ini file
max_input_vars = 30000;
max_post_size = 30000;
and its working perfect.

Related

undefined constant DIR_LOG Error with Opencart

all of a sudden I am getting the following error which prevents me from logging in to my admin and it is also showing on header of the store front
Notice: Use of undefined constant DIR_LOG - assumed 'DIR_LOG' in /home/user/public_html/system/library/openbay/ebay.php on line 150Notice: Use of undefined constant DIR_LOG - assumed 'DIR_LOG' in /home/user/public_html/system/library/openbay/ebay.php on line 150Warning: rename(DIR_LOGebaylog.log,DIR_LOG_ebaylog_2015-10-25_00-23-22.log): No such file or directory in /home/user/public_html/system/library/openbay/ebay.php on line 150Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/admin/index.php:84) in /home/user/public_html/system/library/response.php on line 12
Here is the code in /home/user/public_html/system/library/openbay/ebay.php on line 150
rename(DIR_LOG . 'ebaylog.log', DIR_LOG . '_ebaylog_' . date('Y-m-d_H-i-s') . '.log');
and I checked and DIR_LOG is defined correctly in config.php
Any help to identify and fix the issue is highly appreciated
Just fixed it by adding
define('DIR_LOG', '/home/schwann/public_html/system/logs/');
to /home/user/public_html/admin/config.php
Opencart has
define('DIR_LOGS', '/home/schwann/public_html/system/logs/');
by default but it looks like openbay pro has a bug and is using DIR_LOG instead of DIR_LOGS by defining LOG and LOGS both the problem will be solved.

PHP MySQL Session

we moved our website to a new server that came with a new IP address. What puzzles me; the website login sessions do not work on the new server but when I change the database IP to the old server they are working.
MySQL Version
Old server = 5.1.58- Community
New server = 5.1.68 - Community
At first I thought it was a PHP error but I now believe it's not and suspect its MySQL related. Anyone who knows what might have caused this conflict?
Debugging Error
Notice: A session had already been started - ignoring session_start() in C:\inetpub\wwwroot\gtest\libs\products.php on line 2
Notice: Undefined index: uUserTypeID in C:\inetpub\wwwroot\gtest\admin\index.php on line 50
Notice: Undefined offset: 0 in C:\inetpub\wwwroot\gtest\admin\index.php on line 52
Notice: Undefined offset: 0 in C:\inetpub\wwwroot\gtest\admin\index.php on line 52
Line 50
GetUserType($_SESSION['uUserTypeID'], $UserTypeID, $UserTypeDescr, $Active_Tag);
Line 52
if (($UserTypeDescr[0] == 'Admin') || ($UserTypeDescr[0] == 'Report'))
Let's go through the notices in order:
session_start() was already called before. No need to call it again.
There's no such variable as $_SESSION["uUserTypeID"]. It's not set.
The array at $UserTypeDescr doesn't have a 0 index. It's probably empty. If you got it from a database query, it either failed or returned an empty resultset.
Same as 3.
Notice: A session had already been started - ignoring session_start() in C:\inetpub\wwwroot\gtest\libs\products.php on line 2
At a guess session.auto_start is enabled hence the session is being enabled before the session handler is overridden (or the new session handler is failing).
The most safest method of preventing such error (i.e. Session already started) is by always checking if session has already been started before starting a session.
You can do this by simply including
if (!isset($_SESSION))session_start();
I hope this solve the problem? upon trying it, you can simply add your comment or observations to further improve the answer and above all, solve the probelm. I hope this helps?

php Undefined variable: _session_register issue

There is one php project made in fully core php. Now my work is to change some style issues. So I just downloaded all the files with the database. I just configured all the database name,username,password over my localhost(LAMP). When I browsed the page it is showing the page but there are some errors with it. It is showing error like
Notice: Undefined variable: _session_register in path to the folder/session.php on line 8
Notice: Undefined variable: _session_register in path to the folder/session.php on line 9
Notice: Undefined variable: _session_register in path to the folder/session.php on line 10
Notice: Undefined variable: _session_register in path to the folder/session.php on line 11
Notice: Undefined variable: _session_register in path to the folder/session.php on line 12
Notice: Undefined variable: _session_register in path to the folder/session.php on line 13
The code for the session.php is like this
<?php
$_SESSION['example']="yes";
ini_set("url_rewriter.tags","");
ini_set('session.use_trans_sid', 0);
ini_set("session.cookie_domain", ".localhost");
session_start();
ob_start();
$_session_register["easb2b_username"];
$_session_register["easb2b_userid"];
$_session_register["easb2b_memtype"];
$_session_register["easb2b_adv_id"];
$_session_register["easb2b_adv_email"];
$_session_register["lang"];
?>
So can someone kindly tell me how to solve this issue. The project has around thousand of files. So its really hard to go through all the files and check them. Any help and suggestions will be really appreciable. Thanks....
<?php
// Use of session_register() is deprecated
$new_sessionvar = "Some value.";
session_register("new_sessionvar");
But you can still use
session_start();
$_SESSION['new_sessionvar'] = "Some value"
In order to use it you need to turn on register_global in php.ini
Note that I have the session_start() function right above initialization. In your code you may want to add it at the top of your script to prevent the Headers already sent by PHP message.

Form not displaying PHP Log showing Undefined index

I am getting the following errors:
PHP Notice: Undefined index: Username class.form.php on line 43
PHP Notice: Undefined index: Password class.form.php on line 54
index.php code
class.form.php code
The form is showing in the source code but not the "view"
print_r is showing Form Object ( [sHTML:Form:private] =>
Thanks
To fix the last error, change:
<?php echo $sLoginMessage ?>
to
<?php echo (isset($sLoginMessage)?$sLoginMessage:null); ?>
With your other error, you're trying to access an array index that does not exist. $this->aStickyData[$sName] and the other aStickyData error is because these array indexes are not defined.
The first two errors are referring to your attempts to access Form::$aStickyData['Username'] and Form::$aStickyData['Password'] respectively.
This data is only set on form submission. You should set default data for the initial page load.
The last error is because you're defining $sLoginMessage inside the form submission and validation conditions. You should define it earlier.

receiving error undefined index on two variables

Using adLDAP.php class
receiving following error: Notice: Undefined index: memberof in /web/ee_web/include/adLDAP.php on line 762
line 762: if (is_array($groups[0]["memberof"])) {
Also receiving error: Notice: Undefined index: count in /web/ee_web/include/adLDAP.php on line 982
line 982: $entries[0]["memberof"]["count"]++;
Unsure of what I need to do to resolve these error messages, it seems that the script is working fine, but I'd like get rid of these errors.
Using: http://adldap.sourceforge.net/wiki/doku.php?id=api
You could edit the code to something along the lines of:
if(isset($groups[0]["memberof"]))
{
if (is_array($groups[0]["memberof"])){ ... }
}
And
if(isset($entries[0]["memberof"]["count"]))
{
$entries[0]["memberof"]["count"]++;
}
It will keep you from getting the errors, though it won't necessarily handle some pretty lax sanity checking by the original author of the code.
It seems like you have your error_level set to show every possible error/warning/notice, that's why you're getting it.
If the script is working fine, then it's not an error, simply a missing check the coder forgot to put in the library.
To get rid of thos messages, you have 2 options:
a) Use # before the calls you do to that library, such as
$var = #the_function(param1);
This will avoid those messages for just that line.
b) Set the error level to something like this with error_reporting():
error_reporting(E_ALL ^ E_NOTICE);
This will affect the whole script you're running.
It's up to you what to use depending on the project.

Categories