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

[Contribution] Option Types v2

Recommended Posts

Could someone please help me with getting Option Types 2.3.1 working. I have osC 2.3.1, I've read thru the posts on this topic and it's so confusing, I still have no idea where to begin.


LadyShark

Share this post


Link to post
Share on other sites

Hi to all, I´m a student and I´m having many problems with this contribution in Oscommerce V3.0. I can´t make this work right. I have read all instructions in all versions, but it does not work. It does not matter what I do, I´ve to fail in all of them. I hope some has a final version of this or a correct tuto to share. Thanks all.

Share this post


Link to post
Share on other sites

Hi!

I am trying to get this to work. However, I am getting errors with the product_info page and the shopping_cart page.

I have the following add-ons installed:

-QPBPP

-product setup fee

-AJAX-AttributeManager-V2.8.10

-MPQ

 

I don't know how to adapt the code in the 2 pages I mentioned. I'm totally stuck!

Could someone help me please?

 

This is my product_info.php code:

<?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 (!isset($HTTP_GET_VARS['products_id'])) {
   tep_redirect(tep_href_link(FILENAME_DEFAULT));
 }
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
 $product_check_query = tep_db_query("select count(*) as total 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_check = tep_db_fetch_array($product_check_query);
 require(DIR_WS_INCLUDES . 'template_top.php');

 if ($product_check['total'] < 1) {
?>
<!-- // START Product Info Page Box -->
<script type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=280,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
<!-- // END Product Info Page Box -->
<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_PRODUCT_NOT_FOUND; ?>
 </div>
 <div style="float: right;">
   <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
 </div>
</div>
 <?php
 } else {


// BOF qpbpp 2.0  //Minimum quantity code
   $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, p.minorder, p.products_qty_blocks 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 qpbpp 2.0

   $product_info = tep_db_fetch_array($product_info_query);


$manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
   if (tep_db_num_rows($manufacturer_query)) {
	  $manufacturer = tep_db_fetch_array($manufacturer_query);
}

   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

/*** BOF qpbpp 2.0
//  if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
//    $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
//  } else {
//    $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
//  }
***/
   $pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);
   $products_price=$pf->getPriceString();
// EOF qpbpp 2.0

   if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
  $products_name = $product_info['products_name'];
   }
 //Minimum quantity code
if (tep_not_null($product_info['minorder']) && MINIMUM_ORDERS == 'true') {
  $products_name .= '<br><span class="smallText">Minimum order: ' . $product_info['minorder'] . '</span>';
   }
//End: Minimum quantity code
?>
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

<table width="100%" border="0">  <tr>
   <td height="30" valign="bottom" colspan="3">  <div align="left" class="headerNavigation"><?php echo '  ' . $breadcrumb->trail(' » '); ?></div>
</td>
 </tr>
   <tr>
  <td ><table width="100%" border="0" cellpadding="10px" >
 <tr>
   <td height="25" colspan="3"><h2><?php echo ' ' . $products_name = $product_info['products_name']; ?></h2></td>
 </tr>
 <tr>
   <td rowspan="6" valign="top">

<!-- // ---------------- START images ----------------------------->	 

 <div>
  <div>
<table width="280" align="left"> 
   <tr>
	 <td><?php
   if (tep_not_null($product_info['products_image'])) {
  $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
  if (tep_db_num_rows($pi_query) > 0) {
?>
   <div id="piGal">
  <ul>
<?php
    $pi_counter = 0;
    while ($pi = tep_db_fetch_array($pi_query)) {
	  $pi_counter++;
	  $pi_entry = '	    <li><a href="';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '#piGalimg_' . $pi_counter;
	  } else {
	    $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image'], '', 'NONSSL', false);
	  }
	  $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
	  if (tep_not_null($pi['htmlcontent'])) {
	    $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
	  }
	  $pi_entry .= '</li>';
	  echo $pi_entry;
    }
?>
  </ul>
   </div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
 maxwidth: 260,
 maxheight: 260,
 thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
 thumbcontainer: 260,
 load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
  } else {
?>
   <div align="" id="piGal">
  <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image'], '', 'NONSSL', false) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
   </div>
   <br />
<?php
  }
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
 cyclic: true
});
</script>
<?php
   }
?>
<!-- // ---------------- END images ----------------------------->


<!-- // ---------------- START review, ask question ----------------------------->
	    <div class="buttonSet">

			    <div align="center" >
				    <?php
				    if (PRODUCT_INFO_PAGE_BOX_QUESTION_BUTTON == 'True') {
						    echo '<a href="' . tep_href_link(FILENAME_ASK_A_QUESTION_POPUP) . '" target="_blank" onclick="$(\'#askaquestion\').dialog(\'open\'); return false;">';
						    echo tep_draw_button(TEXT_ASK_A_QUESTION_POPUP, 'help');
						    echo  '</a>';
					    }?>
				    <?php
				    if (PRODUCT_INFO_PAGE_BOX_REVIEW_BUTTON == 'True') {
					    echo '<a href="' . tep_href_link(FILENAME_REVIEWS_POPUP) . '" target="_blank" onclick="$(\'#reviews\').dialog(\'open\'); return false;">';
					    echo tep_draw_button(TEXT_REVIEWS_POPUP, 'comment');
					    echo  '</a>';
					    }?>
			    </div>			   
	    </div>		
	    </div>
<!-- // ---------------- END review, ask question ----------------------------->

</td>
   </tr>
 </table>
</td>
   <td colspan="2" width="100%" ><table align="left" border="0">
    <tr>
	  <td class="product-title" ><?php echo TEXT_PRICE; ?></td>
	  <td class="heads" ><?php echo $products_price; ?><?php echo ""; ?></td>
    </tr>
   </table></td>
 </tr>



<!-- // ----------------START share (facebook,pinterest,twitter,email)-------------------->
<tr>
  <td colspan="2">
 <table  align="left" border="0">

<tr>
<td class="product-title" ><?php echo TEXT_SHARE; ?></td>
   <td>
<script language="javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
<div>
<a href="http://www.facebook.com/sharer/sharer.php?u=" onclick="NewWindow(this.href,'Facebook','550','300','no');return false"><img src="images/social_bookmarks/facebook.png" height="25" width="25" alt="Share on Facebook!" border="0" /></a>  		  
<a href="http://twitter.com/share?original_referer=" onclick="NewWindow(this.href,'Twitter','450','300','no');return false" ><img src="images/social_bookmarks/twitter.png" height="25" width="25" alt="Tweet it!" border="0" /></a>  
<a href='javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());'><img src='images/social_bookmarks/PinEx.png' height="25" width="25" alt="Pinterest" border="0" /></a>  		  
<?php if (PRODUCT_INFO_PAGE_BOX_TELL_BUTTON == 'True') {
					    echo tep_draw_form('email_friend', tep_href_link(FILENAME_TELL_A_FRIEND, 'action=process&products_id=' . (int)$HTTP_GET_VARS['products_id']), 'post', '', true);
					    echo '<a href="' . tep_href_link(FILENAME_TELL_A_FRIEND_POPUP) . '" target="_blank" onclick="$(\'#tellafriend\').dialog(\'open\'); return false;">';
					    echo tep_image('images/social_bookmarks/email.png');
					    echo  '</a>';
				    } ?> 		  
</div>
 </td>
   </tr>  
   </table></td>
 </tr>
<!-- // ----------------END share (facebook,pinterest,twitter,email)-------------------->

 <tr>
   <td colspan="2"><table  align="left" border="0">
    <tr>
	  <td class="product-title" ><span style="float: left;">
	    <?php if (PRODUCT_INFO_PAGE_BOX_PRODUCT_STOCK == 'True') {
 echo TEXT_STOCK_LEVEL . '<br />';
   }
   ?>
	  </span></td>
	  <td><?php if (PRODUCT_INFO_PAGE_BOX_PRODUCT_STOCK == 'True') {
 echo tep_get_products_stock($product_info['products_id']) . '<br />';
 }
   ?></td>
    </tr>
   </table><div align="justify"><?php echo stripslashes($product_info['products_description']); ?></div></td>
 </tr>
 <tr>
   <td><!-- Attributes Start -->
  <?php
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?><div class="product-title alternative" style="padding: 5px" >
  <div class="titles"><?php echo TEXT_PRODUCT_OPTIONS; ?></div>

  <p>
 <?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
    $products_options_array = array();
    $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)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
    while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
//bof product setup fee
//		    $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

	    if ($products_options['price_prefix'] == '#') {
	    $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
		 }
	    else $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
//eof
	  }
    }
    if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
    } else {
	  $selected_attribute = false;
    }
?>	 
<br />
<table width="100%" border="0">
 <tr>
   <td colspan="2" class="options-titles"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
 </tr>
 <tr>
   <td width="40"> </td>
   <td><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
 </tr>
</table>
    <?php
  }
?>


    <?php
   }
?>
    <!-- Attributes End --> </p>
  <p> </p></div></td>
 </tr>
 <tr>
   <td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="2" >
  <tr>
    <td><table border="0" width="100%" cellspacing="5" cellpadding="2">
	  <tr>
	    <?php /* start Remove Prices and buy now and add to cart if price = 0.00 V2
		    <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>*/ ?>

<!----------------START  add to cart, min box ---------->
<td align="right">

<?php if ($product_info['products_price'] < 0.01){
//echo 'Please Phone For Information';
//echo 'Click Link Above to Buy';
} else {
 if (tep_not_null($product_info['minorder']) && MINIMUM_ORDERS == 'true') {
 echo TEXT_MINIMUM_ORDER;
}  ?>

<?php echo TEXT_ENTER_QUANTITY . tep_draw_input_field('cart_quantity', $product_info['minorder'], 'size="6"') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_separator('pixel_trans.gif', '10', '1') .
tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary');
} ?>
</td>
<!----------------END  add to cart, min box ---------->
	    <?php // EOF qpbpp ?>
	  </tr>
    </table></td>
  </tr>
   </table>


	    <div id="reviews" title="<?php
   echo 'Reviews for ';
   echo tep_get_products_name($product_info['products_id']); ?>">
		  <?php include(FILENAME_REVIEWS_POPUP); ?>
	    </div>
	    </form>

   <div id="tellafriend" title="<?php
   echo 'Tell a Friend About ';
   echo tep_get_products_name($product_info['products_id']); ?>">
  <?php include(FILENAME_TELL_A_FRIEND_POPUP); ?>
   </div></form>
   <div id="askaquestion" title="<?php
   echo 'As Us a Question About ';
   echo tep_get_products_name($product_info['products_id']); ?>">
  <?php include(FILENAME_ASK_A_QUESTION_POPUP); ?>
   </div></form>

<script type="text/javascript">
$('#reviews').dialog({
 autoOpen: false,
 width: 700,
 buttons: {
   'Close Dialog Box': function() {
  $(this).dialog('close');
   }
 }
});

</script>
<script type="text/javascript">
$('#tellafriend').dialog({
 autoOpen: false,
 width: 400,
 buttons: {
   'Close Dialog Box': function() {
  $(this).dialog('close');
   }
 }
});
</script>
<script type="text/javascript">
$('#askaquestion').dialog({
 autoOpen: false,
 width: 500,
 buttons: {
   'Close Dialog Box': function() {
  $(this).dialog('close');
   }
 }
});
</script>
<!-- // ---------------- END review, ask question ----------------------------->



 </div>

<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and reviews_status = 1");
   $reviews = tep_db_fetch_array($reviews_query);
?>

</div>

<!--</form>--></td>
   </tr>
</table></td>
 </tr>
   <tr>
  <td><?php
//added for cross -sell
   if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_xsell_products(3600); //added for Xsell
   } else {
  include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell
 }
?></td>
   </tr>
</table>

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

 

Here's my shopping_cart.php code:

<?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');
?>
<table border="0">
 <tr>
   <td height="30" valign="bottom" colspan="3">  <div align="left" class="headerNavigation"><?php echo '  ' . $breadcrumb->trail(' » '); ?></div>
 </td>
 </tr>
 </table>
<h1><?php echo HEADING_TITLE; ?></h1>
<?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
   $info_box_contents = array();

   $info_box_contents[0][] = array('align' => 'center',
							    'params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_PRODUCTS);

   $info_box_contents[0][] = array('align' => 'center',
							    'params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_QUANTITY);

   $info_box_contents[0][] = array('align' => 'center',
							    'params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_TOTAL);

   $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);
	  $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);
	  $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'] = $attributes_values['products_options_values_name'];
	  $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;
  $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
				   '  <tr>' .
				   '    <td class="productListing-data" 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-data" valign="center"><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;
	  $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'])) {
//bof product setup fee

	    if ($products[$i][$option]['price_prefix'] == '#') {
	  $products_name .= '<br>    - ' . $products[$i][$option]['products_options_name'] . ': ' . $products[$i][$option]['products_options_values_name'] . ' (' . $currencies->format($products[$i][$option]['options_values_price'], true, $order->info['currency'], $order->info['currency_value']) .')';
		  }
	  else $products_name .= '<br>    - ' . $products[$i][$option]['products_options_name'] . ': ' . $products[$i][$option]['products_options_values_name'] . '';
//eof
    }
  }
  $products_name .= '    </td>' .
				    '  </tr>' .
				    '</table>';
		  //Minimum quantity code
   if(MINIMUM_ORDERS == 'true'){
  $min_order_query = tep_db_query("select p.minorder as min_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
 while ($min_order = tep_db_fetch_array($min_order_query))  {
   if ($products[$i]['quantity'] < $min_order['min_quant'] ) {
  $products[$i]['min_quant']=$min_order['min_quant'];
   }
 }

  if ($products[$i]['quantity'] < $products[$i]['min_quant'] ) {
   $products[$i]['quantity']=$products[$i]['min_quant'];
   $cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']);
   $cart_notice = sprintf(MINIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["min_quant"]);
 }
 }
 //End Minimum quantity code
  $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
										 'text' => $products_name);

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => 'class="productListing-data" valign="center"',
										 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])  . '   ' .  tep_draw_button(IMAGE_BUTTON_UPDATE, 'refresh') . '<br>' . TEXT_OR . '<a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product') . '">' . TEXT_REMOVE . '</a>');

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => 'class="productListing-data" valign="center"',
//bof product setup fee
'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity'], $products[$i]['setup_price']) . '</b>');
//eof
   }

   new productListingBox($info_box_contents);
?>
   </table></br>
   <p><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') {
?>
   <p class="stockWarning" align="center"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></p>
<?php
  } else {
?>
   <p class="stockWarning" align="center"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></p>
<?php
  }
   }
   //Minimum quantity code
   if ($cart_notice) {
?>
  <tr>
    <td class="stockWarning" align="center"><br><?php echo $cart_notice; ?></td>
  </tr>
<?php
  }
 //End Minimum quantity code
?>
 </div>
 <div class="buttonSet">
   <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary'); ?></span>
 </div>
<?php
   $initialize_checkout_methods = $payment_modules->checkout_initialization_method();
   if (!empty($initialize_checkout_methods)) {
?>
 <p align="right" style="clear: both; padding: 15px 50px 0 0;"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></p>
<?php
  reset($initialize_checkout_methods);
  while (list(, $value) = each($initialize_checkout_methods)) {
?>
 <p align="right"><?php echo $value; ?></p>
<?php
  }
   }
?>
</div>
</form>
<?php
 } else {
?>
<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_CART_EMPTY; ?>
   <p align="right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?></p>
 </div>
</div>
<?php
 }
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

Thank you!!

Share this post


Link to post
Share on other sites

I have recently downlaoded and tried to install Options Type and at first, following the long read-me text file and replacing/adding various codes (which took all day) problems began. I then found the 'drop-on-top' directory which I uploaded in all locations, literally dropping on top in Filezilla. Didn't work, changed all the necessary connect to database and define paths (from C:/ to my website) and it has begun to work.

 

However, testing a product with a comments box works only when I go to add the item to the shopping cart... It doesn't appear. Is there a path directory file somewhere I have missed off?

Share this post


Link to post
Share on other sites

Hello, I have installed option types 2.3 when I add a product it doesn't go into the cart

 

link is http://www.marathonusa.com/catalog/product_info.php?cPath=1_17&products_id=44

 

Please help me out.

 

Thanks

 

 

However, testing a product with a comments box works only when I go to add the item to the shopping cart... It doesn't appear. Is there a path directory file somewhere I have missed off?

 

Hi All,

I have Oscommerce v2.3 and also have Options Type v2 running with the following addons...

Ajax Attribute manager V2.8

SPPC V4.2.2

 

I'm having similar issues as those above.

 

I cannot place an item with an attribute into my Cart? I get a message saying my cart is empty.

If I login and try the same it simply doesn't add the item.

 

This only happens with item that have attributes??

 

I understand the classic reasons for losing items in your cart is because of a loss of session!!

Would anybody be able to point me in the right direction and where to start looking as to which file maybe the culprits??

 

Cheers

Share this post


Link to post
Share on other sites

@@dartecha

 

I would check in application_top and also the tep_get_uprid function in includes/functions/general.php. In the past when I have had issues with items simply not adding to the cart with this addon it was an issue in application_top.


Matt

Share this post


Link to post
Share on other sites

I would check in application_top and also the tep_get_uprid function in includes/functions/general.php. In the past when I have had issues with items simply not adding to the cart with this addon it was an issue in application_top.

 

Thanks for your prompt reply :)

These are the two pieces of code from both of those files.

Can you see anything glaringly wrong with them??

 

includes/application_top.php

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+$HTTP_POST_VARS['add_quantity'], $real_ids);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

 

includes/function/general.php

 function tep_get_uprid($prid, $params) {
//BOF - Zappo - Option Types v2 - Adding Attributes
   $uprid = $prid;
   if ( (is_array($params)) && (!strstr($prid, '{')) ) {
  while (list($option, $value) = each($params)) {
    $uprid = $uprid . '{' . $option . '}' . htmlspecialchars(stripslashes(trim($value)), ENT_QUOTES);
  }
   } else {
  $uprid = htmlspecialchars(stripslashes($uprid), ENT_QUOTES);
   }
   if ( (is_array($params)) && (!strstr($prid, '{')) ) {
  while (list($option, $value) = each($params)) {
    $uprid = $uprid . '{' . $option . '}' . $value;
  }
   }
//EOF - Zappo - Option Types v2 - Adding Attributes
   return $uprid;
 }
////
// Return a product ID from a product ID with attributes
 function tep_get_prid($uprid) {
   $pieces = explode('{', $uprid);
//BOF - Zappo - Option Types v2 - Always return $pieces
  return $pieces[0];
//EOF - Za
 }

Share this post


Link to post
Share on other sites

So far with my 'shop' I have added a product without an attribute and also one with an attribute which was already created before installing the add-on and both go in the cart fine. Only when I try the product with the text box it refuses to add to the cart.

 

I'm under the impression that there is a blank or erroneous link in the page which deals with the session/cart. Any ideas where i can find this so I can try and fix it?

 

Cheers,

Share this post


Link to post
Share on other sites

@@dartecha

 

I would check in application_top and also the tep_get_uprid function in includes/functions/general.php. In the past when I have had issues with items simply not adding to the cart with this addon it was an issue in application_top.

Thanks for the advice Matt.

I found the problem, it was in application_top. I had installed another addon "add_more_than_one_unit_to_cart" and had this line in my code...

add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+$HTTP_POST_VARS['add_quantity'], $real_ids);

Once I changed it back to this...

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+1, $real_ids);

It worked fine. Don't know if this will work with the text box issue? However it might provide a platform for a fix.

 

Cheers

Share this post


Link to post
Share on other sites

Hi,

I have a issue with the setup of this addon.

I used to use Oscommerce a few years back when this was in early stages and it worked perfectly fine, now 2 years down the track i want to setup a online shop selling a few items but having a few issues.

 

MY problem is that i cant add things to the product type list and all the text is in codin words and not correct. (see attached image)

 

I have done 2 installations.

1st time, installed new os 2.3.3 in a new folder to a new DB, i edited the files and uploaded the other files. I had the problem.

 

1nd time thought i may have made a mistake, made another folder and db and installed os 2.3.3, this time just copied the write over file to my server. but exactly the same problem.

 

as i can see the date the options file was available for download was late 2011 and 2.3.3 was released late 2012 im guessing something is slightly different.

 

Can someone tell me if what to look for or if it is a know simple problem.

Thanks in advance.

Stuart

post-278962-0-47196900-1359686074_thumb.jpg

Share this post


Link to post
Share on other sites

I installed osCommerce v 2.3.1, and optionTypes 2.3.1

 

I am having the same issue. When I create a product with the text box it doesn't show up in the cart.

 

 

Also, My cart doesn't show the "remove" item link. If a customer changes her mind about an item in the cart, there is no way to remove the item.

 

Could someone help me with these two problems.... please, please. :(

Edited by LadyShark

LadyShark

Share this post


Link to post
Share on other sites

Hello. I have a few issues with this add-on, hopefully someone can help me with them. If a product with an empty option as an attribute is added to the shopping cart, then in shopping cart it shows as:

- Options: view.gif

When I click on the "eye", it opens a new window with Error 403 - Forbidden:

Forbidden

You don't have permission to access /images/upload/ on this server.

 

If I set a first option in a select box to "Please Select", then in shopping cart it shows as:

- Options: --Please Select--

Is it possible to not count "Please Select" as an attribute?

 

Also, is it possible to specify a link for the option or show a picture of a selected option?

 

Thanks in advance.

Edited by Irin

Share this post


Link to post
Share on other sites

Steven, check your email, the issue was in file includes/classes/shopping_cart.php

 

To all

 

Checking both, the uploaded file and the manual instructions about file includes/classes/shopping_cart.php, I think they are both wrong, no wonder that it doesn't work

 

Till there is an update to that package, I recommend to use the file from the old package instead and merge it manually into your new file

 

 

Thanks George. That worked, the products are loading into the shopping cart now, but I still don't have any shopping cart buttons (delete, update). What am I missing?


LadyShark

Share this post


Link to post
Share on other sites

I've had this issue (see attached image) for a while and have been looking everywhere for a solution and found two different cases here but no solutions that work for me. I've installed this contribution on an older site and it worked great! Now I'm running 2.3.3 with only a few contribs installed (Option Types 2.3.1, reCaptcha and modular front page.)

What could I have done wrong? I originally used the drop on top files but when I found this problem I restored my back up and went through the installation instructions. I've compared the files to find the only differences is the mention of zappo's option types V2 and 2.3.1.

post-317829-0-67491500-1353362500_thumb.jpg

I would describe this problem (for those who may not see the image) as a text field or text area showing up as a dropdown menu only showing CUSTOMER-INPUT instead of the input field.

 

Any help would be very appreciated!

Thanks in advance.

 

My problem was that I forgot about a 3rd configure file in includes/local/. After fixing that I ran into the empty cart issue which was solved with an old quote on page 46 on this topic.

 

multimixer, on 15 November 2011 - 07:33 AM, said:

 

Steven, check your email, the issue was in file includes/classes/shopping_cart.php

 

To all

 

Checking both, the uploaded file and the manual instructions about file includes/classes/shopping_cart.php, I think they are both wrong, no wonder that it doesn't work

 

Till there is an update to that package, I recommend to use the file from the old package instead and merge it manually into your new file

Share this post


Link to post
Share on other sites

Hello I am currently having two issues with this plugin, could somebody help please.

 

1st. In the email that goes to the customer the fields are showing as 'CUSTOMER-INPUT'?

2nd. If the customer inputs more then 32 letters/numbers the field is cut short in the admin panel so I can read the full text?

 

Edit:

 

For the 2nd issue can I just change 'orders_products_attributes > products_options' to 'varchar(100)' in the MySQL?

Edited by hazard1988

Share this post


Link to post
Share on other sites

Can someone please tell me how to format the product options? I'd like to have each product option start on a new line, and right now they need line breaks.


LadyShark

Share this post


Link to post
Share on other sites

Some of my product options are very long. How can I make the option's text to wrap at the end of lines? Where this can be set?

 

Thanks.

Share this post


Link to post
Share on other sites

I will answer my own question. To wrap text at the end of lines, you need to remove <nobr> in the code, so it looks like this:

//BOF Option Types v2.3.1 - Removed <nobr>, because Text options can be very long and added Attribute prices
    echo '<br /><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i>';
    if ($order->products[$i]['attributes'][$j]['price'] != '0') {
	  echo ' - (' . $order->products[$i]['attributes'][$j]['price_prefix'] . $currencies->display_price($order->products[$i]['attributes'][$j]['price'], tep_get_tax_rate($order->products[$i]['tax'])) . ')';
    }
    echo '</small>';

Share this post


Link to post
Share on other sites

I have a problem with product options added twice to the database when order is placed and also showing twice in confirmation email, like this:

Product Name

- Options: Option #1 (+$1.50)

- Options: Option #1 (+$1.50)

I can't figure out what can be a problem here. Any help will be appreciated.

 

Thanks.

Edited by Irin

Share this post


Link to post
Share on other sites

I have OSC 2.2rca installed with a fair amount of addons and other modifications. I have also heavily modified the options_types.php file to modifiy how some of the options behave, such as including images with radio buttons and text boxes that have been rendered uneditable, which work well within the context of the sites design. However, I find that I need to have multiple options of the a similar type, such as several versions of text boxes that each have different modifications, such as having one type of text box that can be end user edited and some that can't.

 

I am still new to PHP and so I haven't had success in my own attempts to add additional option types. I have searched the support forums and online, but I have not been able to find an answer.

 

Has any found a solution to or have an suggestions towards achieving this?

 

Thank you

Share this post


Link to post
Share on other sites

I'm trying to run this with OSC 2.3 and am not able to get it to show any of the additional options. Whether I set it a checkbox, text area or any of the others it still shows as a drop down. Can anyone help with this?

Share this post


Link to post
Share on other sites

I'm using the text type attribute for customer input. If there's an apostrophe in the text box and later the customer wants to delete it from the shopping cart, it won't delete.

 

Please help!!!!!


LadyShark

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

×