Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

@@fotogaaf

 

If you don't mind I would like to answer your question below here in this topic since it might be useful for others.

 

......how do i force the custumer to fill in the option "Voer hier Uw fotonummer in:" ??

 

for that single input field open your catalog/includes/modules/option_types.php and look for the following code around line 32

		$tmp_html = '<div id="textboxsm"><input type="text" class="form-control" name="id[' . TEXT_PREFIX . $ProdOpt_ID . ']" id="id[' . TEXT_PREFIX . $ProdOpt_ID . ']" size="' . $ProdOpt_Length .'" maxlength="' . $ProdOpt_Length . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$ProdOpt_ID] .'"';

and replace with

		$tmp_html = '<div id="textboxsm"><input type="text" class="form-control" required aria-required="true" name="id[' . TEXT_PREFIX . $ProdOpt_ID . ']" id="id[' . TEXT_PREFIX . $ProdOpt_ID . ']" size="' . $ProdOpt_Length .'" maxlength="' . $ProdOpt_Length . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$ProdOpt_ID] .'"';

what we did is just add required aria-required="true". Now the customer is forced to type something inside the field to be able to add the product to the card. If he doesn't a popup will appear and tell him to do so.

Link to comment
Share on other sites

@Tsimi

 

Of course I don't mind !

It works perfect...just implemented it!

(working example:  http://www.fotogaaf.eu/schoolfotograaf-nederland-aanbieding-betaalbaar-prijs-actie-goedkoop/catalog/product_info.php/products_id/30)

1 more question: in configuration/optiontypes/Use progress bars:

 

If I set it at both everything is fine

If I set it at None: Layout changes dramaticly ?!
 

See image: http://www.fotogaaf.eu/osc-04.jpg 

How can i set it at none and keep the normal layout ??

Link to comment
Share on other sites

Hi,

 

Just tried doing a clean install, but I realized I already installed another addon - http://addons.oscommerce.com/info/9124

 

After I installed it, it messed up some of my tables, product options was showing errors.

 

This is my install process:

 

1) Run SQL file

2) Replace files.

 

Wondering if I can get any guidance on this. thanks!

Link to comment
Share on other sites

@@jchan94

 

What oscommerce version are you using?

Normal or responsive version?

 

2.3.4 (latest)

And Normal at the moment, but I have plans to implement a theme from Templatemonster relatively soon, if that is what you mean by responsive.

Edited by jchan94
Link to comment
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://www.oscommerce.com/forums/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

Link to comment
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://www.oscommerce.com/forums/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

Link to comment
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?

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
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://www.oscommerce.com/forums/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
Link to comment
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

Link to comment
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

Link to comment
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
Link to comment
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');
?>
Link to comment
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

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