Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra Fields Not Appearing


alexcn

Recommended Posts

I am wondering if I have missed something in updating the categories.php file as the configuration for the extra fields appear, you can see the values in the product info page, and when you enter values they appear in the product preview display: however the values dont appear to have been stored in the database (product extra fields table is empty) and consequently they dont appear in the catalog view.

 

Does anyone have any experience on this? trying to work out whether the update section of the categories.php file doesnt file.

 

Thanks everyone :)

Edited by alexcn
Link to comment
Share on other sites

Have edited the database.php function to write all of the SQL queries to a file and found that the UPDATE extra fields query doesnt even run, therefore I am guessing some kind of form flag has not been set.

Link to comment
Share on other sites

Ah ha, careless mistake, I added the following code after the tep_db_perform(TABLE_CATEGORIES_DESCRIPTION section instead of after the tep_db_perform(TABLE_PRODUCTS_DESCRIPTION section:

 

// START: Extra Fields Contribution

$extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE products_id = " . (int)$products_id);

while ($products_extra_fields = tep_db_fetch_array($extra_fields_query)) {

$extra_product_entry[$products_extra_fields['products_extra_fields_id']] = $products_extra_fields['products_extra_fields_value'];

}

 

if ($HTTP_POST_VARS['extra_field']) { // Check to see if there are any need to update extra fields.

foreach ($HTTP_POST_VARS['extra_field'] as $key=>$val) {

if (isset($extra_product_entry[$key])) { // an entry exists

if ($val == '') tep_db_query("DELETE FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " where products_id = " . (int)$products_id . " AND products_extra_fields_id = " . (int)$key);

else tep_db_query("UPDATE " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " SET products_extra_fields_value = '" . tep_db_input($val) . "' WHERE products_id = " . (int)$products_id . " AND products_extra_fields_id = " . (int)$key);

}

else { // an entry does not exist

if ($val != '') tep_db_query("INSERT INTO " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " (products_id, products_extra_fields_id, products_extra_fields_value) VALUES ('" . (int)$products_id . "', '" . (int)$key . "', '" . tep_db_input($val) . "')");

}

}

}

// END: Extra Fields Contribution

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...