Jump to content
Latest News: (loading..)
Zappo

[Contribution] Option Types v2

Recommended Posts

My Option Types BS (Bootstrap) addon is only for the community responsive build and not for the normal osCommerce version.

For more info on the community responsive build look here: http://forums.oscommerce.com/topic/396152-bootstrap-3-in-234-responsive-from-the-get-go/

 

If you want to use the option types addon with the normal osC then you have to use this one: http://addons.oscommerce.com/info/6818


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

My Option Types BS (Bootstrap) addon is only for the community responsive build and not for the normal osCommerce version.

For more info on the community responsive build look here: http://forums.oscommerce.com/topic/396152-bootstrap-3-in-234-responsive-from-the-get-go/

 

If you want to use the option types addon with the normal osC then you have to use this one: http://addons.oscommerce.com/info/6818

 

thanks for that insight. I just tried the normal one that you posted.

 

I uninstalled tinyMCE, and ran sql, then replaced the files (clean install)

 

But I get this this https://gyazo.com/989de02783e6eb4b5e4497f583df4509

Share this post


Link to post
Share on other sites

Please read the instructions or install manual that is included. There are also changes to various files necessary.


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

Please read the instructions or install manual that is included. There are also changes to various files necessary.

 

oh wait. The changes in the files included are not the final file, rather they are changes that need to be made?

 

Is that correct?

Share this post


Link to post
Share on other sites

You will need to run the SQL file, add the new files and make additional changes to a whole bunch of stock osc files.

As far I can remember the shopping_cart.php and the admin/products_attributes.php file are the only stock osc files that I included to save some time since there are a lot changes to be done. But there are a lot more files that need to be amended to make this addon work.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

You will need to run the SQL file, add the new files and make additional changes to a whole bunch of stock osc files.

As far I can remember the shopping_cart.php and the admin/products_attributes.php file are the only stock osc files that I included to save some time since there are a lot changes to be done. But there are a lot more files that need to be amended to make this addon work.

 

thanks. I did it step by step,but I seem to get a 500 error on the front end, and admin is still working.

Share this post


Link to post
Share on other sites
Apologies if I'm repeating but I was wondering if anyone had used this Addon while also having QTpro installed?

 

We've got an online shop using osCommerce and have installed QTpro as we need to track stock via the attributes.

 

We would also like to have a sort order and use a checkbox so using Option Types would be perfect.

 

Does anyone have a version of this addon where you've combined it with QTpro before, rather than just on a vanilla install of osCommerce as per the install instructions?

 

Many thanks

 

Glen

Edited by GlenPig

Share this post


Link to post
Share on other sites

@@Tsimi,

 

Hi, Lambros!

 

I installed the Option Types v2, and I'm testing it now.
I see that checkbox do not work correctly.
The Value Price is different, but the same outputs.
See screenshot.

 

Check it please.

post-57268-0-96725700-1458473083_thumb.jpg

post-57268-0-79956500-1458473090_thumb.png

Edited by spidometrs

No outside url's in signatures allowed - thanks

Share this post


Link to post
Share on other sites

@@spidometrs

 

Hi Sergey :)

 

Yeah, that doesn't work that way. This Option Types Addon was build like this. Don't ask me why but here an old post that shows a quote of the creator of this addon. Only one checkbox per option. No idea why he did that but it is as it is. That is why the price gets copied over to the next checkbox. Unless you create a new option with another checkbox with a separate price.

 

http://forums.oscommerce.com/topic/338661-contribution-option-types-v2/?p=1470359

 

No multiple choices for checkboxes. <_<

Anyway for your case Installation? Yes/No? Why not use radio buttons instead.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

 

No multiple choices for checkboxes. <_<

Anyway for your case Installation? Yes/No? Why not use radio buttons instead.

I'm disappointed.

 

What do you think, how much you need to make changes to get a multiple choice for checkboxes?

And we make it possible for Option Types v2?


No outside url's in signatures allowed - thanks

Share this post


Link to post
Share on other sites

I propose to change the sorting of the attributes for the price.

Change the line in the file product_info.php

        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$ProdOpt_ID . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.products_options_sort_order");

on

        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$ProdOpt_ID . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.products_attributes_id");

I have this code works well.


No outside url's in signatures allowed - thanks

Share this post


Link to post
Share on other sites

Hi folks,

 

Running OSC 2.3.4 BS and have installed this wonderful mod that will help me immensely, except I've probably made a noob error, not being a programmer and all.

 

Wonder if anyone can point me in the right direction.

 

I'm getting an "unexpected '}' in my shopping cart php file on line 189. Customer can add the items but when hit Checkout or 'Shopping Cart' from the info box I get the blank page & error in the log.

Here's the tail end of the file:

<?php
      }
    }
?>

  </div>

  <div class="buttonSet">
<!--BOF JOHN ADDED BUG FIX BUTTON FOR TEXT CLEAR CART/-->  
	<div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_CLEAR_CART, 'fa fa-trash-o', tep_href_link(FILENAME_SHOPPING_CART, 'action=clear_cart'), 'primary', NULL, 'btn-danger');?></div>
<!--EOF JOHN ADDED BUG FIX BUTTON FOR TEXT CLEAR CART //-->
   <div class="col-xs-6 text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fa fa-angle-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success'); ?></div>
  </div>

<?php
    $initialize_checkout_methods = $payment_modules->checkout_initialization_method();

    if (!empty($initialize_checkout_methods)) {
?>
  <div class="clearfix"></div>
  <p class="text-right"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></p>

<?php
      reset($initialize_checkout_methods);
      while (list(, $value) = each($initialize_checkout_methods)) {
?>

  <p class="text-right"><?php echo $value; ?></p>

<?php
      }
    }
?>

</div>

</form>

<?php
  } else {
?>

<div class="alert alert-danger">
  <?php echo TEXT_CART_EMPTY; ?>
</div>

<p class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', tep_href_link(FILENAME_DEFAULT), 'primary', NULL, 'btn-danger'); ?></p>

<?php
  }

  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

All the Admin side works, the Options show on the Product Info page, I just can't see the Cart & get a blank html page.

I've used Beyond Compare to merge the changes in both txt files in the package & have tried to verify that I've made the changes properly.

All the files are uploaded to the right place and the new folders created.

The order is in the customer basket table.

Can someone who knows the logic possibly point me at the right file that I could have made the mistake in coz I really can't spot it!

 

Regards,

 

Simon

Edited by Spannerman1

Share this post


Link to post
Share on other sites

Thanks for the quick response!

 

I've been trying to match up the {'s and }'s, biut I don't have a great editor for doing so!

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  require("includes/application_top.php");

  if ($cart->count_contents() > 0) {
    include(DIR_WS_CLASSES . 'payment.php');
    $payment_modules = new payment;
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));

  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<div class="page-header">
  <h1><?php echo HEADING_TITLE; ?></h1>
</div>

<?php
  if ($messageStack->size('product_action') > 0) {
    echo $messageStack->output('product_action');
  }
?>

<?php
  if ($cart->count_contents() > 0) {
?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>

<div class="contentContainer">
  <div class="contentText">

<?php
    $any_out_of_stock = 0;
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// 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'])) {
          echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
          //BOF - Zappo - Option Types v2 - (Hidden field moved below)
          $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 = '" . (int)$products[$i]['id'] . "'
                                       and pa.options_id = '" . (int)$option . "'
                                       and pa.options_id = popt.products_options_id
                                       and pa.options_values_id = '" . (int)$value . "'
                                       and pa.options_values_id = poval.products_options_values_id
                                       and popt.language_id = '" . (int)$languages_id . "'
                                       and poval.language_id = '" . (int)$languages_id . "'");
          $attributes_values = tep_db_fetch_array($attributes);

          // - Zappo - Option Types v2 - If attrib is Text, assign to $attr_value temporarily (Here's that hidden field)
          if ($value == 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;
          $products[$i][$option]['products_options_values_name'] = $attr_value ;
//EOF - Zappo - Option Types v2 - (Line above Assigns $attr_value)
          $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
          $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
        }
      }
    }
?>

    <table class="table table-striped table-condensed">
      <tbody>
<?php
    $products_name = NULL;
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      $products_name .= '<tr>';

      $products_name .= '  <td valign="top" 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 valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><strong>' . $products[$i]['name'] . '</strong></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;

          //BOF - Zappo - Option Types v2 - Changed $stock_check to also be used when item is in Stock...
        }
      } else {
        $stock_check = '';
//EOF - Zappo - Option Types v2 - Changed $stock_check to also be used when item is in Stock...
        }
      }

      if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
        reset($products[$i]['attributes']);
        while (list($option, $value) = each($products[$i]['attributes'])) {
          //BOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, added Options Column, Upload preview link, and added Prices to Attributes
          $imageDir = (tep_session_is_registered('customer_id'))? UPL_DIR : TMP_DIR;
          $image_link = '';
          if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
            $image_link .= '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '" target="_blank">';
          }
          $Option_Price = ($products[$i][$option]['options_values_price'] != '0') ? ' - (' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], tep_get_tax_rate($products[$i]['tax_class_id'])) . ')' : '';
          $products_name .= '<br /><small>- ' . $products[$i][$option]['products_options_name'] . ': <i>' . $image_link . $products[$i][$option]['products_options_values_name'] . '</a></i>' . $Option_Price . '</small>';
        }
      }

      $products_name .= '<br>' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'style="width: 65px;" min="0"', 'number') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . ' ' . tep_draw_button(NULL, 'fa fa-refresh', NULL, NULL, NULL, 'btn-info btn-xs') . ' ' . tep_draw_button(NULL, 'fa fa-remove', tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product'), NULL, NULL, 'btn-danger btn-xs');

      $products_name .= '</td>';

      $products_name .= '  <td align="right" valign="top"><strong>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</strong></td>' .
                        '</tr>';
    }
    echo $products_name;
?>

      </tbody>
    </table>

    <p class="text-right"><strong><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></strong></p>

<?php
    if ($any_out_of_stock == 1) {
      if (STOCK_ALLOW_CHECKOUT == 'true') {
?>

    <div class="alert alert-warning"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>

<?php
      } else {
?>

    <div class="alert alert-danger"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>

<?php
      }
    }
?>

  </div>

  <div class="buttonSet">
<!--BOF JOHN ADDED BUG FIX BUTTON FOR TEXT CLEAR CART/-->  
	<div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_CLEAR_CART, 'fa fa-trash-o', tep_href_link(FILENAME_SHOPPING_CART, 'action=clear_cart'), 'primary', NULL, 'btn-danger');?></div>
<!--EOF JOHN ADDED BUG FIX BUTTON FOR TEXT CLEAR CART //-->
   <div class="col-xs-6 text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fa fa-angle-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success'); ?></div>
  </div>

<?php
    $initialize_checkout_methods = $payment_modules->checkout_initialization_method();

    if (!empty($initialize_checkout_methods)) {
?>
  <div class="clearfix"></div>
  <p class="text-right"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></p>

<?php
      reset($initialize_checkout_methods);
      while (list(, $value) = each($initialize_checkout_methods)) {
?>

  <p class="text-right"><?php echo $value; ?></p>

<?php
      }
    }
?>

</div>

</form>

<?php
  } else {
?>

<div class="alert alert-danger">
  <?php echo TEXT_CART_EMPTY; ?>
</div>

<p class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fa fa-angle-right', tep_href_link(FILENAME_DEFAULT), 'primary', NULL, 'btn-danger'); ?></p>

<?php
  }

  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Share this post


Link to post
Share on other sites

@@Spannerman1

 

Remove } tag on line 106

 

Regarding tools/editor, I use Notepad++

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

Just been comparing files again & in case it's relevant I used your alternate products_attributes.php for the merges using Beyond Compare, since it seemed the cleaner way of the two to do it!

 

I have a couple of other mods installed, but nothing I could see conflicting with the changes needed with yours.

I have the Alternative Administration System, which is pretty much stand alone and doesn't change OSC core files to install.

Theme Switcher, which makes a small change to template_top.php

Modular Front Page, which changes index.php, again minimally.

 

Many thanks once again for helping me with this. It is much appreciated.

 

Regards,

 

Simon

Share this post


Link to post
Share on other sites

@@Tsimi,

 

May I trouble you one more time, please?

 

I have used the 'required aria-required="true" tweak you posted on the previous page for the Text areas, but am using Radio buttons for my Product Options. Is there an easy way of making the customer make a choice?

 

All of the options are unchecked when the page loads & they can just add an item without making any choices at all. 

 

My items don't all have text fields.

 

I have seen questions going back many years in the forums, but not seen an answer.

 

Many thanks & Regards once again,

 

Simon

Share this post


Link to post
Share on other sites

No trouble at all that is why we have a support topic here.

Before we didn't had Bootstrap and therefore it was not that easy to do. Could have been done with some javascript code I guess. But with BS you just add 'required aria-required="true"' and you should be good.

 

Open your includes/modules/option_types.php file and look for this code around line 95

$tmp_html .= tep_draw_radio_field('id[' . $ProdOpt_ID . ']', $products_options_array['products_options_values_id'], $checked);
REPLACE WITH THIS
$tmp_html .= tep_draw_radio_field('id[' . $ProdOpt_ID . ']', $products_options_array['products_options_values_id'], $checked, 'required aria-required="true"');
Try this and tell me if that works for you. Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

@Tsimi

 

Sorry to bother you again!

 

The option type works, but........

Several customers manage to place an order WITHOUT filling in the option type?!!

I guess they press the spacebar ??????

 

You allready gave me advise how to force the customer to fill in the option (required aria-required="true")

But is there a way to say for example the filled-in option must have a minumum lenght of 5 characters ???

Share this post


Link to post
Share on other sites

@@fotogaaf

 

even if you put a minimum value that wouldn't stop the customer from pushing the space bar until they reach that minimum value.

Just write a comment and tell them to insert at least your requirements before adding the product into the cart.


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. Edge)

 

Share this post


Link to post
Share on other sites

@Tsimi

 

I allready wrote a comment :(

 

So thats's why I wonder if  there is  a way to say for example the filled-in option must have a minumum lenght of 5 characters ???

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

×