Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIB] Options as Images for MS2


equilla

Recommended Posts

  • 1 month later...
  • Replies 98
  • Created
  • Last Reply

Top Posters In This Topic

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/a/5/9/2003/2003/public_html/includes/header.php:98) in /home/a/5/9/2003/2003/public_html/includes/boxes/categories.php on line 13

 

that is the error I now get when I try to view a file.. and I don't really know where it is that

I am to start looking. I have gone through and tried to make sure I did the full and proper install.

 

but obviously I'm missing something. do you have an idea.. I used the

 

"options as images for MS2 1.5 " uploaded by andres 1

 

the site address is - http://www.secoapparel.com/index.php

Link to comment
Share on other sites

  • 1 month later...

I know this is an old thread to wake up again.. But I am curious. Does anyone know how I can edit the attribute so it does not list a maximum number per line? I would prefer them to keep going until it has to drop to the next line..... Anyone can help?

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi, I've installed this contribution really easily, and I like what I see....But for some reason the popup windows don't come up. I've got it checked in the admin,and when I click on an image it tries to do this:

run script"popupWindow('siteaddress/options_images_poup.php?oID=blah&osCid=blahblah')"
...any ideas? I guess I've not done something right somewhere, but I can't figure out what!! Edited by mistafeesh
Link to comment
Share on other sites

Me again. Bit tricky this one.... Does anyone know if there's a way to set it so that when someone clicks on the product in their shopping cart and it goes back to the product, it displays which options they've ticked?

Link to comment
Share on other sites

Installed this application... it was a breeze, but I can't seem to get an "edit" button to upload the images.

 

Where is the Edit button supposed to be? I only see an "update" button, but it doesn't do anything.

 

Did I miss an install step?

 

Thanks.

Link to comment
Share on other sites

  • 3 weeks later...

I'm sure most of you havent even noticed but admin/options_images.php does not work with multiple languages. It correctly populates the different options but fails to duplicate or add the thumbnails to other than the default language.

 

The field products_options_values_name gets populated perfectly, the languge functionality works. But, the products_options_values_thumbnail does not, its just a blank.

 

I've tried to figure out what is going on in the code but have no clue how to fix it. If any of you guru's have a moment to take a look, I'm sure its a simple fix since the products_options_values_name gets populated, so I dont understand why the thumbnail doesnt. Anyone who helps, positively rocks!

 

 

<?php
/*
 $Id: options_images.php,v 1.0 2003/08/18 

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
 $language_id = '1';
 require('includes/application_top.php');

//check that destination directory exists and is writeable
  if (is_dir(DIR_FS_CATALOG_IMAGES . 'options/')) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES . 'options/')) $messageStack->add(ERROR_OPTIONS_IMAGES_DIRECTORY_NOT_WRITEABLE, 'error');
 } else {
$messageStack->add(ERROR_OPTIONS_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
 }

 if ($HTTP_GET_VARS['action']) {
switch ($HTTP_GET_VARS['action']) {

case 'save':
	$image_source = $HTTP_POST_FILES['value_image_input']['tmp_name'];
			$filename = $HTTP_POST_FILES['value_image_input']['name'];
			$image_destination = DIR_FS_CATALOG_IMAGES . 'options/' . $filename;
			$cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);


		copy($image_source , $image_destination)	or die("unable to copy $image_source to location $image_destination");

	tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_thumbnail = '" . tep_db_input($filename) . "' where products_options_values_id = '" . tep_db_input($cID) . "' and language_id = '" .$language_id . "'");

			tep_redirect(tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $cID . '&box_id=' . $HTTP_GET_VARS['box_id']));
	break;

case 'update_enabled':
				tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_images_enabled = 'false'");
	foreach ($HTTP_POST_VARS ['option_select'] as $options_selected){
	tep_db_query("update " . TABLE_PRODUCTS_OPTIONS .  " set products_options_images_enabled = 'true' where products_options_id = '" . $options_selected . "'"); 
			}

	break;

  }
 }


?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADER_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
				<tr><td class="smalltext">Select an option category to edit:  
<?php 
  if (isset($HTTP_POST_VARS['box_select'])) $options_id = $HTTP_POST_VARS['box_select'];
	else if (isset($HTTP_GET_VARS['box_id']))$options_id = $HTTP_GET_VARS['box_id'];
		else if (isset($HTTP_GET_VARS['cID'])){
		$options_query = tep_db_query("select products_options_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id='" . $HTTP_GET_VARS['cID'] . "'");
		$options = tep_db_fetch_array ($options_query);
		$options_id = $options['products_options_id'];
		}
	else $options_id = 1;	

  $options_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id='" . $language_id . "'");
		$i=0;
  while ($options = tep_db_fetch_array ($options_query)){
		  $values[$i]['id']= $options['products_options_id'];
		  $values[$i]['text']= $options['products_options_name'];
		  $i++;
		}
		 echo tep_draw_form('box_selection', FILENAME_OPTIONS_IMAGES,'');
   echo tep_draw_pull_down_menu('box_select', $values, $options_id, 'onChange="this.form.submit();"');
		 echo '</form>';

?>
	  </td>

					</tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?></td>
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE; ?></td>
							<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE_NAME; ?></td>
		  </tr>
<?php

 $query1 = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_id . "'" );
//First find all the products options values that belong to the selected product option
 while ($result1 = tep_db_fetch_array($query1)) {
  $products_options_values_id = $result1['products_options_values_id'];

	//Now pull their details from the database
  $query2 = tep_db_query ("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $products_options_values_id . "' and language_id = '" .$language_id . "'");
	while ($result2 = tep_db_fetch_array($query2)) {
	  $products_options_values_name = $result2['products_options_values_name']; 
	  $products_options_values_thumbnail = $result2['products_options_values_thumbnail'];


  if ($HTTP_GET_VARS['cID'] == $products_options_values_id){
  $selected_value['name'] = $products_options_values_name;
  $selected_value['image'] = $products_options_values_thumbnail;
  $selected_value['id'] = $products_options_values_id;
  } 

if ( (isset($selected_value['id'])) && ($products_options_values_id == $selected_value['id']) ) {
  echo '				  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id . '&action=edit') . '\'">' . "\n";
} else {
  echo '				  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id ) . '\'">' . "\n";
}

?>
			<td class="dataTableContent"><?php echo $products_options_values_name ?></td>
			<td class="dataTableContent" align="center"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . '/options/' . $products_options_values_thumbnail, $products_options_values_name, '50', '50') ?></td>
			<td class="dataTableContent"><?php echo $products_options_values_thumbnail ?></td>
	  </tr>
<?php
}
 }
?>

 </table></td>
<?php	
 $heading = array();
 $contents = array();
 switch ($HTTP_GET_VARS['action']) {
case 'edit':
  $heading[] = array('text' => '<b>'.$selected_value['name'].'</b>');
  $contents = array('form' => tep_draw_form('value_image_input', FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id'] . '&box_id=' . $options_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
		$contents[] = array('text' => '<br>' . TEXT_SELECT_FILE . '<br>' . tep_draw_file_field('value_image_input'));
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id']) . '&box_id=' . $options_id .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
		break;


default:
   if (isset ($selected_value['id'])){
	$heading[] = array('text' => '<b>' . $selected_value['name'] . '</b>');
	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id'] . '&box_id=' . $box_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id']. '&box_id=' . $box_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');

  break;
  }
}
 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo '			<td width="25%" valign="top" align="center">' . "\n";

$box = new box;
echo $box->infoBox($heading, $contents);

echo '			</td>' . "\n";

 }

?>
	  </tr>

<tr><td>

<?php
 echo tep_draw_form('update_enabled_options', FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id'] . '&box_id=' . $options_id . '&action=update_enabled', 'post');  
 echo '<tr><td class="smalltext">You currently have Options as Images enabled for the following options categories:</td></tr>';
 $options_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $language_id . "'");

echo '<tr><td class="smalltext">';
while ($options = tep_db_fetch_array ($options_query)){
  if ($options['products_options_images_enabled'] == 'true') $checked = true;
	else $checked = false;
  echo $options['products_options_name'] . tep_draw_selection_field('option_select[' . $options['products_options_id'] . ']', 'checkbox', $options['products_options_id'], $checked) . '  |  ';
}

 echo tep_image_submit('button_update.gif', IMAGE_UPDATE);
echo '</td></tr>';


?>


	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

  • 2 weeks later...

great contrib - anyway to order the options?

 

Example:

Product -

Trousers

 

Attributes -

long

short <-- How do I make this display first on the list

medium

SolarFrenzy

Solar powered gadgets at down to earth prices.

 

CheekyNaughty

Promoting British Design

Link to comment
Share on other sites

Hello together,

 

sorry, but my english is not so good....

 

I installed the contrib but it doesn't work. I get no Error-Warnings or something like this. But under the point "Catalog" --> "Option as Image" I can't do nothing. The point "Select an option category to edit: " is empty and when i click on the button "update" nothing happens.

 

What do I wrong? Where is the mistake?

 

Tobi

Link to comment
Share on other sites

  • 2 weeks later...

Hi all,

 

I installed the mod Options as Images for MS2 1.5 by andes1. Everything seemed to upload fine but unfortunately when it is set as true it never shows up in my product_info.php page. When I set it to false my attributes with drop down appears. Any ideas to what the issue is?

 

Here is my productinfo page in case someone can help:

-------------------------------------------------------------------

 

require('includes/application_top.php');

 

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);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php // Randelia Custom_META_Tags_Per_Item. Includes TITLE!

echo ShowMETA('product_info', $products_id, $languages_id); ?>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

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

function popupWindow(url) {

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le

ft=150')

 

}

//--></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="1" cellpadding="0">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php

if ($product_check['total'] < 1) {

?>

<tr>

<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

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

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

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

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

} else {

// BOF: More Pics 6 Added: , p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

// EOF: More Pics 6

 

 

$product_info = tep_db_fetch_array($product_info_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 . "'");

 

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']));

}

 

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'];

}

 

// BOF: More Pics 6

 

$mopics_image_width = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_WIDTH:'');

$mopics_image_height = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_HEIGHT:'');

 

if (MOPICS_SHOW_ALL_ON_PRODUCT_INFO=='true') {

 

$mopics_output = '';

$mo_row = 1;

$mo_col = 1;

 

$mopics_images = array();

if (tep_not_null($product_info['products_image'])) { $mopics_images[] = $product_info['products_image']; }

for ( $mo_item=1; $mo_item<7; $mo_item++ ) {

if (tep_not_null($product_info['products_subimage'.$mo_item])) { $mopics_images[] = $product_info['products_subimage'.$mo_item]; }

}

$mopics_count = sizeof($mopics_images);

 

if (tep_not_null($product_info['products_image'])) { $mopics_output .= '<table border="0" cellspacing="0" cellpadding="6" align="'.MOPICS_TABLE_ALIGNMENT.'">'."\n"; }

 

for ( $mo_item=0; $mo_item<$mopics_count; $mo_item++ ) {

 

if ($mo_row<(MOPICS_NUMBER_OF_ROWS+1)) {

if ($mo_col==1) {$mopics_output.='<tr>';}

 

$mopics_output .= ' <td align="center" class="smallText"><script language="javascript"><!--

document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.$mo_item).'\\\')">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], addslashes($product_info['products_name']), $mopics_image_width, $mopics_image_height, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');

//--></script><noscript>

<a href="' . tep_href_link(DIR_WS_IMAGES . $mopics_images[$mo_item]) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], $product_info['products_name'], $mopics_image_width, $mopics_image_height, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>

</noscript></td>'."\n";

 

if ($mo_col==MOPICS_NUMBER_OF_COLS) { $mo_col=1; $mo_row++; $mopics_output.='</tr>'."\n"; } else { $mo_col++; }

}

 

}

 

if ($mo_col!=1){ while (($mo_col++)<(MOPICS_NUMBER_OF_COLS+1)) { $mopics_output.='<td> </td>'."\n"; } }

 

if (tep_not_null($product_info['products_image'])) { $mopics_output .= '</table>'."\n"; }

 

}

 

// EOF: More Pics 6

 

?>

 

 

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

<td class="pageHeading" align="left" valign="top">

 

 

 

<?php if ($product_info['products_price'] == 0)

{ echo '<a href=contact_us.php>' . TEXT_CALL_FOR_PRICE . '</a>'; }else{ echo $products_price;} ?></td></td>

 

 

 

 

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main">

<?php /* BOF: More Pics 6

if (tep_not_null($product_info['products_image'])) {

?>

<table border="0" cellspacing="0" cellpadding="2" align="right">

<tr>

<td align="center" class="smallText">

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

document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="1" vspace="1"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="1" vspace="1"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

</td>

</tr>

</table>

<?php

} */

if (MOPICS_TABLE_LOCATION=='above') {

echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td align="center" class="smallText">'.$mopics_output.'</td>

</tr>

</table>

 <br>'."\n";

} else if (MOPICS_TABLE_LOCATION=='sides') {

echo $mopics_output;

}

// EOF: More Pics 6

?>

<p><?php echo stripslashes($product_info['products_description']); ?></p>

<?php

if (OPTIONS_AS_IMAGES_ENABLED == 'false'){

$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) {

?>

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>

</tr>

<?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, 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)$products_options_name['products_options_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");

 

 

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') {

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

}

?>

<tr>

<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

</tr>

<?php

}

?>

</table>

<?php

}

//Options as Images. Add the curly bracket as shown on the next line

 

 

//Options as Images. This whole php clause needs to be added

if (OPTIONS_AS_IMAGES_ENABLED == 'true') include ('options_images.php');

}

 

// BOF: More Pics 6

if (MOPICS_TABLE_LOCATION=='below') {

echo ' <br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td align="center" class="smallText">'.$mopics_output.'</td>

</tr>

</table>'."\n";

}

// EOF: More Pics 6

?>

</td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

$reviews = tep_db_fetch_array($reviews_query);

if ($reviews['count'] > 0) {

?>

<tr>

<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if (tep_not_null($product_info['products_url'])) {

?>

<tr>

<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {

?>

<tr>

<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>

</tr>

<?php

} else {

?>

<tr>

<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>

</tr>

<?php

}

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

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

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>

 

 

 

<td class="main" align="right"><?php if ($product_info['products_price'] == 0){ }else{ echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); } ?></td>

 

 

 

 

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

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td>

<?php

if ((USE_CACHE == 'true') && empty($SID)) {

echo tep_cache_also_purchased(3600);

} else {

include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);

}

}

?>

</td>

</tr>

</table></form></td>

 

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

 

<?php // Randelia Custom_META_Tags_Per_Item. Includes TITLE!

echo ShowMETA('product_review', $products_id, $languages_id); ?>

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php');

 

 

?>

Link to comment
Share on other sites

Ok Got it to work.

 

However, it only allows me to check one radio button at a time. Is there a way to get it to enable me to check several options? For example lets say I am selling a dresser and I want to have color option, drawer pull option, and other upgrades.

 

THank you,

Link to comment
Share on other sites

  • 4 weeks later...

I've got the contribution installed and it seems to work great except that I cannot see any of the images I upload. They do upload to the server, but in admin under the Attributes Images Manager the image file name appears as .../images/options/ with no filename attached. It should be something like: ../images/options/447.jpg . I have the permissions to the /images/options/ folder set to 777. Does anyone know what I'm doing wrong?

 

Thank you!

Karim

Link to comment
Share on other sites

I'm sure most of you havent even noticed but admin/options_images.php does not work with multiple languages. It correctly populates the different options but fails to duplicate or add the thumbnails to other than the default language.

 

The field products_options_values_name gets populated perfectly, the languge functionality works. But, the products_options_values_thumbnail does not, its just a blank.

 

I've tried to figure out what is going on in the code but have no clue how to fix it. If any of you guru's have a moment to take a look, I'm sure its a simple fix since the products_options_values_name gets populated, so I dont understand why the thumbnail doesnt. Anyone who helps, positively rocks!

<?php
/*
 $Id: options_images.php,v 1.0 2003/08/18 

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
 $language_id = '1';
 require('includes/application_top.php');

//check that destination directory exists and is writeable
  if (is_dir(DIR_FS_CATALOG_IMAGES . 'options/')) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES . 'options/')) $messageStack->add(ERROR_OPTIONS_IMAGES_DIRECTORY_NOT_WRITEABLE, 'error');
 } else {
$messageStack->add(ERROR_OPTIONS_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
 }

 if ($HTTP_GET_VARS['action']) {
switch ($HTTP_GET_VARS['action']) {

case 'save':
	$image_source = $HTTP_POST_FILES['value_image_input']['tmp_name'];
			$filename = $HTTP_POST_FILES['value_image_input']['name'];
			$image_destination = DIR_FS_CATALOG_IMAGES . 'options/' . $filename;
			$cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);


		copy($image_source , $image_destination)	or die("unable to copy $image_source to location $image_destination");

	tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_thumbnail = '" . tep_db_input($filename) . "' where products_options_values_id = '" . tep_db_input($cID) . "' and language_id = '" .$language_id . "'");

			tep_redirect(tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $cID . '&box_id=' . $HTTP_GET_VARS['box_id']));
	break;

case 'update_enabled':
				tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_images_enabled = 'false'");
	foreach ($HTTP_POST_VARS ['option_select'] as $options_selected){
	tep_db_query("update " . TABLE_PRODUCTS_OPTIONS .  " set products_options_images_enabled = 'true' where products_options_id = '" . $options_selected . "'"); 
			}

	break;

  }
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADER_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
				<tr><td class="smalltext">Select an option category to edit:  
<?php 
  if (isset($HTTP_POST_VARS['box_select'])) $options_id = $HTTP_POST_VARS['box_select'];
	else if (isset($HTTP_GET_VARS['box_id']))$options_id = $HTTP_GET_VARS['box_id'];
		else if (isset($HTTP_GET_VARS['cID'])){
		$options_query = tep_db_query("select products_options_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id='" . $HTTP_GET_VARS['cID'] . "'");
		$options = tep_db_fetch_array ($options_query);
		$options_id = $options['products_options_id'];
		}
	else $options_id = 1;	

  $options_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id='" . $language_id . "'");
		$i=0;
  while ($options = tep_db_fetch_array ($options_query)){
		  $values[$i]['id']= $options['products_options_id'];
		  $values[$i]['text']= $options['products_options_name'];
		  $i++;
		}
		 echo tep_draw_form('box_selection', FILENAME_OPTIONS_IMAGES,'');
   echo tep_draw_pull_down_menu('box_select', $values, $options_id, 'onChange="this.form.submit();"');
		 echo '</form>';

?>
	  </td>

					</tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?></td>
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE; ?></td>
							<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_IMAGE_NAME; ?></td>
		  </tr>
<?php

 $query1 = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_id . "'" );
//First find all the products options values that belong to the selected product option
 while ($result1 = tep_db_fetch_array($query1)) {
  $products_options_values_id = $result1['products_options_values_id'];

	//Now pull their details from the database
  $query2 = tep_db_query ("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $products_options_values_id . "' and language_id = '" .$language_id . "'");
	while ($result2 = tep_db_fetch_array($query2)) {
	  $products_options_values_name = $result2['products_options_values_name']; 
	  $products_options_values_thumbnail = $result2['products_options_values_thumbnail'];


  if ($HTTP_GET_VARS['cID'] == $products_options_values_id){
  $selected_value['name'] = $products_options_values_name;
  $selected_value['image'] = $products_options_values_thumbnail;
  $selected_value['id'] = $products_options_values_id;
  } 

if ( (isset($selected_value['id'])) && ($products_options_values_id == $selected_value['id']) ) {
  echo '				  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id . '&action=edit') . '\'">' . "\n";
} else {
  echo '				  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $products_options_values_id . '&box_id=' . $options_id ) . '\'">' . "\n";
}

?>
			<td class="dataTableContent"><?php echo $products_options_values_name ?></td>
			<td class="dataTableContent" align="center"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . '/options/' . $products_options_values_thumbnail, $products_options_values_name, '50', '50') ?></td>
			<td class="dataTableContent"><?php echo $products_options_values_thumbnail ?></td>
	  </tr>
<?php
}
 }
?>

 </table></td>
<?php	
 $heading = array();
 $contents = array();
 switch ($HTTP_GET_VARS['action']) {
case 'edit':
  $heading[] = array('text' => '<b>'.$selected_value['name'].'</b>');
  $contents = array('form' => tep_draw_form('value_image_input', FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id'] . '&box_id=' . $options_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
		$contents[] = array('text' => '<br>' . TEXT_SELECT_FILE . '<br>' . tep_draw_file_field('value_image_input'));
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id']) . '&box_id=' . $options_id .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
		break;
default:
   if (isset ($selected_value['id'])){
	$heading[] = array('text' => '<b>' . $selected_value['name'] . '</b>');
	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id'] . '&box_id=' . $box_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id']. '&box_id=' . $box_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');

  break;
  }
}
 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo '			<td width="25%" valign="top" align="center">' . "\n";

$box = new box;
echo $box->infoBox($heading, $contents);

echo '			</td>' . "\n";

 }

?>
	  </tr>

<tr><td>

<?php
 echo tep_draw_form('update_enabled_options', FILENAME_OPTIONS_IMAGES, '&cID=' . $selected_value['id'] . '&box_id=' . $options_id . '&action=update_enabled', 'post');  
 echo '<tr><td class="smalltext">You currently have Options as Images enabled for the following options categories:</td></tr>';
 $options_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $language_id . "'");

echo '<tr><td class="smalltext">';
while ($options = tep_db_fetch_array ($options_query)){
  if ($options['products_options_images_enabled'] == 'true') $checked = true;
	else $checked = false;
  echo $options['products_options_name'] . tep_draw_selection_field('option_select[' . $options['products_options_id'] . ']', 'checkbox', $options['products_options_id'], $checked) . '  |  ';
}

 echo tep_image_submit('button_update.gif', IMAGE_UPDATE);
echo '</td></tr>';


?>


	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

I need multi-language support as well. Can anyone help?

 

Karim

Link to comment
Share on other sites

  • 2 months later...
I need multi-language support as well. Can anyone help?

 

Karim

 

Have you tried to replace

 

$language_id = '1';

 

with

 

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

 

 

regards

 

Sara

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

I'm trying to install "options as images", it goes well: http://www.bedruktkado.nl/product_info.php...amp;language=NL.

BUT as you see, all the options are dropdowns.

"bestand / ontwerp" must be a file upload

and

"tekst" must be a textfield

 

I've tried to install the add of Beddo: here.

But I don't get it work...

It looks like this

So.. here the "options as images" are gone..

 

I don't understand....

 

Maybe someone can give me some advice?

I'm sure options as images and option type must work together, but I don't know what I'm doing wrong!

 

I'll hope someone will help me!

 

Greetz

Marleen

Link to comment
Share on other sites

  • 1 year later...

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