Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Undefined variable: variable_array_or_object


blr044

Recommended Posts

Posted

I did install this contribution. But was suggested to post here at the general forum for some some help on a few errors I received, which I have listed below.

 

Error: Undefined variable: products

File: includes/boxes/image_in_cart.php

Line: 7

Error: Undefined variable: products

File: includes/boxes/image_in_cart.php

Line: 31

 

Line 7 and 31 is the same:

    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

 

I have a few others but start with this.

 

Am not a php geek, so am lost as to what this telling me or even how to fix this.

 

NOTE: image_in_cart.php is in connection with this.

 

Thanks.

 

Bennett

Posted

Try changing this:

 

    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

 

to

 

    $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted

That did solve that issue.

 

The second I have is listed below:

Error: Constant RND_HEAD_TEXT already defined

File: includes/modules/random_pro.php

Line: 52

Error: Constant RND_HEAD_TEXT already defined

File: includes/modules/random_pro.php

Line: 54

Error: Constant RND_HEAD_TEXT already defined

File: includes/modules/random_pro.php

Line: 56

Error: Constant RND_HEAD_TEXT already defined

File: includes/modules/random_pro.php

Line: 58

 

This is the code for such lines.

 

case 'danish': 
define('RND_HEAD_TEXT', 'Her er et udsnit af vores varesortiment'); 
case 'english': 
define('RND_HEAD_TEXT', 'Engelsk tekst ...'); 
case 'german': 
define('RND_HEAD_TEXT', 'Tysk tekst ...'); 
case 'andet_sprog': 
define('RND_HEAD_TEXT', 'Andet_sprog tekst ...'); 
default: 
define('RND_HEAD_TEXT', 'Her er et udsnit af vores varesortiment');

 

Some searching for Constant already defined to why it was happening, I decided to comment out the code for now. So for now, till I have enough time to go through DB to check if anything was left behind when a module was removed for whatever reason I removed it. I commented out the lines. So the error message is gone. So not sure if that was the correct method, but at least store still working.

Posted

In case you need to use the code try this.

 

Change:

 

switch ($language) { 
case 'danish': 
define('RND_HEAD_TEXT', 'Her er et udsnit af vores varesortiment'); 
case 'english': 
define('RND_HEAD_TEXT', 'Products'); //change to you settings
case 'german': 
define('RND_HEAD_TEXT', 'Tysk tekst ...'); 
case 'andet_sprog': 
define('RND_HEAD_TEXT', 'Andet_sprog tekst ...'); 
default: 
define('RND_HEAD_TEXT', 'Her er et udsnit af vores varesortiment'); 
break; 
}; 

 

to

 

switch ($language) { 
case 'danish': 
$RND_HEAD_TXT = 'Her er et udsnit af vores varesortiment'; 
break;
case 'english': 
$RND_HEAD_TXT = 'Products';
break;
case 'german': 
$RND_HEAD_TXT =  'Tysk tekst ...'; 
break;
case 'andet_sprog': 
$RND_HEAD_TXT =  'Andet_sprog tekst ...'; 
break;
default: 
$RND_HEAD_TXT = 'Her er et udsnit af vores varesortiment'; 
break; 
}; 
define('RND_HEAD_TEXT', $RND_HEAD_TXT);

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...