Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi Attributes


Guest

Recommended Posts

Posted

Hi,

 

I woul like to set my attributes like this exemple:

http://www.lentilles-moins-cheres.com/cont...1-day-acuvue-30

 

- Product

-- id 1

--- attribute1

--- attribute 2

--- attribute 3

--- quantity

 

-- id 2

--- attribute1

--- attribute 2

--- attribute 3

--- quantity

 

How is it possible to do exactly the same attribute setting ?

 

Thanks a lot

 

Sorry for my english

Posted

hmmm...

1- open catalog/product_info.php

2- find:

<table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><h2><?php echo TEXT_PRODUCT_OPTIONS; ?></h2></td>
		</tr>

 

Change to :

<table border="0" cellspacing="0" cellpadding="2" bordercolor="#FFFFFF" bgcolor="#BCCCDF">
		<tr>
		  <td class="main" colspan="2"><h2><?php echo TEXT_PRODUCT_OPTIONS; ?></h2></td>
		</tr>

 

3- find:

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

 

Change to :

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

 

Note the change here: remove the <tr></tr> tags and one internal <td></td> tag.

This will merge your SELECT control options in a single Row.

Posted

Ok for this ,

 

Can i put a second row with the same attributes.?

 

Then, when i add to my cart, i would have 2 products in my cart. 1 product for each row off attributes.

 

Thankx for all

Posted
Can i put a second row with the same attributes.?

Then, when i add to my cart, i would have 2 products in my cart. 1 product for each row off attributes.

 

No its not going to be like this. You have to add another product with the same or different attributes.

n f u r referring to the site u mentioned sorry i dont know 'bout it. u do researh n f anybody knows, wanna share will be great.

Posted
Can i put a second row with the same attributes.?

Then, when i add to my cart, i would have 2 products in my cart. 1 product for each row off attributes.

 

No its not going to be like this. You have to add another product with the same or different attributes.

n f u r referring to the site u mentioned sorry i dont know 'bout it. u do researh n f anybody knows, wanna share will be great.

Posted

the site you linked us to cleverly displays 2 products (probably same subcategory or bundled somehow) as a "product listing" and allows immediate input of quantity along with attribute selection.

http://www.oscommerce.com/community/contri...ting+attributes

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

this code give me each QTy for each option of each attributes for one product in an table

 

product_info.php

					  <!-- DEBUT DES OPTIONS -->
				  <?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) {
					?>
	  <table border="0" cellspacing="0" cellpadding="2">
			 <tr>
				  <td class="main" align="center"><?php echo TEXT_PRODUCT_OPTION; ?></td>
				  <td class="main" align="center"><?php /*  uncomment if you want to show the model number echo TEXT_PRODUCT_MODEL; */ ?></td>
				  <td class="main" align="center"><?php echo TEXT_PRODUCT_PRICE; ?></td>
				  <td class="main" align="center"><?php echo TEXT_PRODUCT_QUANTITY; ?></td>
			 </tr>
						<?php
							 $X=0;
						  $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.005') {
								$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'] == '+') {
							   $price_with_attribute = ($product_info['products_price'] + $products_options['options_values_price']);
						} else {
						   $price_with_attribute = ($product_info['products_price'] - $products_options['options_values_price']);
						   }

						  ?>
			<tr>
	 			   <td class="main" align="center">
						<?php echo $products_options['products_options_values_name'];
							  echo tep_draw_hidden_field('a[]', $products_options['products_options_values_id']);
							  echo tep_draw_hidden_field('b',$products_options_name['products_options_id']); ?>
	 				</td>

					<td class="main" align="center">
						<?php /* uncomment if you want to show the model number
							  echo $product_info['products_model']; */
						 ?>
					</td>
					  <td class="main" align="center"><?php echo $currencies->display_price($price_with_attribute, tep_get_tax_rate($product_info['products_tax_class_id'])); ?></td>
					  <td class="main" align="center"><?php echo tep_draw_input_field('quantity[]',$value = '0',"size=2");?></td>
			  </tr>



				 <?php	
					  $x++;
						}

						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;
						}
					?>
<!-- start groupe of attributes
					  <td class="main"><?php	echo $products_options_name['products_options_name'] . ':'; ?>
									   <?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . $products_options_name['products_options_comment'];  ?>
				   	</td>
					 <td class="main" align="center"><?php echo tep_draw_input_field('quantity[]',$value = '0',"size=2");?></td> 
end groupe of attributes		--> 
<?php
  }
?>
	</table>
<?php
}
?>
				  </td></tr>							  
				</table>	<!-- FIN DES OPTIONS -->

 

application_top.php

							  // customer adds multiple products from the product_info page
  case 'add_mult' : if (is_array($HTTP_POST_VARS['a'])){
			  reset($HTTP_POST_VARS['quantity']);
		reset($HTTP_POST_VARS['a']);

		$x=0;
		if (is_array($HTTP_POST_VARS['a'])){
		 foreach(($HTTP_POST_VARS['a']) as $key => $value){
		   $c = array((int)$HTTP_POST_VARS['b'] => (int)$value);		

		   if (is_array($HTTP_POST_VARS['quantity'])){
			  $qty = (int)$HTTP_POST_VARS['quantity'][$x];


			  $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], ($c)))+($qty),($c));
			  $x++;

			}
		 } 
		}
		 } else {
		 if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
							$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
						  }
		}
		tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

					 break;

 

what do i have to do, to it give me the QTy of groupe of attributes.

 

Thanks for help :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...