Jump to content
Jack_mcs

Add More Fields

Recommended Posts

Hi,

 

I've just tried the pre 2.3 version of admin/add_fields php as I am using 2.3.4, and that seems to have fixed the problem I was having with nothing showing.  I can now see the Add More Fields V 1.3 area where I can start to enter info.

Thanks

Share this post


Link to post
Share on other sites

I've got a very old oscommerce site that I'm updating to Ver. 2.3.4. The old one had lots of extra fields and I am trying to implement your contribution. But in the install.txt everything is fine until I get to the changes to the categories.php file. The code I'm instructed to find does not exist. I'm at a loss as what to do? Here's the areas I'm referring to:
Can't find in the categories.php file:

FIND (around line 823):
$pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);

FIND (around line 925):
echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));

I'm not a programmer, so I'm totally lost as to how to proceed. Can you assist me?

then …

rechecked all files and discovered where I'd gone wrong so went ahead and made all changes uploaded all, ran sql, now getting this error:

 

Fatal error: Cannot redeclare tep_sort_admin_boxes() (previously declared in /home/nelson49books/public_html/xodo8tiealf36xrr/includes/column_left.php:40) in /home/nelson49books/public_html/xodo8tiealf36xrr/includes/column_left.php on line 40

then…

okay got that fixed by commenting out those lines in the column_left.php. Now when I want to add a field, I get this:

 
Not Acceptable

An appropriate representation of the requested resource /xodo8tiealf36xrr/add_more_fields.php could not be found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

Can anyone help?

Share this post


Link to post
Share on other sites

@@kaseynova I'm not clear as to what lines you removed from the left column but the last error is saying one of the files from the addon is missing. It seems you haven't uploaded all of them.

Share this post


Link to post
Share on other sites

Hi Jack,

 

I've downloaded your version that's last been updated Oct 24, 2011 from http://addons.oscommerce.com/info/8073

 

I'm running 2.3.4 and am running into the same issues as outlined earlier where code was missing and so to skip it. Has there been a version released since the Oct. 24 2011 version? If so - where is it? If not, what needs to be changed from that release to work with the latest version of OSC.

 

As I said - I know that these may have been asked before but that was 2 - 3 years ago and versions have been changed since then. 

} elseif (tep_not_null($HTTP_POST_VARS)) {
      $pInfo->objectInfo($HTTP_POST_VARS);
      $products_name = $HTTP_POST_VARS['products_name'];
      $products_description = $HTTP_POST_VARS['products_description'];
      $products_url = $HTTP_POST_VARS['products_url'];

I take it we skip the above code?

  } elseif ($action == 'new_product_preview') {
    if (tep_not_null($HTTP_POST_VARS)) {
      $pInfo = new objectInfo($HTTP_POST_VARS);
      $products_name = $HTTP_POST_VARS['products_name'];
      $products_description = $HTTP_POST_VARS['products_description'];
      $products_url = $HTTP_POST_VARS['products_url'];
    } else {
      $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");

Can't be found in 2.3.4 - DO WE SKIP THIS? Closest thing I have found is:

 

  } elseif ($action == 'new_product_preview') {
    $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");
echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));

The above is not found in 2.3.4

 

In the instructions for product_info.php you have the following code you need to find:

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

However in 2.3.4 it's been modified to:

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

Which might make it hard for someone to find (posting in thread for future coder usage as reference point. Please correct if wrong)

 

When doing the edits to admin/categories.php and pushing it out to my server, the categories.php page was blank. I'm sure that this is a /Facepalm moment but was not sure if it's the version that you have up as a contribution not playing nice with 2.3.4 or not. 

 

Thanks,

Chris

Share this post


Link to post
Share on other sites

I've installed it into 2.3.4 shops but I have an updated version here and I also don't do it by following the instructions. My version here isn't ready to be uploaded so that is not available. But the changes to categories.php that you mentioned appear correct. In general, that file is the same in all versions except for some of sections are missing. So if you can't find a section, skip it. But if you find the code and it is only similar, then don't just replace it with what is in the addon. It will have to be merged.

 

A simple example might be that in the 2.3.4 shop there will be something like ...(int)code here... while the instructions might have ...code here... The (int) is a security fix and the code will run without it, though you will introduce a security hazard so you shouldn't just replace it.

 

For the echo stripslashes line, the <p></p> are for formatting and that is not used in all shops. With all of the versions that are available, it is not practical to write instructions for all of them so you have be aware of such things.

Share this post


Link to post
Share on other sites

@@Jack_mcs I'm using OSC version 2.3.3.4 and I when I click on "Add More Fields" in admin, I get the follwing error:

Fatal error: Cannot redeclare tep_sort_admin_boxes() (previously declared in /home/xxxxxx/public_html/xxxxxx/includes/column_left.php:40) in /home/elgxvqtc/public_html/bt0wnmeD1a/includes/column_left.php on line 40

And this the line of code referenced in admin/includes/column_left.php:

    function tep_sort_admin_boxes($a, $b) {
      return strcasecmp($a['heading'], $b['heading']);
    }

Thanks for your time and assistance.

Edited by discxpress

Share this post


Link to post
Share on other sites

@@discxpress If you've made any changes to the column_left.php file for this installation, please remove those since they are not needed in your version.

Share this post


Link to post
Share on other sites

Then I don't know what that might be. I've never seen it before in the installations I have done and no one has reported it here. The function you mention is an oscommerce function and not used by this addon. All I can think to suggest is to remove the change to the includes/boxes/catalog.php file to see if the problem goes away. If it doesn't, I don't see how the problem is related to this addon since the admin wouldn't know about it at that point. If it does go away, then the changes to that file need to be looked at.

Share this post


Link to post
Share on other sites

I'm going to try a fresh install. I haven't made any changes to categories.php file. But have made some changes to the catalog.php file like adding links to easy populate.

 

Thanks for the reply.

Share this post


Link to post
Share on other sites

@@Jack_mcs I removed the 10-15 lines of code related to function tep_sort_admin_boxes AND function tep_sort_admin_links from admin/column_left.php.  Everything seems to be working fine except I now have 2 columns. But it works.

Edited by discxpress

Share this post


Link to post
Share on other sites

@Jack_mcs

Old but gold, please help.

in categories.php, the input box to text box - how to?

tep_draw_input_field($field['field_name'], $field['field_value']);
to 
tep_draw_textarea_field with box size specified

Also not to remove html and retain new lines when saving - using table products_description and updated the new field to varchar 512


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

I think this will display it as a textarea

tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_textarea_field($field['field_name'], 'soft', 30, 5,$field['field_value']); 

The html shouldn't be removed. I don't recall using any code that would do that but maybe I did. So I don't have an answer for this part. I don't have a shop set up with this addon installed so I can't test it.

Share this post


Link to post
Share on other sites

@Jack_mcs

Thanks Jack, that was close enough for me

<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_textarea_field($field['field_name'] . '[' . (int)$field['language_id'] . ']', 'soft', 30, 5, $field['field_value']) . '&nbsp; ' . $languages[$field['language_id']-1]['name']; ?>


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×