Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

Hi ! I'm a newbee here. Sorry ! :blush:

 

I have a problem with the contribution Option Types v2.

 

When I add a first product with options to the shopping cart, any problem (price is just). But when I add the second product with different options in the shopping cart it puts me (for the second product) the options of the first one and those of the second, but with the good price !!!

 

And when I add the third product, it adds me the options and of the first one and the second, and there also with the good price !

 

On the other hand, on the checkout confirmation, there's any problem ! The first two articles have the good options.

 

Has anybody got an idea ? The solution is maybe very simple, but I don't find it...

 

THX ALL.

Link to comment
Share on other sites

If you add a product with text attributes, then go back and try to add the same product with different text attributes......does it work? Cause mine gives the product a quantity of 2 in the shopping cart with only the last text attributes added. Let me know if yours works!! Thanks,

 

I just checked and I have no problem with this. Is your issue connected somehow with SPPC and OTv2? Do you have a modified store? Did you try on a vanilla install to see how it works?

Link to comment
Share on other sites

hi,

 

I have downloaded this contribution after seeing it on another site because i need for the customer to enter characters over 3 or 4 lines that can be engraved onto a product.

 

I am lost with the install file 'option types v2 installtion instruction.txt' because there are characters in there that i have no idea what they are or are refering too...

 

\f1\fs24 \
\

\f0\fs22         \cf2 echo \cf3 '<br><nobr><small> <i> - ' \cf0 . \cf4 $order\cf0 ->products[\cf4 $i\cf0 ][\cf3 'attributes'\cf0 ][\cf4 $j\cf0 ][\cf3 'option'\cf0 ] . \cf3 ': ' \cf0 . \cf4 $order\cf0 ->products[\cf4 $i\cf0 ][\cf3 'attributes'\cf0 ][\cf4 $j\cf0 ][\cf3 'value'\cf0 ] . \cf3 '</i></small></nobr>'\cf0 ;\
\

 

on the 1st part of the find this and replace with... i have no idea what all the /cf3 etc are as they are not proper php coding

 

can anyone help or maybe could supply proper install instructions??

 

many thanks - Mark

Link to comment
Share on other sites

  • 3 weeks later...

Hi

 

Ive installed this contribution but when I upload a file nothing happens, it pauses for a few seconds as if uploading then just returns to the product page without adding anything to the cart or uploading the file. This also happens on all products in the store even those without attributes added, it won't add anything to the cart.

 

Has it something to do with the line:

 

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"'); ?>

Link to comment
Share on other sites

hey

when i go to edit product i get this error

1054 - Unknown column 'products_options_order' in 'order clause'

select * from products_options where language_id='1' order by products_options_order

 

i read a few pages back that its cause i didnt run the sql file.. so i try and import it and i get this error

-- same as the person befor.

 

INSERT INTO configuration VALUES ('', 'Use Progress Bars?', 'OPTIONS_TYPE_PROGRESS', 'Both', 'Set to use the Progress bar for Text Options
None = No Progress Bars
Text = Textfields only
TextArea = TextAreas only
Both = Both Text Fields and Areas', last_insert_id(), '4', now(), now(), NULL, 'tep_cfg_select_option(array(\'None\', \'Text\', \'TextArea\', \'Both\'),'), ('', 'Upload File Prefix', 'OPTIONS_TYPE_FILEPREFIX', 'Database', 'The prefix that is used to generate unique filenames for uploads.
Database = insert id from database
Date = the upload Date
Time = the upload Time
DateTime = Upload Date and Time', last_insert_id(), '5', now(), now(), NULL, 'tep_cfg_select_option(array(\'Database\', \'Date\', \'Time\', \'DateTime\'),'), ('', 'Delete Uploads older than', 'OPTIONS_TYPE_PURGETIME', '-2 weeks', 'Uploads in the Temporary folder are automatically deleted when older than this setting.
Us[...] 

MySQL said: 

#1062 - Duplicate entry '0' for key 'PRIMARY' 

 

then i edited the sql file starting at number 213 as per waht you said to start with the higest numder...

 

then i tryed to import the file again ... same issue. as i was typing this and went to try and import again i unchecked "Do not use AUTO_INCREMENT for zero values"

and it seems to of taken the file and the error seems to be gone...lol

yay! thought id share that info for anyone else

Link to comment
Share on other sites

Hello people

 

A time ago I posted a solution to set products options to be calculated per item or per unit.

 

Example:

1) Per unit (product price:5 + option price:1 = 6 x quantity: 500 = total: 3000)

2) Per item (product price:5 x quantity: 500 = 2500 + option price:1 = total:2501)

 

The post is here

 

It's all working fine, the only issue was, that the whole thing was not working with the "Order Editor" addon. I don't know if anyone is interested or even using this solution, anyway, here is the way to have this working with order editor too. Not to mention that you need to have order editor installed, I have the version by surfalot (of 18 11 09)

 

Modification to enable "Order Editor" to calculate products options per item or per unit.

Involved Files are

 

checkout_process.php

 

admin/edit_orders_add_product.php

admin/edit_orders_ajax.php

admin/edit_orders.php

 

admin/order_editor/cart.php

admin/order_editor/javascript.php

admin/order_editor/order.php

 

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

Add one more field to the database

 

If you did already my previous mod, then import this sql file to your DB via phpMyAdmin

# osCommerce, Open Source E-Commerce Solutions
# http://www.oscommerce.com
#
# Database Changes for Option Types v2
#
# created by multimixer for http://multimixer.gr
#
# Released under the GNU General Public License


# Add choice for options price to be calculated per item (once) or per unit
# Upgrade to version 1 For order editor

# Add calculation way to the orders_products_attributes table
ALTER TABLE orders_products_attributes
 ADD options_price_calc INT( 1 ) DEFAULT '0' NOT NULL;

 

If you did not, then you can use this, it contains all necessary DB changes

# osCommerce, Open Source E-Commerce Solutions
# http://www.oscommerce.com
#
# Database Changes for Option Types v2
#
# created by multimixer for http://multimixer.gr
#
# Released under the GNU General Public License


# Add choice for options price to be calculated per item (once) or per unit

# Add calculation way and name to the products_options table
ALTER TABLE products_options
 ADD products_options_price_calc INT( 1 ) DEFAULT '0' NOT NULL ,
 ADD products_options_per_name VARCHAR( 32 ) DEFAULT 'per unit'  NULL;

# Add calculation way to the products_attributes table
ALTER TABLE products_attributes
 ADD options_price_calc INT( 1 ) DEFAULT '0' NOT NULL;

# Add calculation way and name to the orders_products_attributes table
ALTER TABLE orders_products_attributes
 ADD options_price_calc INT( 1 ) DEFAULT '0' NOT NULL,
 ADD options_per_name VARCHAR( 32 ) DEFAULT 'per unit'  NULL;

 

From here on just "upgrade"instructions to my previous post, you need to do the changes there first. if you did, go on

 

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

1) File Checkout_process.php

 

Find

          
// set price per unit / per item multimixer 15 4 10	added , popt.products_options_per_name	
         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, popt.products_options_per_name 

 

Replace with

			
// set price per unit / per item multimixer 15 4 10	added , popt.products_options_per_name, popt.products_options_price_calc (20 8 10)	
         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, popt.products_options_per_name, popt.products_options_price_calc 

 

Find

			
// set price per unit / per item multimixer 15 4 10	added , popt.products_options_per_name	
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, popt.products_options_per_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

 

Replace with

// set price per unit / per item multimixer 15 4 10	added , popt.products_options_per_name, popt.products_options_price_calc (20 8 10)	
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, popt.products_options_per_name, popt.products_options_price_calc from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

 

Find

                                
'options_per_name' => $attributes_values['products_options_per_name']);
// set price per unit / per item multimixer 15 4 10 ( 2 line above added / second on 20 8 10 For Order Editor)

 

Replace with

                               
'options_per_name' => $attributes_values['products_options_per_name'],
'options_price_calc' => $attributes_values['products_options_price_calc']);
// set price per unit / per item multimixer 15 4 10 ( 2 line above added / second on 20 8 10 For Order Editor)

 

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

2) File admin/edit_orders_add_product.php

 

Find

			
				if ($opt_price_prefix == '-')
				{$AddedOptionsPrice -= $opt_options_values_price;}
				else //default to positive
				{$AddedOptionsPrice += $opt_options_values_price;}

 

Replace with

// BOF set price per unit / per item multimixer 20 8 10
			if ($opt_options_price_calc == '1') { // case per item
				if ($opt_price_prefix == '-')
				{$AddedOptionsPrice -= $opt_options_values_price / ($_POST['add_product_quantity']) ;}
				else //default to positive
				{$AddedOptionsPrice += $opt_options_values_price / ($_POST['add_product_quantity']) ;}
			} else { // default per unit
				if ($opt_price_prefix == '-')
				{$AddedOptionsPrice -= $opt_options_values_price;}
				else //default to positive
				{$AddedOptionsPrice += $opt_options_values_price;}
			}
// EOF set price per unit / per item multimixer 20 8 10

 

Find

            
$option_values_names[$option_value_id] = $opt_products_options_values_name;

 

Add After

			
$options_per_name[$option_id] = $opt_products_options_per_name; // set price per unit / per item multimixer 20 8 10
$options_price_calc[$option_id] = $opt_products_options_price_calc; // set price per unit / per item multimixer 20 8 10

 

Find

            
'price_prefix' => tep_db_prepare_input($option_value_details[$option_id][$option_value_id]['price_prefix']));

 

Replace with

            
'price_prefix' => tep_db_prepare_input($option_value_details[$option_id][$option_value_id]['price_prefix']),
'options_per_name' => tep_db_prepare_input($options_per_name[$option_id]),
'options_price_calc' => tep_db_prepare_input($options_price_calc[$option_id]),
// set price per unit / per item multimixer 20 8 10 2 lines above added
);

 

Find

      
$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)$add_product_products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

 

Replace with

	  
// set price per unit / per item multimixer 20 8 10 added , popt.products_options_per_name  
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_per_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$add_product_products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

 

Find

            
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->format($products_options['options_values_price'], true, $order->info['currency'], $order->info['currency_value']) .')';

 

Replace with

            
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->format($products_options['options_values_price'], true, $order->info['currency'], $order->info['currency_value']) . ' ' . $products_options_name['products_options_per_name'] .')'; // set price per unit / per item multimixer 20 8 10 $products_options_name['products_options_per_name']

 

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

3) File admin/edit_orders_ajax.php

 

Find

	  
tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET " . $_GET['field'] . " = '" . oe_iconv($_GET['new_value']) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'");

 

Add after

// BOF set price per unit / per item multimixer 20 8 10
  if (isset($_GET['final_price'])) {
	tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET final_price = '" . tep_db_input(tep_db_prepare_input($_GET['final_price'])) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'");
  }
// EOF set price per unit / per item multimixer 20 8 10

 

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

4) File admin/edit_orders.php

 

Find

			// Update Any Attributes
			if(isset($products_details['attributes'])) { 
			  foreach($products_details['attributes'] as $orders_products_attributes_id => $attributes_details) {
				$Query = "UPDATE " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set
					products_options = '" . $attributes_details["option"] . "',
					products_options_values = '" . $attributes_details["value"] . "',
					options_values_price ='" . $attributes_details["price"] . "',
					price_prefix ='" . $attributes_details["prefix"] . "'
					where orders_products_attributes_id = '$orders_products_attributes_id';";
					tep_db_query($Query);
				}//end of foreach($products_details["attributes"]
			}// end of if(isset($products_details[attributes]))

 

Replace with

			// Update Any Attributes
			// set price per unit / per item multimixer 20 8 10	added options_per_name ='" . $attributes_details['pername'] . "', options_price_calc ='" . $attributes_details['calcway'] . "',
			if(isset($products_details['attributes'])) { 
			  foreach($products_details['attributes'] as $orders_products_attributes_id => $attributes_details) {
				$Query = "UPDATE " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " set
					products_options = '" . $attributes_details["option"] . "',
					products_options_values = '" . $attributes_details["value"] . "',
					options_values_price ='" . $attributes_details["price"] . "',
					options_per_name ='" . $attributes_details['pername'] . "',
					options_price_calc ='" . $attributes_details['calcway'] . "',
					price_prefix ='" . $attributes_details["prefix"] . "'
					where orders_products_attributes_id = '$orders_products_attributes_id';";
					tep_db_query($Query);
				}//end of foreach($products_details["attributes"]
			}// end of if(isset($products_details[attributes]))

 

Find

 // currecies drop-down array
 $currency_query = tep_db_query("select distinct title, code from " . TABLE_CURRENCIES . " order by code ASC");  
 $currency_array = array();
 while($currency = tep_db_fetch_array($currency_query)) {
   $currency_array[] = array('id' => $currency['code'],
                             'text' => $currency['code'] . ' - ' . $currency['title']);
 }

 

Add after

//BOF multimixer set price per unit / per item 20 8 10 
 $products_options_calc_way[OPTIONS_PER_UNIT] = OPTIONS_PER_UNIT_NAME;
 $products_options_calc_way[OPTIONS_PER_ITEM] = OPTIONS_PER_ITEM_NAME;
// Translate calculation way values to english string
function translate_type_to_name1($calc_way) {
 global $products_options_calc_way;
 return isset($products_options_calc_way[$calc_way]) ? $products_options_calc_way[$calc_way] : 'Error ' . $calc_way;
}
//EOF multimixer set price per unit / per item 20 8 10 

 

Find

"<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][price]' size='7' value='" . $order->products[$i]['attributes'][$j]['price'] . "' onKeyUp=\"updatePrices('att_price', '" . $orders_products_id . "')\" onChange=\"updateAttributesField('hard', 'options_values_price', '" . $orders_products_attributes_id . "', '" . $orders_products_id . "', encodeURIComponent(this.value))\" id='p". $orders_products_id . "a" . $orders_products_attributes_id . "'>";

 

Replace with

"<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][price]' size='7' value='" . $order->products[$i]['attributes'][$j]['price'] . "' onKeyUp=\"updatePrices('att_price', '" . $orders_products_id . "')\" onChange=\"updateAttributesField('hard', 'options_values_price', '" . $orders_products_attributes_id . "', '" . $orders_products_id . "', encodeURIComponent(this.value))\" id='p". $orders_products_id . "a" . $orders_products_attributes_id . "'>" . 
			//BOF set price per unit / per item multimixer 20 8 10
			"<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][pername]' size='10'  value='" . oe_html_quotes($order->products[$i]['attributes'][$j]['pername']) . "' onChange=\"updateAttributesField('simple', 'options_per_name', '" . $orders_products_attributes_id . "', '" . $orders_products_id . "', encodeURIComponent(this.value))\">" .
			"<input type=hidden name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][calcway]' size='1' id='p" . $orders_products_id . "_" . $orders_products_attributes_id . "_calcway' value='" . $order->products[$i]['attributes'][$j]['calcway'] . "' onKeyUp=\"updatePrices('att_price', '" . $orders_products_id . "')\" onChange=\"updateAttributesField('hard', 'options_price_calc', '" . $orders_products_attributes_id . "', '" . $orders_products_id . "', encodeURIComponent(this.value))\">"; echo translate_type_to_name1($order->products[$i]['attributes'][$j]['calcway']);
			//EOF set price per unit / per item multimixer 20 8 10

 

Find

"<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][price]' size='7' value='" . $order->products[$i]['attributes'][$j]['price'] . "' onKeyUp=\"updatePrices('att_price', '" . $orders_products_id . "')\" id='p". $orders_products_id . "a" . $orders_products_attributes_id . "'>";

 

Replace with

"<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][price]' size='7' value='" . $order->products[$i]['attributes'][$j]['price'] . "' onKeyUp=\"updatePrices('att_price', '" . $orders_products_id . "')\" id='p". $orders_products_id . "a" . $orders_products_attributes_id . "'>" . 
			//BOF set price per unit / per item multimixer 20 8 10
			"<input name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][pername]' size='10' value='" . oe_html_quotes($order->products[$i]['attributes'][$j]['pername']) . "'>".
			"<input type=hidden name='update_products[$orders_products_id][attributes][$orders_products_attributes_id][calcway]' size='1' id='p" . $orders_products_id . "_" . $orders_products_attributes_id . "_calcway' value='" . $order->products[$i]['attributes'][$j]['calcway'] . "' onKeyUp=\"updatePrices('att_price', '" . $orders_products_id . "')\">" ; echo translate_type_to_name1($order->products[$i]['attributes'][$j]['calcway']);				
//EOF set price per unit / per item multimixer 20 8 10

 

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

5) File admin/order_editor/cart.php

 

Find

            $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
           $attribute_price = tep_db_fetch_array($attribute_price_query);
           if ($attribute_price['price_prefix'] == '+') {
             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } else {
             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }

 

Replace with

	// BOF set price per unit / per item multimixer 20 8 10	added options_price_calc	
           $attribute_price_query = tep_db_query("select options_values_price, price_prefix, options_price_calc from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
// EOF set price per unit / per item multimixer 20 8 10		
           $attribute_price = tep_db_fetch_array($attribute_price_query);

// BOF set price per unit / per item multimixer 20 8 10		
  	if ($attribute_price['options_price_calc'] == '0') {
// EOF set price per unit / per item multimixer 20 8 10		
           if ($attribute_price['price_prefix'] == '+') {
             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } else {
             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }
// BOF set price per unit / per item multimixer 20 8 10		
} else {
           if ($attribute_price['price_prefix'] == '+') {
             $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } else {
             $this->total -= tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }
}		
// EOF set price per unit / per item multimixer 20 8 10		

 

Find

          $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
         $attribute_price = tep_db_fetch_array($attribute_price_query);
         if ($attribute_price['price_prefix'] == '+') {
           $attributes_price += $attribute_price['options_values_price'];
         } else {
           $attributes_price -= $attribute_price['options_values_price'];
         }

 

Replace with

	// BOF set price per unit / per item multimixer 20 8 10	added options_price_calc	
         $attribute_price_query = tep_db_query("select options_values_price, price_prefix, options_price_calc from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
// EOF set price per unit / per item multimixer 20 8 10		
         $attribute_price = tep_db_fetch_array($attribute_price_query);

// BOF set price per unit / per item multimixer 20 8 10		
  	if ($attribute_price['options_price_calc'] == '0') {
// EOF set price per unit / per item multimixer 20 8 10		
         if ($attribute_price['price_prefix'] == '+') {
           $attributes_price += $attribute_price['options_values_price'];
         } else {
           $attributes_price -= $attribute_price['options_values_price'];
         }
// BOF set price per unit / per item multimixer 20 8 10		
} else {
         if ($attribute_price['price_prefix'] == '+') {
           $attributes_price += $attribute_price['options_values_price'] / $this->contents[$products_id]['qty'];
         } else {
           $attributes_price -= $attribute_price['options_values_price'] / $this->contents[$products_id]['qty'];
         }
}		
// EOF set price per unit / per item multimixer 20 8 10		

 

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

 

6) File admin/order_editor/javascript.php

 

Find

        var url = "<?php echo FILENAME_ORDERS_EDIT_AJAX; ?>?action=update_product_field&oID=<?php echo $_GET['oID']; ?>&pid=" + pid + "&field=" + field + "&new_value=" + value;

 

Replace with

// BOF set price per unit / per item multimixer 20 8 10
	var final_price = document.getElementById("update_products[" + pid + "][final_price]").value; // set price per unit / per item multimixer 20 8 10
       var url = "<?php echo FILENAME_ORDERS_EDIT_AJAX; ?>?action=update_product_field&oID=<?php echo $_GET['oID']; ?>&pid=" + pid + "&field=" + field + "&new_value=" + value + "&final_price=" + final_price;
// EOF set price per unit / per item multimixer 20 8 10

 

Find

	if ((action != 'qty') && (action != 'price_incl')) {
document.getElementById("update_products[" + pid + "][price_incl]").value = doFormat(priceInclValue, 4);
}

 

Replace with

//BOF set price per unit / per item multimixer 20 8 10	if ((action != 'qty') && (action != 'price_incl')) {
// BOF original
/* 
if ((action != 'qty') && (action != 'price_incl')) {
document.getElementById("update_products[" + pid + "][price_incl]").value = doFormat(priceInclValue, 4);
}
*/ 
//EOF original
if (action != 'price_incl') { // The (action != 'qty') condition taken out, so reaktion ok on qty changes // price incl
document.getElementById("update_products[" + pid + "][price_incl]").value = doFormat(priceInclValue, 10);
}
//EOF set price per unit / per item multimixer 20 8 10	

 

Find

   function getAttributesPrices(pid){ //get any attributes prices that may exist 
   var sum =0;
   var el=document.getElementsByTagName('input');//all the input elements
     for(var i=0;i<el.length;i++){
      if(el[i].id.indexOf(pid)>-1){
       var aid=el[i].id.replace(pid,'').replace('p', '').replace('a', '');//extract the attribute id
       var p=el[i].id.replace(pid,'').replace(/\d/g,'');
         if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '-') {
          sum-=Number(el[i].value);
         }
         if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '+') {
          sum+=Number(el[i].value);
         }
        }
       }
     return sum
    } //end function getAttributePrices(pid)

 

Replace with

//BOF set price per unit / per item multimixer 20 8 10	if ((action != 'qty') && (action != 'price_incl')) {
// BOF original
/* 
  function getAttributesPrices(pid){ //get any attributes prices that may exist 
   var sum =0;
   var el=document.getElementsByTagName('input');//all the input elements
   var qty = document.getElementById("update_products[" + pid + "][qty]").value; //set price per unit / per item multimixer 20 8 10
     for(var i=0;i<el.length;i++){
      if(el[i].id.indexOf(pid)>-1){
       var aid=el[i].id.replace(pid,'').replace('p', '').replace('a', '');//extract the attribute id
       var p=el[i].id.replace(pid,'').replace(/\d/g,'');
         if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '-') {
          sum-=Number(el[i].value);
         } // if((p=='pa')
         if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '+') {
          sum+=Number(el[i].value);
         } // if((p=='pa')
        } // end if(el[i].id.indexOf(pid)>-1){
       } // end for(var i=0;i<el.length;i++){
     return sum
    } //end function getAttributePrices(pid)
*/ 
//EOF original

  function getAttributesPrices(pid){ //get any attributes prices that may exist 
   var sum =0;
   var el=document.getElementsByTagName('input');//all the input elements
   var qty = document.getElementById("update_products[" + pid + "][qty]").value; //set price per unit / per item multimixer 20 8 10
     for(var i=0;i<el.length;i++){
      if(el[i].id.indexOf(pid)>-1){
       var aid=el[i].id.replace(pid,'').replace('p', '').replace('a', '');//extract the attribute id
       var p=el[i].id.replace(pid,'').replace(/\d/g,'');

         if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_calcway')) && (document.getElementById('p' + pid + '_' + aid + '_calcway').value) == '0') { // if per unit

         		if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '-') {
          		sum-=Number(el[i].value);
         		} // if((p=='pa')
         		if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '+') {
          		sum+=Number(el[i].value);
         		} // if((p=='pa')
		} // end if per unit

         if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_calcway')) && (document.getElementById('p' + pid + '_' + aid + '_calcway').value) == '1') { // if per item

         		if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '-') {
          		sum-=Number(el[i].value) / qty;
         		} // if((p=='pa')
         		if((p=='pa') && (document.getElementById('p' + pid + '_' + aid + '_prefix')) && (document.getElementById('p' + pid + '_' + aid + '_prefix').value) == '+') {
          		sum+=Number(el[i].value) / qty;
         		} // if((p=='pa')
		} // end if per item

        } // end if(el[i].id.indexOf(pid)>-1){
       } // end for(var i=0;i<el.length;i++){
     return sum
    } //end function getAttributePrices(pid)

//EOF set price per unit / per item multimixer 20 8 10	

 

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

7) File admin/order_editor/order.php

 

Find

        $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, orders_products_attributes_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
       if (tep_db_num_rows($attributes_query)) {
         while ($attributes = tep_db_fetch_array($attributes_query)) {
           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                    'value' => $attributes['products_options_values'],
                                                                    'prefix' => $attributes['price_prefix'],
                                                                    'price' => $attributes['options_values_price'],
                                            'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

 

Replace with

		// set price per unit / per item multimixer 20 8 10	added , options_per_name, options_price_calc	
       $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, orders_products_attributes_id, options_per_name, options_price_calc from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
       if (tep_db_num_rows($attributes_query)) {
         while ($attributes = tep_db_fetch_array($attributes_query)) {
           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                    'value' => $attributes['products_options_val2520'calcway' => $attributes['options_price_calc'],
							     // set price per unit / per item multimixer 20 8 10 (2 lines above added)
                                            'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

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

You are done :)

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

What is new?

 

Going now to your order editor in admin, you will see that adding a new product with attributes will calculate the price correctly, depending on the option setting you have for every option (to be per item or per unit)

 

After the product is added you will see 2 more field beside each attribute price.

- Th2520'calcway' => $attributes['options_price_calc'],

// set price per unit / per item multimixer 20 8 10 (2 lines above added)

'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

[/code]

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

You are done :)

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

What is new?

 

Going now to your order editor in admin, you will see that adding a new product with attributes will calculate the price correctly, depending on the option setting you have for every option (to be per item or per unit)

 

After the product is added you will see 2 more field beside each attribute price.

- The input field is to enter a calculation way description, that free text up to 32 characters

 

- On the right there is a text saying "per item" or "per unit", thats just for you to know how the attributes price is getting calculated. This is not meant to be changed (it's set once per option in attribute manager) but if you want you can:

 

In file admin/edit_orders.php search for

"<input type=hidden

and delete the

 type=hidden

Doing this, you will see one more input field with values 0 (=per unit) or 1 (=per item). Changing between this 2 values will change the attribute calculation way just for this attribute, this product and this order, no influence to other settings

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

Last note: I'm sorry if this all appear like replacing huge parts of code. In real in most of the cases you are just adding something to the code. Reading the issues the most users have with "details" like a forgotten } etc, I prefered to post complete parts of code to make it easier to copy paste without too much thinking

 

Have a nice day all

Edited by multimixer
Link to comment
Share on other sites

Somehow the upload got corrupted

 

Again just for 7) File admin/order_editor/order.php

 

Find

        $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, orders_products_attributes_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
       if (tep_db_num_rows($attributes_query)) {
         while ($attributes = tep_db_fetch_array($attributes_query)) {
           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                    'value' => $attributes['products_options_values'],
                                                                    'prefix' => $attributes['price_prefix'],
                                                                    'price' => $attributes['options_values_price'],
                                            'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

 

Replace with

		// set price per unit / per item multimixer 20 8 10	added , options_per_name, options_price_calc	
       $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix, orders_products_attributes_id, options_per_name, options_price_calc from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
       if (tep_db_num_rows($attributes_query)) {
         while ($attributes = tep_db_fetch_array($attributes_query)) {
           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                    'value' => $attributes['products_options_values'],
                                                                    'prefix' => $attributes['price_prefix'],
                                                                    'price' => $attributes['options_values_price'],
                                                                    'pername' => $attributes['options_per_name'],
							      'calcway' => $attributes['options_price_calc'],
							     // set price per unit / per item multimixer 20 8 10 (2 lines above added)
                                            'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);

Link to comment
Share on other sites

hi,

 

I have downloaded this contribution after seeing it on another site because i need for the customer to enter characters over 3 or 4 lines that can be engraved onto a product.

 

I am lost with the install file 'option types v2 installtion instruction.txt' because there are characters in there that i have no idea what they are or are refering too...

 

\f1\fs24 \

\

 

\f0\fs22 \cf2 echo \cf3 '<br><nobr><small> <i> - ' \cf0 . \cf4 $order\cf0 ->products[\cf4 $i\cf0 ][\cf3 'attributes'\cf0 ][\cf4 $j\cf0 ][\cf3 'option'\cf0 ] . \cf3 ': ' \cf0 . \cf4 $order\cf0 ->products[\cf4 $i\cf0 ][\cf3 'attributes'\cf0 ][\cf4 $j\cf0 ][\cf3 'value'\cf0 ] . \cf3 '</i></small></nobr>'\cf0 ;\

\

 

 

 

on the 1st part of the find this and replace with... i have no idea what all the /cf3 etc are as they are not proper php coding

 

can anyone help or maybe could supply proper install instructions??

 

many thanks - Mark

Link to comment
Share on other sites

I am lost with the install file 'option types v2 installtion instruction.txt' because there are characters in there that i have no idea what they are or are refering too...

 

\f1\fs24 \

\

 

\f0\fs22 \cf2 echo \cf3 '<br><nobr><small> <i> - ' \cf0 . \cf4 $order\cf0 ->products[\cf4 $i\cf0 ][\cf3 'attributes'\cf0 ][\cf4 $j\cf0 ][\cf3 'option'\cf0 ] . \cf3 ': ' \cf0 . \cf4 $order\cf0 ->products[\cf4 $i\cf0 ][\cf3 'attributes'\cf0 ][\cf4 $j\cf0 ][\cf3 'value'\cf0 ] . \cf3 '</i></small></nobr>'\cf0 ;\

\

 

 

You are not the first one who report this problem. The installation instructions uploaded by rosemaryann (13 11 2009) are either wrong or corrupted.

 

Take the version of 18 10 2009 by Zappo and use a file comparison tool to merge the files

 

Also go through the pages of this topic from 18 10 2009 on, for reported bugs, fixes and improvements

 

A new version will be coming soon, but till then thats the best you can do

Link to comment
Share on other sites

Hi...after a bit of 'trial and error' with STS 4.6 i finally got this great contrib going...as most have stated it was exactly what they were after.

 

I am pretty fresh with php so some direction/confirmation of my thoughts would be appreciated. On your cart you sell a product with which a buyer can select size, colour, upload a picture to have printed on etc. Lets say s/he has successfully chosen 6 drop down boxes...choosing a variable from each and then proceeds through checkout.

 

They receive an email soon after that lists the 6 drop down boxes and variables they have chosen and we see it in Admin view in both packing/invoice detail.

 

I have installed a contrib called PDF_Customer_Invoice_v1.1 where via accessing My Account the user can print off an invoice once the product etc has been delivered.

 

It is in this area I'd like to ask a question. The pdf invoice without any modification will only show a single line of the customer purchase. Once you run out of line, that also means the end of any purchase description that equates not giving a full invoice of purchase. (want to duplicate what admin invoice or packing slip offers where you see full account of purchase)

 

How or where do I begin to start the modifications. Amongst some files uploaded, common ones are catalog/pdfinvoice and account_history_info and includes/languages/english/pdfinvoice and account_history_info

I am assuming it is a table properties setting...but assuming is about all.

 

Any thoughts would be great!!

 

cheers

Link to comment
Share on other sites

You are not the first one who report this problem. The installation instructions uploaded by rosemaryann (13 11 2009) are either wrong or corrupted.

 

Take the version of 18 10 2009 by Zappo and use a file comparison tool to merge the files

 

Also go through the pages of this topic from 18 10 2009 on, for reported bugs, fixes and improvements

 

A new version will be coming soon, but till then thats the best you can do

 

Just rename the installation instructions from a txt file to rtf and open with word.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I seem to be having a problem with the Text Box part of the contribution - everything else works great.

 

I have set the length of the box to 500 characters to allow customers to add customisation details.

 

However when I get the order the text is truncated to 32 characters.

 

I have done a test order myself and the text is passed through all the way upto confirm order, then any text after 32 characters vanishes from the order, the invoice, the order history. I have also looked in the orders_options table and the data is truncated there as well.

 

How can I increase the size of the text that will be passed through ?

 

Many Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Hi,

 

I seem to be having a problem with the Text Box part of the contribution - everything else works great.

 

I have set the length of the box to 500 characters to allow customers to add customisation details.

 

However when I get the order the text is truncated to 32 characters.

 

I have done a test order myself and the text is passed through all the way upto confirm order, then any text after 32 characters vanishes from the order, the invoice, the order history. I have also looked in the orders_options table and the data is truncated there as well.

 

How can I increase the size of the text that will be passed through ?

 

Many Thanks

 

Hi Heather

 

Try this first in your database in tables customers_basket_attributes (field products_options_value_text) and orders_products_attributes (field products_options_values) change the varchar value to higher

 

I don't think there is anything else limiting the text length, if this dont solve the problem, then report again so we can search elsewhere

Link to comment
Share on other sites

Just rename the installation instructions from a txt file to rtf and open with word.

 

There are some other mistakes in the instructions, reported earlier in this topic. Still better to use a file comparison program. Files are tested and working

Link to comment
Share on other sites

  • 4 weeks later...

Dear Zappo,

 

first of all thank you for such a great contribution! Kudos! And your support is really excellent. B)

 

Here's the issue I still have:

When I use the radio button option type and have options with multiple values,

each option does not have the first option value checked.

 

So I used valeri's idea in option_types.php, to have ALL radio buttons checked.

But that shows the last radio button as checked instead of the first.

 

Then I used your idea:

if ((isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID]) && ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID])) || empty($checked)) {

 

But that puts the 'checked' attribute on every alternate value.

radiobuttons_alternate.jpg

 

Would you please help me as this is the only problem I have with this great contribution.

 

Thank you very much.

Edited by gtheocharis
Link to comment
Share on other sites

Good morning,

 

After installing Option Types V2 (which is awesome, btw), I came across some files in my image folder that looked like trouble, they began with goog1e#####, I expect they have been there for a while without me knowing. Among other security changes, following the directions I read, I set the file permissions in several folders to 755. After doing this, when adding an item to the shopping cart that has an UPLOAD file option, clicking 'add to cart' does nothing but refresh the page, and re-display the same item with all the option fields reset to blank.

 

If I set the file permission for the image folder and all folders below that to 777, everything works again. I expect this is a security issue, and would like to correct it. Any ideas how to remedy this, or at lease minimize the risk?

 

I'm writing in a bit of a rush, I hope this all makes sense.

 

Thanks!

Edited by zaaephod
Link to comment
Share on other sites

Good morning,

 

After installing Option Types V2 (which is awesome, btw), I came across some files in my image folder that looked like trouble, they began with goog1e#####, I expect they have been there for a while without me knowing. Among other security changes, following the directions I read, I set the file permissions in several folders to 755. After doing this, when adding an item to the shopping cart that has an UPLOAD file option, clicking 'add to cart' does nothing but refresh the page, and re-display the same item with all the option fields reset to blank.

 

If I set the file permission for the image folder and all folders below that to 777, everything works again. I expect this is a security issue, and would like to correct it. Any ideas how to remedy this, or at lease minimize the risk?

 

I'm writing in a bit of a rush, I hope this all makes sense.

 

Thanks!

 

The gogxxx.php files in your images folder are a sign that you got hacked. This has nothing to do with the option types installation. Also, not enough to set the folder permissions to 755 to prevent hacking, there are several things to do, I recommed you to read the pinned security topics and some good security posts in the tips and tricks section ("how to secure your site").There is also a special security forum, I would go through.

 

Regarding the image folder permissions, option types use 2 folders for uploading files images/temp/ for not registered users and images/uploads/ for registered, both should have permissions 755. The fact that you need to have permissions set to 777 to be able to upload files is host related. Can you upload product images via admin, for example, having the image folder set to 755? I guess you also need to have it to 777. Talk to your host about this, and if nothing to do, then, in your case, I would change the host

Link to comment
Share on other sites

The gogxxx.php files in your images folder are a sign that you got hacked. This has nothing to do with the option types installation. Also, not enough to set the folder permissions to 755 to prevent hacking, there are several things to do, I recommed you to read the pinned security topics and some good security posts in the tips and tricks section ("how to secure your site").There is also a special security forum, I would go through.

 

Regarding the image folder permissions, option types use 2 folders for uploading files images/temp/ for not registered users and images/uploads/ for registered, both should have permissions 755. The fact that you need to have permissions set to 777 to be able to upload files is host related. Can you upload product images via admin, for example, having the image folder set to 755? I guess you also need to have it to 777. Talk to your host about this, and if nothing to do, then, in your case, I would change the host

 

 

Yep, I didn't mean to imply that the contribution had something to do with being hacked. I spent my morning reading the security threads, and was starting by renaming the admin, deleting file manager, etc. I had just got to the part about changing file permissions when I ran across the problem with the cart. I don't use any of the admin functions for product management though, all of that is done locally and uploaded via a heavily modified easypopulate and FTP for the images. Off to install some security addons now.

 

I do wonder though, why is it that some hosts would, or would not allow these folders to be 755?

Link to comment
Share on other sites

Yep, I didn't mean to imply that the contribution had something to do with being hacked. I spent my morning reading the security threads, and was starting by renaming the admin, deleting file manager, etc. I had just got to the part about changing file permissions when I ran across the problem with the cart. I don't use any of the admin functions for product management though, all of that is done locally and uploaded via a heavily modified easypopulate and FTP for the images. Off to install some security addons now.

 

I do wonder though, why is it that some hosts would, or would not allow these folders to be 755?

Can you you check how setting up a product manually and uploading it's image via the admin page work while the image folder is at 755?

 

Well, I wonder too, no idea to be honest. It's possible that you got hacked before you started with the security things

Link to comment
Share on other sites

Can you you check how setting up a product manually and uploading it's image via the admin page work while the image folder is at 755?

 

Well, I wonder too, no idea to be honest. It's possible that you got hacked before you started with the security things

 

 

Sure, I set the image folder and sub-folders to 755 and get a message in red at the top:

 

Error Error: Destination not writeable.

Error Error: Catalog images directory is not writeable: /data/websites/xxxxxxxxxxxxx.com/htdocs/oscommerce/catalog/images/

 

I presume this means I need to talk to my host about it, who I already called and left a message for the guy I was talking to the other day. I'm trying to work out exactly what I need to ask them to make them understand the problem.

 

Edit: I need to see if they can set up Apache as a user that has permission to change file permissions, yes?

Edited by zaaephod
Link to comment
Share on other sites

Sure, I set the image folder and sub-folders to 755 and get a message in red at the top:

 

Error Error: Destination not writeable.

Error Error: Catalog images directory is not writeable: /data/websites/xxxxxxxxxxxxx.com/htdocs/oscommerce/catalog/images/

 

I presume this means I need to talk to my host about it, who I already called and left a message for the guy I was talking to the other day. I'm trying to work out exactly what I need to ask them to make them understand the problem.

 

Edit: I need to see if they can set up Apache as a user that has permission to change file permissions, yes?

 

 

Hi, a couple things... "goog1e#####" is a worm and if you go into your includes/languages/each language you have/cookie_usage.php you will probably find strange code. If so destroy them and put fresh copies in. This worm appears often when image files are set to 777. Now I am not just referring to the folder but also to each image. The folders should be 755 and ALL images 644. On some servers I noticed that uploaded images are automatically set to 777 as so go unnoticed so the image directory on those servers have to be regularly followed (with Filezilla you can click on the upper right Permissions twice and it will order the images in descending order so you can spot the 777s right away. Note also that an image folder set at 755 but has the images at 777 will not show the images so verify them first.

 

Second, no hoster in his right mind today obliges 777 permissions!!!!! All 777 files are writeable by anyone so no matter what security you have you will go under!!! If after all attempts fail you can only have 777 permissions as mentioned above leave your hoster fast. Then, before uploading to another hoster verify all files against vanilla osc files to find strange code and any suspicious images files that could bring the worm with it.

 

Hope this helps.

 

Barbara

Link to comment
Share on other sites

Thanks for all the help, everyone.

 

I have one more question. One of the options I offer is custom artwork. I'd like this charge to only be applied once for each entry in the shopping cart. For example, if you order 1, the charge is $20, or if you order 100 identical items, the charge is still $20 extra, since the artwork only needs to be done once.

 

I've had a look around in the code, but haven't found where I can change this. I remember reading about it somewhere too, but for the life of me I can't find it.

 

Thanks :)

Link to comment
Share on other sites

I have one more question. One of the options I offer is custom artwork. I'd like this charge to only be applied once for each entry in the shopping cart. For example, if you order 1, the charge is $20, or if you order 100 identical items, the charge is still $20 extra, since the artwork only needs to be done once.

 

What you need is the ability to calculate a specific option per unit (ie 2x150=300) or just one per item, like your artwork

 

The solution for this is just a few posts above yours

 

1) calculate products options per item or per unit.

2) Modifications for order editor

Link to comment
Share on other sites

Could anyone help me?

 

The only issue I have is: each (radio button) option set should have its first option value checked.

 

I tried valeri's idea in option_types.php, to have all radio buttons checked, but that naturally shows the LAST radio buttons as checked.

 

Then I used Zappo's idea:

if ((isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID]) && ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID])) || empty($checked)) {

 

But that puts the 'checked' attribute on every ALTERNATE value, and ends up looking like this:

radiobuttons_alternate.jpg

 

I would appreciate any help with this.

Thank you very much in advance.

Link to comment
Share on other sites

Could anyone help me?

 

The only issue I have is: each (radio button) option set should have its first option value checked.

 

I tried valeri's idea in option_types.php, to have all radio buttons checked, but that naturally shows the LAST radio buttons as checked.

 

Then I used Zappo's idea:

if ((isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID]) && ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID])) || empty($checked)) {

 

But that puts the 'checked' attribute on every ALTERNATE value, and ends up looking like this:

radiobuttons_alternate.jpg

 

I would appreciate any help with this.

Thank you very much in advance.

 

i think its not possible to get all top radio selected. my final fix was one that selected the top radio leaving the bottom to be selected by the users if they require them:

 

if ((isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID]) && ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID])) || !isset($checked)) {

$checked = true;

} else {

$checked = false;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...