Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Is it possible?


Japes

Recommended Posts

I have no use for the function of the following snippet as it is

 

<?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?>

 

How difficult would it be to create an additional product description field within admin and have its contents called upon by this existing code for customers who want additional product information? Is it possible?

 

I know you're all very busy, but please do chime in if you know the answer. I've left several posts within the forum that have gone unanswered in the past, which has left me lost in a few areas.

 

Any assistance will be very greatfully received.

 

Thanks

Link to comment
Share on other sites

How difficult would it be to create an additional product description field within admin
Quite easy. Add a field to the database and duplicate the code in categories.php (use a similar field as a base).

 

have its contents called upon by this existing code for customers who want additional product information?
Do you mean you will only display it for some customers? In that case it's more difficult. Otherwise, same as admin, look for a similar field in the page and reproduce code with your new field name instead.

Christian Lescuyer

Link to comment
Share on other sites

Hi Christian,

 

Thanks so much for your response.

 

Do you mean you will only display it for some customers? In that case it's more difficult. Otherwise, same as admin, look for a similar field in the page and reproduce code with your new field name instead.

 

No, the option would be there for everyone. It will likely be a text link that simply reads, 'More Info'.

 

You're right, it does sound simple enough if familiar with php, but I'm afraid I'm not terribly familiar with either php or mysql. I don't suppose I could trouble you to highlight the code I'd have to duplicate in order to add the additional description field? Also, how would I go about creating the new field within the database? I'm developing on my own machine with the help of easyphp and phpmyadmin.

 

Thanks again!

Link to comment
Share on other sites

I don't suppose I could trouble you to highlight the code I'd have to duplicate in order to add the additional description field?

It's not difficult, but you have to be meticulous. Locate a field similar to what you want to add, search for the field name in the php files with a text editor, and add a similar item each time with your new field.

Oh, and backup the file before you start :wink:

 

Also, how would I go about creating the new field within the database?

phpmyadmin is ok. Locate your table in the list. There is an Add new field box there.

Christian Lescuyer

Link to comment
Share on other sites

Hi Christian,

 

Thanks for the info. I've added the new field, 'more_info' to the table, 'products_description' within phpmyadmin, and I've duplicated the field within categories.php, but if you look at the following snippet, I'm not sure where my new field name should appear. It's confusing because, both the table and the field I've duplicated are called 'products_description'. I tried changing all instances of 'products_description' to 'more_info', but that gave me an error, as I'm sure you can understand.

 

<?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?>

 

Also, within product_info.php, how do I go about calling upon the information from 'more_info'. Ideally, I'd like to place a link that says 'more info' and have that trigger a popup. I suspect the popup will contain a new php file I'll have to create for more_info.

 

Thanks again. I appreciate your help, and I invite anyone to jump in and relieve Christian if you know the answers to my questions.

 

Cheers

Link to comment
Share on other sites

Call your new field something other than products_description - this is way too confusing - for your popup, use the popup_image.php as a basis - call your extra product info rather than an image

Link to comment
Share on other sites

Uh, I should have been more specific. Do you need a multi-lingual field? If you do, table products_description is the one to use, but everything is more complex (due to the language link).

 

If you don't, add your field to the products table, it will be easier.

 

And Matti's advice is good (of course :lol: ).

Christian Lescuyer

Link to comment
Share on other sites

Oh boy. Now I'm confused.

 

Matti,

 

I think I may have confused you with my description above. My new field isn't called products_description, but rather, more_info. The table the new field appears in is called products_description, as is the original field I've duplicated.

 

Christian,

 

I don't require a multi-lingual field. My site will be available in English only - at least for now.

 

So, you're saying I should remove the new field more_info from the table products_description and add it to the table products - is this correct? Will it not work the way I have it?

 

And, of course, my question above still stands. How should that snippet appear with the new field name? Do any other files aside from categories.php and product_info.php require altering?

 

Thanks to both of you.

Link to comment
Share on other sites

admin/includes/functions/general.php - you need to duplicate function tep_get_products_description. Replace products_description with more_info.

 

Also the necessary defines in your language files that correspond with admin/categories.php and catalog/product/info.php.

Link to comment
Share on other sites

Hi Matti,

 

I've done as you've suggested, but I suspect there's more to do within categories.php as when I enter some test text, it doesn't appear within the new_product_preview area of categories.php. I'm not even certain it's writing to the database at this stage. When I return to the section where you'd edit the more_info text, the field is blank, even after updating. I wasn't able to find anything within languages that required altering, so perhaps this is my problem.

 

I think this would make a great contribution.

Link to comment
Share on other sites

In categories.php you should have, amongst other things, something like the following (with your mod):

 

           $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

                                   'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

                                   'more_info' => tep_db_prepare_input($HTTP_POST_VARS['more_info'][$language_id]),

                                   'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

 

Make sure that more_info is in all the select and insert queries[/code]

Link to comment
Share on other sites

Okay, I've added that code, but...

 

Make sure that more_info is in all the select and insert queries

 

this part is beyond me. Where do I find the select and insert queries?

 

Don't you just love the technically illiterate?

Link to comment
Share on other sites

Have I got this snippet correct?

 

<?php echo tep_draw_textarea_field('more_info[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($more_info[$languages[$i]['id']]) ? $more_info[$languages[$i]['id']] : tep_get_more_info($pInfo->products_id, $languages[$i]['id']))); ?>

Link to comment
Share on other sites

 $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

           while ($description = tep_db_fetch_array($description_query)) {

             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");

 

Is it this portion, or is there more that needs attention?

 

Just trying to save you from having to be too specific.

Link to comment
Share on other sites

essentially, anywhere that you find products_description, you must duplicate with more_info.

 

Here is an example of select and insert:

 

            $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

           while ($description = tep_db_fetch_array($description_query)) {

             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");

           }

Link to comment
Share on other sites

That's exactly the code I posted above, so I'm on track. This is good :)

 

Okay, so if you'll please indulge me, it should look something like the following?

 

 $description_query = tep_db_query("select language_id, products_name, products_description, more_info, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

           while ($description = tep_db_fetch_array($description_query)) {

             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, more_info, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . 

tep_db_input($description['more_info']) . "', '" . tep_db_input($description['products_url']) . "', '0')");

 

Thanks again Matti. I appreciate your help and I'd be happy to return the favour.

Link to comment
Share on other sites

Okay, I've got it partially working. I've tested it by calling for more_info within product_info.php, just below the products description, so that seems to be working fine. I couldn't get it to display in new_product_preview, but that doesn't worry me.

 

So now I need to configure popup_image.php to handle the request. I'm hopeful this will be more straight-forward. Can you steer me in the right direction? You've done a fabulous job so far - not a single error! Quite frankly, I'm astonished I've somehow managed to get it working.

Link to comment
Share on other sites

Can anyone help with this?

 

If you've read along, you'll see that I've created a new field within categories.php called more_info. I need to add a 'MORE INFO' link to product_info.php that launches a popup window containing the additional info for the current product.

 

Thanks to those of you able to give me a hand.

 

Cheers

Link to comment
Share on other sites

hi,

 

i am here in support, as i would also like someone to keep showing us how to do this.

 

well done so far japes, i am not there yet, but i am right behind u...

 

hopefully by the weekend..

Link to comment
Share on other sites

  • 2 weeks later...

Hi Fellas,

 

I didn't realise there had been additional posts to this thread. I'm still stuck where I left off. I've been occupied with other things, but ready to get back to it.

 

jonie1,

 

How are you progressing?

 

Matti,

 

As always, your assistance is appreciated.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...