Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add new fields problem


Rotation

Recommended Posts

Posted

I've tried to add new fields,

I have used a module provided to add product dimensions and configured it accordingly to my own requirements however the extra fields as ALL other fields except price and module do not display: even though the admin/conf../product listing is confiured as:

Title Value Action

Display Product Image 1

Display Product Manufaturer Name 1

Display Product Model 1

Display Product Name 1

Display Product Price 2

Display Product Quantity 1

Display Product Weight 1

Display Buy Now column 1

Display Category/Manufacturer Filter (0=disable; 1=enable) 1

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 2

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 3

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 2

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 1

Display Product Dimensions 1

Display Product Dimensions 1

Display Product Dimensions 1

 

I have followed the module as descibed in http://bronzemoon.co.uk/productdimensions.txt

except in .sql table [products] I have assigned products_lenght et al as varchar(64) instead of int

Any idea why no other fields are showing?

The purpose is for a record store at www.bronzemoon.co.uk

thank you

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

Did you edit the query in product_info.php that pulls the information from the products table to include your new fields?

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Posted

yes...

I placed catalogproduct_info.php

------------------------------------

Around line 50 I found:

 

$product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");

 

which I replace with:

 

$$product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_lenght, p.products_depth, p.products_width from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");

 

 

 

Around line 105:

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

I Added:

<?php

if (PRODUCT_LIST_DIMENSIONS)

{

if ($product_info['products_length'] !='' || $product_info['products_width'] !=null || $product_info['products_depth'] !=null )

echo TEXT_PRODUCT_DIMENSIONS . ' ';

if (stripslashes($product_info['products_length']) != '')

echo TEXT_PRODUCT_LENGTH . stripslashes($product_info['products_length']) . ' ';

if (stripslashes($product_info['products_width']) != '')

echo TEXT_PRODUCT_WIDTH . stripslashes($product_info['products_width']) . ' ';

if (stripslashes($product_info['products_depth']) != '')

echo TEXT_PRODUCT_DEPTH . stripslashes($product_info['products_depth']) . ' ';

}

?>

 

Files in total edited are:

 

catalogproduct_info.php

catalogincludeslanguagesenglish.php

cataloginstalloscommerce.sql

 

admincategories.php

adminincludeslanguagesenglishcategories.php

 

hope that helps

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

In your replacement, it should be:

$product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_length, p.products_depth, p.products_width from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");



tep_debug_var('product_info.php:product_info', $product_info);

which removes the double $ at the beginning, corrects the spelling of length, and prints the contents of the query.

 

You will need to add the following code to the beginning of the catalog/includes/functions/general.php file:

	// void tep_debug_var (string form, string varname)

// dumps the value of the variable passed to it.

function tep_debug_var ($where, $var='') {

 if (!empty($where)) {

	 echo "<p>debug $where: ";

	 if (is_object($var) || is_array($var)) {

   echo "<br />n<pre>n";

   print_r($var);

   echo "n</pre></p>";

   reset($var);

	 } else {

   echo "$var</p>";

	 }

 }

}

This should tell you whether you are getting the information from the database. If you are, then check your code logic to see where it is failing.

 

When you no longer need the dump of the product_info recordset, simply comment out or delete the tep_debug_var line.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Posted

typical cut and paste issue,

I haven't used the general.php code below yet, and am scared to have to check my code logic....

 

but the isn't a double $$ I just paced pasted over a misprint leaving the $

 

and I've changed all the product_lenght/depth&width tags in my script but replaced them above for continuity & clarity! :oops: my seepling is teribull :wink:

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted
typical cut and paste issue, I haven't used the general.php code below yet, and am scared to have to check my code logic....

 

Understandable. Being able to see what information is returned from the database will get you pointed in the right direction.

 

If no information is returned then you need to check your table and data.

 

If information is returned then you need to check your code.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Posted

I've added the code to line 14 of general.php but see no change, what am I looking for and where do I go to see it?

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

I'm assuming no information as there is none...

fun fun any tips?

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

there is no info,

I've had a search but can't find anything,

any idea why nothing is being displayed.... it's doubly annoying as I've gone to all the effort to show more.

in directoy view I get manufacturer/model/name/price/quantity/weight & image

 

I assume that the order list comes from admin/catalog/product listing

in product view I get

 

Name/model/description/price & image

 

I so need those extra fields t move on.

 

Any idea where the problem stems from?

 

did I insert that code correctly in general.php

Lines 1->52 are

<?php

/*

 $Id: general.php,v 1.212 2003/02/17 07:55:54 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/





// start void tep_debug_var (string form, string varname) 

  // dumps the value of the variable passed to it. 

  function tep_debug_var ($where, $var='') { 

     if (!empty($where)) { 

        echo "<p>debug $where: "; 

        if (is_object($var) || is_array($var)) { 

           echo "<br />n<pre>n"; 

           print_r($var); 

           echo "n</pre></p>"; 

           reset($var); 

        } else { 

           echo "$var</p>"; 

        } 

     } 

  } 



// end void tep addition







////

// Stop from parsing any further PHP code

 function tep_exit() {

  tep_session_close();

  exit();

 }



////

// Redirect to another page or site

 function tep_redirect($url) {

   if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page

     if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url

       $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL

     }

   }



   header('Location: ' . $url);



   tep_exit();

if so how can I check the database?

What other reasons might there be for the extra fields from not displaying?

:?

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

I'm having a problem where I want to get some new fields showing up in the product listing but I'm getting the "Price>Price" thing happening. I followed the adding fields advice but I'm now running into some trouble which seems to be similar to what's posted here. I'm using 5-18-03 with the SEC 1.0b.

 

I would like to set up one of the columns with a new field "carat weight" and then another so I can have two fields concatenated in it (so it shows up as "length x width" instead of a column "length" and another "width")

 

ie: columns in the list would be Catalog Number, Product Name, Carat Weight, Dimensions (LxW), image, price etc...

 

Any suggestions? Here's a couple of pics from Admin and my site:

 

productlistoutput.gif

 

productlistadmin.gif

 

Thanks!

 

-al

Posted

Andy

 

These values should be unique:

 

Display Product Image 1  

Display Product Manufaturer Name 1  

Display Product Model 1  

Display Product Name 1  

Display Product Price 2  

Display Product Quantity 1  

Display Product Weight 1  

Display Buy Now column 1

 

 

The Numbers are for Sorting Columns they tell the column what position they should be displayed on the page 1=Left, 5=Middle, 9=Right,

Display Product Image 1  

Display Product Manufaturer Name 2  

Display Product Model 3  

Display Product Name 4  

Display Product Price 5  

Display Product Quantity 6  

Display Product Weight 7  

Display Buy Now column 8

 

Also make sure none share the same value like Buy It Now Column = 5 and Price Column = 5 as they may cancel each other out, By assigning everything to position 1 -> all columns are fighting to be displayed at position 1, thus conflict.. and scatterred or non-displayed columns...

 

when I put 1's on all my columns I get unpredictable results, messed up and shit.

 

0 = Off

 

something to think about.

Posted

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

gor that's long soz

There can?t be anything wrong with hedonism if everyone?s happy... can there? :wink:

Posted

Andy,

 

 

have a look at this post (right near the bottm) on how to add new fields in product listing and have them display custom database fields, the database query does not need to be altered - if your new fields exist in TABLE p.products or pd.products_description,

 

http://www.oscommerce.com/forums/viewtopic.php...er=asc&start=10

 

Im not sure if your new database values are in a new table?.

 

why do you have duplicate entries for these?

Thats not right.

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 2  

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 3  

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 2  

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both) 1  

Display Product Dimensions 1  

Display Product Dimensions 1  

Display Product Dimensions 1

 

Cheers Lee

Archived

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

×
×
  • Create New...