Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Option Type Feature v1.6 (for osc 2.2 MS2)


Guest

Recommended Posts

Anyone figure out how to change the Max (32) chars for the text field? I would like to step that up to like 125 for so? A comment field needs to be longer than 32 characters, I just cant get it longer. Well I got it longer and it transfered to the shopping cart but then got cut off through the ordering process. I tried stepping up these fields in the database but I am missing something... Anyone do this yet?

 

-Dennis

Link to comment
Share on other sites

  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
I am using this contribution and need a little help. I have some text boxes with value prices added. Does anyone know how to get the Value Price added to the product in the shopping cart if the text box is filled out?

 

 

No, but if you hear back, please let me know as I am having the same problem.

 

 

Ok, I got a solution to this problem from bruyndoncx.

 

I made the following 2 changes to have the TEXT price included:

You basically build in a switch to see if it's a text attribute and in that case ignore the option_values_id for the selection of the pricing data. Remember, text fields all have options_id set to 0 (or other constant that you defined). There can only be one text field for each product, thus it is safe to ignore the option_values_id

 

In catalog/includes/classes/shopping_cart.php in the calculate function:

// attributes price
      if (isset($this->contents[$products_id]['attributes'])) {
        reset($this->contents[$products_id]['attributes']);
        while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
         //BoF CB also fetch the price if $value is a TEXT string
          //$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
          if  ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
            $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' ");
          } else {
            $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
          };
          //EoB CB switch for TEXT string
          
          $attribute_price = tep_db_fetch_array($attribute_price_query);

and in the attributes_price function

   function attributes_price($products_id) {
    $attributes_price = 0;

    if (isset($this->contents[$products_id]['attributes'])) {
      reset($this->contents[$products_id]['attributes']);
      while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
         //BoF CB also fetch the price if $value is a TEXT string
          //$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
          if  ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
            $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' ");
          } else {
            $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
          };
          //EoB CB switch for TEXT string

 

Thanks again bruyndoncx!

Link to comment
Share on other sites

Ok, I got a solution to this problem from bruyndoncx. 

Thanks again bruyndoncx!

 

Travisb, I took a look at this code. Is there any way you can send me over the files so I can do a DIFF or give me approximate line numbers ? I can not seem to figure out where you code should replace mine ... here is what my code looks like ...

 

// Push all attributes information in an array
     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

       while (list($option, $value) = each($products[$i]['attributes'])) {
//eSCV add-on --> move hidden field to if statement below
//echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                     where pa.products_id = '" . $products[$i]['id'] . "'
                                      and pa.options_id = '" . $option . "'
                                      and pa.options_id = popt.products_options_id
                                      and pa.options_values_id = '" . $value . "'
                                      and pa.options_values_id = poval.products_options_values_id
                                      and popt.language_id = '" . $languages_id . "'
                                      and poval.language_id = '" . $languages_id . "'");
         $attributes_values = tep_db_fetch_array($attributes);

//eSCV add-on --> determine if attribute is a text attribute and assign to $attr_value temporarily
         if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
           echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
           $attr_value = $products[$i]['attributes_values'][$option];
         } else {
           echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
           $attr_value = $attributes_values['products_options_values_name'];
         }
         $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
         $products[$i][$option]['options_values_id'] = $value;
//eSCV add-on --> assign $attr_value
         $products[$i][$option]['products_options_values_name'] = $attr_value;
         $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
         $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
       }
     }
   }

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     if (($i/2) == floor($i/2)) {
       $info_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $info_box_contents[] = array('params' => 'class="productListing-odd"');
     }

     $cur_row = sizeof($info_box_contents) - 1;

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-odd" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

     $products_name = '<table border="0" cellspacing="2" cellpadding="2" align="left">' .
                      '  <tr>' .
                      '    <!-- <td class="productListing-odd" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td> -->' .
                      '    <td class="productListing-odd" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><font size="2"><b>' . $products[$i]['name'] . '</b></font></a>';

     if (STOCK_CHECK == 'true') {
       $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
       if (tep_not_null($stock_check)) {
         $any_out_of_stock = 1;

         $products_name .= $stock_check;
       }
     }

     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       reset($products[$i]['attributes']);
       while (list($option, $value) = each($products[$i]['attributes'])) {
         $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
       }
     }

Link to comment
Share on other sites

Here is the link to the file:

http://home.comcast.net/~travisbarden/shopping_cart.html

 

 

Travisb, I took a look at this code.  Is there any way you can send me over the files so I can do a DIFF or give me approximate line numbers ?  I can not seem to figure out where you code should replace mine ... here is what my code looks like ...
Link to comment
Share on other sites

  • 2 weeks later...

My install works fine EXCEPT...

the field lables don't show up in the shopping cart, admin pages, ect...

and the field sort order seems entirely random. They show up in a different order every time.

 

I've read through and tried everything I could find about Option Type Feature, checked all my files again, but no luck.

I'm using v1.6 and osc2.2ms2

 

Anyone out there solved this problem??

thanks!

Link to comment
Share on other sites

Travis,

 

A question : what is not working here ? In my shop, I have the option price added to the product price if a user enters something in the text field. I did no special coding at all.

 

Maybe I have a bug on my shop but I cannot see it for the moment, even after some hours of alpha-testing.

 

Didier.

Link to comment
Share on other sites

Anybody know how to make the new fields "REQUIRED"?

Right now, they can be left empty of course, just wondering if anyone has done the modifications to check the input.

 

thanks!

 

You'll have to add an extra field in product_options to indicate if the option is required or not. In product_info.php you can then add a javascript to test if the required field is filled in or not. It's quite some work. Or you can hardcode in your shop the test using the option_id in your database (no need to add an extra database column).

 

Didier.

Link to comment
Share on other sites

this is exactly what I need for my shop, but its all Dutch to me :D does anybody have an English copy I can get.

 

Also the instructions are unclear as I seen no modifications to the DB or do I see where to add the code.

 

Your help is appreciated.

Link to comment
Share on other sites

this is exactly what I need for my shop, but its all Dutch to me  :D does anybody have an English copy I can get. 

 

Also the instructions are unclear as I seen no modifications to the DB or do I see where to add the code.

 

Your help is appreciated.

 

I think I figured out some of it....just needed to find the correct version to download.

Link to comment
Share on other sites

I am using Option Type Feature v1.6, but I was also wanting to put a quantity field on the product_info.php page for each of the radio buttons listed. The contribution for "easy way add Qty box in your product_info.php" doesn't include the Option Type Feature v1.6.

 

Can anyone help me?

Regards

 

AussieGirl

Link to comment
Share on other sites

I just published version v1.7 of Option Type Feature : Version v1.6 has been updated to include textarea option type fields so that text is not limited anymore to 32 characters. This new feature has been requested *a lot* on the support thread.

 

This is the changelog for v1.7 :

 

- Updated file "ReadMe.html" to include correct information on new textarea type option (read Step 4)

- /includes/configure.php : added new value 'PRODUCTS_OPTIONS_TYPE_TEXTAREA (4)'.

- changed column datatype of customers_basket_attributes.products_options_value_text from varchar(32) to "text".

- added admin support of fields products_options_length and products_options_comment (no need anymore to update the database manually).

- added javascript "Form Field Progress bar" to indicate how many characters are left for the customer to type. The size is determined by the 'products_options_length' field. Thanks to Dynamic Drive for this script (http://www.dynamicdrive.com).

- added stylesheet.css in package : needed for javascript Form Field Progress bar (new style '.progress')

- includes price tax fix of 26.07.2004 by Patrick_S

- includes dutch language file for admin/producs_attributes.php (thanks to Stef Verlint)

 

You can find it here :

 

URL : 7 Nov 2004 - Product Attributes - Option Type Feature v1.7

 

Try it it and tell me how it works.

 

Didier.

Link to comment
Share on other sites

I am using Option Type Feature v1.6, but I was also wanting to put a quantity field on the product_info.php page for each of the radio buttons listed.  The contribution for "easy way add Qty box in your product_info.php" doesn't include the Option Type Feature v1.6. 

 

Can anyone help me?

 

:'( wow ! You want to have a quantity box for each option ? The contribution you are talking about adds the quantity box for the main product (very useful !). The Option Type Feature allows the client to choose extra options for the product (sizes, text, ...). It adds possibility to enter text for the product (message, etc.) You can have n options for 1 product.

 

You want to order, for example, 5 options of type "x" but for 1 product ? Correct ? I did not see any contribution that can do this. A big change in the OSC order module however.

 

Didier.

Link to comment
Share on other sites

I have found a bug in version 1.7 when using the text area option when you reach the max character as stated in the admin, if you keep typing although no more text gets typed the progress bar and textarea continue to expand distorting the whole site.

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

:'(  wow ! You want to have a quantity box for each option ? The contribution you are talking about adds the quantity box for the main product (very useful !).

 

I?m looking, too for a contribution to add qty. to each Option ; does anyone know a contrib which could do that ?

OSC Webmakers Edition modiefied with many other contribs and enhancements.

+ STS 4.5.7 for 2.2MS2 and RC1

Link to comment
Share on other sites

I have found a bug in version 1.7 when using the text area option when you reach the max character as stated in the admin, if you keep typing although no more text gets typed the progress bar and textarea continue to expand distorting the whole site.

 

aarrgg.those stupid javascripts. I have tested it with IE6 and Firefox and I had no problems. I will re-check and try the update product_info.php page.

 

Thanks for testing Steve !

 

Didier.

Link to comment
Share on other sites

aarrgg.those stupid javascripts. I have tested it with IE6 and Firefox and I had no problems. I will re-check and try the update product_info.php page.

 

Thanks for testing Steve !

 

Didier.

 

I have tested further and the issue seems to just be with Firefox IE6 is working as it should.

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

I have tested further and the issue seems to just be with Firefox IE6 is working as it should.

 

Correct ! Firefox does not manage it very well, even if it works on the dynamicdrive page with Firefox. But in OSC it expands the table.

 

It's ok for IE4+, NS6+, and Opera 7+.

 

Here is the link on dynamicdrive for more info on this "Form Field Progress bar"

 

http://www.dynamicdrive.com/dynamicindex16/limitinput2.htm

 

@all : you can of course drop this javascript or use another one that checks if the user has not reached the textarea maxlength.

 

Also, while doing testing of this script, I saw a comment that remained in the code and it should not be : change line 27 in product_info.php

 

<script language="javascript"><!--

 

by

 

<script language="javascript">

 

To be fixed in the next version !

 

Thanks Steve for the beta testing !!

 

Didier.

Link to comment
Share on other sites

Hi all ~

 

I've just installed a fresh copy of OsC and then added this contribution. All seemed to work well, however, when I view the product page it's blank. View Source shows the code but it never loads in IE6.

 

Has anybody else come across this?

 

Thanks,

Amanda

Link to comment
Share on other sites

Hi All, I have been working to get this contrib to work, YES IT WORKS NOW :thumbsup:

Only one snag- If the customer is not logged in or signed up yet, they complete the order form and then prompted to log in or sign up, ok, when they are returned and complete the order process the text values have disappeared from order confirmation and email notifications, however if they are signed up or logged in before they start the order process everything works just dandy,

I think I have seen a fix for something similar with the refreshing of forms and dropdown data in country / state / zones or something like that where the session was being dropped between refresh, Does anyone know what the fix was I cannot find it now, and or does anyone have a little hack I could use, the site is ms2 and does have sts installed.

does anyone else have this problem? I am nearly there but not quite.

I appreciate your help.

Regards

Ian

 

*Loaded versions are not support in the forums

Edited by 241
Link to comment
Share on other sites

PROBLEM

 

I just installed version 1.7 and most everything seems to work fine, all except the comments.

 

The Text type Attribute is not getting saved, either when I add a new product attribute or editing a current one. How can I get the Text type attributes to save the comments?

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

I also noted something else...

 

If I go into phpMyAdmin and add the comments manually, everything is fine until I go to edit the text attribute. When I click on the update button, it deletes the comments I added manually. No matter if I edit the comment itself or leave the comment alone and edit the size or whatever.

 

Anyone else seen this happen?

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

Scott : hmm.I've tested the new products_attributes.php page and I can save the comments. They are also not lost when editing something else. Did you modify correctly the code ? I can send you my products_attributes page so that you can compare.

 

Didier.

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...