Jump to content
Sign in to follow this  
wdepot

Just released: Extra Product Fields 2.23

Recommended Posts

I've just posted an update to the Extra Product Fields contribution at http://addons.oscommerce.com/info/6856 which fixes a small bug during field creation where a question related only to text fields was being required during the creation of a list type field.

 

I also added an install instruction so that existing Extra Fields are properly handled if a language is added or deleted using Admin/Localization/Languages.

Share this post


Link to post
Share on other sites

Thank-you this is a great contribution. Although I found a minor error - if you have subcategories and try to add a product under a subcategory, the Extra Product Fields do not show up on the Product editting page??

Share this post


Link to post
Share on other sites

Just installed 2.24 it's brilliant; just what I was looking for.

 

Is there away to... not sure how to describe it best, I'll use an example;

You sell books and dvds. You have a drop-down box that has the values 'books' and 'dvds', once you select one then an 'author' field appears for books or a 'director' for dvd. 'Title' applies to both and would be visible prior to selecting books or dvds.

 

I know it's not the best example because you would have text entry boxes for those fields and they probably wouldn't overlap, but I'm using numerical values that can overlap (voltage, current, etc.). Is it possible?

 

While I'm here, and on numerical values, can you give specific values to products and have 'xx-yy' in the drop-down that selects every thing between xx and yy inclusive.

 

Thanks in advance for any help

 

-Power Drive

Share this post


Link to post
Share on other sites

Thank-you this is a great contribution. Although I found a minor error - if you have subcategories and try to add a product under a subcategory, the Extra Product Fields do not show up on the Product editting page??

 

Hi - Am a newby to oscommerce, but have found the forums and addons very helpful. I had the same problem, but found if I commented out this line (as the languages not necessary on my site):

 

$currentval = (isset($extra[$e['field']][$languages[$i]['id']]) ? stripslashes($extra[$e['field']][$languages[$i]['id']]) : tep_get_product_extra_value($e['id'], $pInfo->products_id, $languages[$i]['id']));

 

So it become this

 

/*$currentval = (isset($extra[$e['field']][$languages[$i]['id']]) ? stripslashes($extra[$e['field']][$languages[$i]['id']]) : tep_get_product_extra_value($e['id'], $pInfo->products_id, $languages[$i]['id']));*/

 

The extra product field showed.

Share this post


Link to post
Share on other sites

I using Extra Product Fields addon with Customer Add Products addon, and I am having a problem trying to get the drop down menu for extra product fields to show on account_add.php. It just comes up blank - any ideas? I am not a programmer, so do not want to mess around too much with the php, but believe the problem is with the extra product scripting as follows:

 

// START: Extra Fields Contribution (chapter 1.4)

// Sort language by ID

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$languages_array[$languages[$i]['id']]=$languages[$i];

}

$extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_EPF_LABELS . " ORDER BY epf_id");

//I changed this from . TABLE_EPF . as nothing showed at all, I now get the labels showing, but no content for the dropdown menu

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

?>

<tr>

<td colspan="2" class="main"><b><?php echo $extra_fields['epf_label']; ?>:</b></td></tr>

<tr>

 

<td colspan="2" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '15') . ' ' . tep_draw_pull_down_menu("extra_fields[".$extra_fields['value_id']."]", $pInfo->extra_fields[$extra_fields['value_id']]); ?></td>

</tr>

<tr><td>

<tr>

 

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

 

</tr>

<?

}

// END: Extra Fields Contribution

 

Any help would be greatly appreciated!

Share this post


Link to post
Share on other sites

Hi - Am a newby to oscommerce, but have found the forums and addons very helpful. I had the same problem, but found if I commented out this line (as the languages not necessary on my site):

 

$currentval = (isset($extra[$e['field']][$languages[$i]['id']]) ? stripslashes($extra[$e['field']][$languages[$i]['id']]) : tep_get_product_extra_value($e['id'], $pInfo->products_id, $languages[$i]['id']));

 

So it become this

 

/*$currentval = (isset($extra[$e['field']][$languages[$i]['id']]) ? stripslashes($extra[$e['field']][$languages[$i]['id']]) : tep_get_product_extra_value($e['id'], $pInfo->products_id, $languages[$i]['id']));*/

 

The extra product field showed.

 

Hi, Thank-you for this fix.. Although I can;t find this code in my files - what is the file name that you editted to get this working??

Share this post


Link to post
Share on other sites

Hey, Complete new here and I am following the installation guide as instructed and I got to the Step 5a, it says

 

5) In catalog/index.php

5a) Around line 272 find the section of code that reads as follows:

           <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>

Immediately BEFORE the </table> ADD the following lines of code:

         <!-- begin extra product fields -->
         <tr>
           <td class="main" align="right" colspan="2">
           <?php
             $epf_list = array();
             foreach ($epf as $e) {
               if ($e['restrict']) $epf_list[] = $e['field'];
             }
             echo tep_draw_form('epf_restrict', FILENAME_DEFAULT, 'get');
             if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
               reset($HTTP_GET_VARS);
               while (list($key, $value) = each($HTTP_GET_VARS)) {
                 if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $epf_list)) ) {
                   echo tep_draw_hidden_field($key, $value);
                 }
               }
             }
             foreach ($epf as $e) {
               if ($e['restrict']) {
                 echo sprintf(TEXT_RESTRICT_TO, $e['label'], tep_draw_pull_down_menu($e['field'], tep_build_epf_pulldown($e['id'], $languages_id, array(array('id' => '', 'text' => TEXT_ANY_VALUE))),'', 'onchange="this.form.submit()"')) . '<br>';
               }
             }
            ?>
            </form>
           </td>
         </tr>
         <!-- end extra product fields -->

 

The problem is, I dont see that line in my index.php

 

Thank you in advance. I just need to add couple of product fields such as Author, ISBN, and Publisher

Edited by stenzin

Share this post


Link to post
Share on other sites

Hey, Complete new here and I am following the installation guide as instructed and I got to the Step 5a, it says

 

5) In catalog/index.php

5a) Around line 272 find the section of code that reads as follows:

           <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>

Immediately BEFORE the </table> ADD the following lines of code:

         <!-- begin extra product fields -->
         <tr>
           <td class="main" align="right" colspan="2">
           <?php
             $epf_list = array();
             foreach ($epf as $e) {
               if ($e['restrict']) $epf_list[] = $e['field'];
             }
             echo tep_draw_form('epf_restrict', FILENAME_DEFAULT, 'get');
             if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
               reset($HTTP_GET_VARS);
               while (list($key, $value) = each($HTTP_GET_VARS)) {
                 if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $epf_list)) ) {
                   echo tep_draw_hidden_field($key, $value);
                 }
               }
             }
             foreach ($epf as $e) {
               if ($e['restrict']) {
                 echo sprintf(TEXT_RESTRICT_TO, $e['label'], tep_draw_pull_down_menu($e['field'], tep_build_epf_pulldown($e['id'], $languages_id, array(array('id' => '', 'text' => TEXT_ANY_VALUE))),'', 'onchange="this.form.submit()"')) . '<br>';
               }
             }
            ?>
            </form>
           </td>
         </tr>
         <!-- end extra product fields -->

 

The problem is, I dont see that line in my index.php

 

Thank you in advance. I just need to add couple of product fields such as Author, ISBN, and Publisher

 

 

You may find this easier

http://addons.oscommerce.com/info/3164

Share this post


Link to post
Share on other sites

Hi Guys,

 

I have looked but I can not find how to insert my extra filed on the product_info.php page, can nayone point me in the right direction?

 

Many thanks

 

Simon

Share this post


Link to post
Share on other sites

Where did you find

15c) Around line 599 find the section of code that reads as follows:

 } 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'] . "'");
     $product = tep_db_fetch_array($product_query);

 

in admin/categories.php??

 

all I find thats close to that 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'] . "'");
   $product = tep_db_fetch_array($product_query);

   $pInfo = new objectInfo($product);
   $products_image_name = $pInfo->products_image;

   $languages = tep_get_languages();
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
     $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
     $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
     $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);

 

?

 

Also same file

 

15e) Around line 386 find the code that reads as follows:

     $products_name = $HTTP_POST_VARS['products_name'];
     $products_description = $HTTP_POST_VARS['products_description'];
     $products_url = $HTTP_POST_VARS['products_url'];

 

Does not exist

Edited by snights

Share this post


Link to post
Share on other sites

I found both your code parts in my admin/catergories.php

 

Have you installed any other contribs before you started this one? For example I have installed "product tabs" this means my code differs form the install.

 

Hope you manage to sort it, once installed this contrib has a lot of possibilities, but how do you add data that you have stored on the product info page?

 

many thanks

 

Simon

 

 

 

 

Where did you find

15c) Around line 599 find the section of code that reads as follows:

 } 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'] . "'");
     $product = tep_db_fetch_array($product_query);

 

in admin/categories.php??

 

all I find thats close to that 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'] . "'");
   $product = tep_db_fetch_array($product_query);

   $pInfo = new objectInfo($product);
   $products_image_name = $pInfo->products_image;

   $languages = tep_get_languages();
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
     $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
     $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
     $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);

 

?

 

Also same file

 

15e) Around line 386 find the code that reads as follows:

     $products_name = $HTTP_POST_VARS['products_name'];
     $products_description = $HTTP_POST_VARS['products_description'];
     $products_url = $HTTP_POST_VARS['products_url'];

 

Does not exist

Share this post


Link to post
Share on other sites

Hey, Complete new here and I am following the installation guide as instructed and I got to the Step 5a, it says

 

<SNIP>

 

The problem is, I dont see that line in my index.php

 

Thank you in advance. I just need to add couple of product fields such as Author, ISBN, and Publisher

 

I've found the same thing. There are similar issues later in the instructions. I'm wondering if we were supposed to install Product Extra Fields first, and then upgrade to this.

Share this post


Link to post
Share on other sites

I've found the same thing. There are similar issues later in the instructions. I'm wondering if we were supposed to install Product Extra Fields first, and then upgrade to this.

 

I have done a clean install of oscommerce, but its the same. I gave up on the extra fields for now. But i hope someone can help us out soon.

Share this post


Link to post
Share on other sites

Hi All,

 

In the install on product_info.php

 

11b) Around line 72 find the line that reads as follows:

 

    $product_info_query = 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_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

and REPLACE it with the following code:

 


 // begin Product Extra Fields

   $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";

   foreach ($epf as $e) {

     $query .= ", pd." . $e['field'];

   }

   $query .= " from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'";

   $product_info_query = tep_db_query($query);

   // end Product Extra Fields

 

My code looks like

 

 // BOF MaxiDVD: Modified For Ultimate Images Pack!
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, pd.products_tab_1, pd.products_tab_2, pd.products_tab_3, pd.products_tab_4, pd.products_tab_5, pd.products_tab_6 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
// EOF MaxiDVD: Modified For Ultimate Images Pack!

 

How I merge the two?

Edited by simaster99

Share this post


Link to post
Share on other sites

Sorry but the prolem is ..... how do I get this to work?

 

  // begin Extra Product Fields

     $query = "select pd.products_name,pd.products_description,pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag,, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image,p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id";

     foreach ($xfields as $f) {

       $query .= ', pd.' . $f;

     }

     $query .= " from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'";

     $product_query = tep_db_query($query);

     // end Extra Product Fields

 

ATM i get the following error when i edit a product,

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' pd.products_url, p.products_id, p.products_quantity, p.products_model, p.produc' at line 1

 

select pd.products_name,pd.products_description,pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag,, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image,p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, pd.extra_value_id1, pd.extra_value_ms2 from products p, products_description pd where p.products_id = '33' and p.products_id = pd.products_id and pd.language_id = '1'

 

[TEP STOP]

 

Any help would be much apriciated

Share this post


Link to post
Share on other sites

Hello,

 

I have conflict in code editing at least in one file of Extra Product Fields (Latest Version) with Master Products (Latest Version).

 

More specific:

 

6) In catalog/includes/modules/product_listing.php i found overlapping code between the two modules.

 

I haven't checked the whole changes yet. This is as far as i go.

 

I will freeze installation until further notice!

 

Does any of you have tried this at all ??

 

Please let me know cause i am in dead end.

Share this post


Link to post
Share on other sites

15d) Around line 386 find the code that reads as follows

$products_name = $HTTP_POST_VARS['products_name'];

$products_description = $HTTP_POST_VARS['products_description'];

$products_url = $HTTP_POST_VARS['products_url'];

 

are not located into categories.php!

Share this post


Link to post
Share on other sites

15d) Around line 386 find the code that reads as follows

$products_name = $HTTP_POST_VARS['products_name'];

$products_description = $HTTP_POST_VARS['products_description'];

$products_url = $HTTP_POST_VARS['products_url'];

 

are not located into categories.php!

 

 

Yes I have to agree. I have just open an untouched categories.php file with Editplus and these lines are NOT in the admin/categories.php file.

 

I am currently using oscommerce 2.3.1

Share this post


Link to post
Share on other sites

I everyone

I've installed EPF and created a new fiel called "ISBN" and populated it in all my products pages (more than 1300)

 

Now I have a problem with "google merchant" it seem that Google needs, to reconize it, a value called "product_isbn" and not ISBN, and in EPF I can't see any option to show a frontend name like ISBN for a MYSQL field called product_isbn

 

Any suggestion?

 

Thanks in advance...

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
Sign in to follow this  

×