Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Am I adding product attributes wrong?


stillgreen

Recommended Posts

Posted

Just getting started with osc and find that all of my products with option attributes defined seem to result in:

"Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in .../includes/functions/compatibility.php:18) in .../includes/functions/compatibility.php on line 30"

 

and I can't add them to the cart. No problem with products that have no options.

 

My test site is here.

 

Can some tell me what I'm doing wrong when adding attributes? What do I need to change to fix this. Should I comment out this function or what?

Posted

Just noted that I am getting the same fatal error when I try to go to product detail pages as well.

 

Anyone have any idea what I've done?

Posted

Just noted that I am getting the same fatal error when I try to go to product detail pages as well.

 

Anyone have any idea what I've done?

The best way I know to get this error is to upload a code file into the languages folder.

 

In your case it would be the product_info.php file

 

Reference this thread

 

Look at the /includes/languages/english/product_info.php

 

If it has this line:

 

  require('includes/application_top.php');

It's the wrong file for that folder.

:blush:

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

Well, I checked that. I have this product_info.php

<?php
/*
 $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('TEXT_PRODUCT_NOT_FOUND', 'Product not found!');
define('TEXT_CURRENT_REVIEWS', 'Current Reviews:');
define('TEXT_MORE_INFORMATION', 'For more information, please visit this products <a href="%s" target="_blank"><u>webpage</u></a>.');
define('TEXT_DATE_ADDED', 'This product was added to our catalog on %s.');
define('TEXT_DATE_AVAILABLE', '<font color="#ff0000">This product will be in stock on %s.</font>');
define('TEXT_ALSO_PURCHASED_PRODUCTS', 'Customers who bought this product also purchased');
define('TEXT_PRODUCT_OPTIONS', 'Available Options:');
define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge');
?>

 

I have also downloaded simple search and looked for duplicate errors. Originally I had uploaded an extra admin folder within the admin folder but I deleted the excess folder.

 

I can add a product with no options to the cart but I cannot view any product's details without incurring the error. I also get the error when I try to add a product with options to the cart.

Posted

Post the first 45 lines from /includes/functions/compatibility.php

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

This is what I have (1st 45) includes/functions/compatibility:

 function do_magic_quotes_gpc(&$ar) {
   if (!is_array($ar)) return false;

   reset($ar);
   while (list($key, $value) = each($ar)) {
     if (is_array($ar[$key])) {
       do_magic_quotes_gpc($ar[$key]);
     } else {
       $ar[$key] = addslashes($value);
     }
   }
   reset($ar);
 }

 if (PHP_VERSION >= 4.1) {
   $HTTP_GET_VARS =& $_GET;
   $HTTP_POST_VARS =& $_POST;
   $HTTP_COOKIE_VARS =& $_COOKIE;
   $HTTP_SESSION_VARS =& $_SESSION;
   $HTTP_POST_FILES =& $_FILES;
   $HTTP_SERVER_VARS =& $_SERVER;
 } else {
   if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = array();
   if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = array();
   if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = array();
 }

// handle magic_quotes_gpc turned off.
 if (!get_magic_quotes_gpc()) {
   do_magic_quotes_gpc($HTTP_GET_VARS);
   do_magic_quotes_gpc($HTTP_POST_VARS);
   do_magic_quotes_gpc($HTTP_COOKIE_VARS);
 }

 if (!function_exists('array_splice')) {
   function array_splice(&$array, $maximum) {
     if (sizeof($array) >= $maximum) {
       for ($i=0; $i<$maximum; $i++) {
         $new_array[$i] = $array[$i];
       }
       $array = $new_array;
     }
   }
 }

Posted

All the posts I can find on this error say it's because there is a "code" file in the languages folder.

 

Or somehow compatibility.php is getting "included" twice.

 

Sorry, but that that's as close as I can narrow it down.

:blush:

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

Thanks so much for trying to help. I searched the forum also without finding a solution.

 

Even Google hasn't helped so far. I tried commenting out part of the compatibility file and really made a mess :) Maybe someone will come along who can spot what I've done wrong.

Posted

Wow! Owe you an apology. Been at it too long, I think. After double checking again, I DID have the wrong product_info.php file in the includes/languages/english location. I hadn't updated my local copy when I thought I had :blush:

Archived

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

×
×
  • Create New...