osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Product Extra Fields

This is a discussion on Product Extra Fields within the New osCommerce Contributions forums, part of the osCommerce 2.2 Forums category; I just got a Apostrophe FIX, that works pretty neat... here what you need to do: in admin/categories.php: find: if ...



Find us on Facebook
Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > New osCommerce Contributions

Connect with Facebook Register FAQDonate Members List Calendar Mark Forums Read


Closed Thread

 

LinkBack Thread Tools
  #1  
Old 06-11-2007, 01:16 PM
michael_s's Avatar
osCMax Developer


 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 15,732
Thanks: 139
Thanked 608 Times in 520 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Post Product Extra Fields

I just got a Apostrophe FIX, that works pretty neat...
here what you need to do:
in admin/categories.php:

find:
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 " . products_to_products_extra_fields . " where products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key);
else tep_db_query("UPDATE " . products_to_products_extra_fields . " SET products_extra_fields_value = '" . tep_db_prepare_input($val) . "' WHERE products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key);
}
else { // an entry does not exist
if ($val != '') tep_db_query("INSERT INTO " . products_to_products_extra_fields . " (products_id, products_extra_fields_id, products_extra_fields_value) VALUES ('" . (int)$products_id . "', '" . $key . "', '" . tep_db_prepare_input($val) . "')");
}
}
}

and replace with:
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 " . products_to_products_extra_fields . " where products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key);
else tep_db_query("UPDATE " . 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 = " . $key);
}
else { // an entry does not exist
if ($val != '') tep_db_query("INSERT INTO " . products_to_products_extra_fields . " (products_id, products_extra_fields_id, products_extra_fields_value) VALUES ('" . (int)$products_id . "', '" . $key . "', '" . tep_db_input($val) . "')");
}
}
}

(I replaced tep_db_prepare_input($val) to tep_db_input($val))
And then in catalog/product_info.php
find:
$extra_fields['value']

and replace with:
stripslashes($extra_fields['value'])

-the last one is needed to get rid of the slashes, that your data are stored with in the database.
(this also a fix for 1064 error, which I was getting when trying to add some data with slashes).
Should work fine... :)

ps. the uploaded file is the above text only. not a contribution.

More...
__________________
Michael Sasek
osCMax Developer

*** Do not PM me requesting paid help. The only paid work I do is for AABox Web Hosting customers ***

Stay Up To Date with everything osCMax:
Free osCMax Newsletters - Security notices, New Releases, osCMax News
osCMax on Twitter - Up to the minute info as it happens. Know it first.

osCMax User Manual - osCMax Templates - Advanced Template Tutorial

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Product Extra Fields michael_s New osCommerce Contributions 4 04-01-2007 04:27 AM
Product Extra Fields michael_s New osCommerce Contributions 0 03-21-2007 04:21 PM
Product Attributes/Extra fields laszlo_M osCommerce 2.2 Modification Help 0 03-01-2007 09:59 PM
Product Extra Fields michael_s New osCommerce Contributions 0 02-07-2007 01:50 PM
Product Extra Fields michael_s New osCommerce Contributions 0 01-25-2007 09:51 AM


All times are GMT -8. The time now is 05:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2009 osCMax
Inactive Reminders By Icora Web Design