Help - Search - Members - Calendar
Full Version: Product Options Code ?
CubeCart Forums > CubeCart Version 3 > Installation & Upgrade Help (Version 3)
aldosec
I was curious what the code was doing in the file /includes/content/cart.inc.php....

I know what the code is doing is the latter half just not a 100% sure what the start is doing???

Thanks.

********************************

$optionKeys = $cart->getOptions($key);//////mainly what is $key

$optionsCost = 0;
$plainOpts = "";

if(!empty($optionKeys)){

$options = explode(".",$optionKeys);

foreach($options as $value)
{
// look up options in database
$option = $db->select("SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE assign_id = ".$value);

$view_cart->assign("VAL_OPT_NAME",validHTML($option[0]['option_name']));
$view_cart->assign("VAL_OPT_VALUE",$option[0]['value_name']);

$plainOpts .= $option[0]['option_name']." - ".$option[0]['value_name']."\r\n";

if($option[0]['option_price']>0){

if($option[0]['option_symbol']=="+"){

$optionsCost = $optionsCost + $option[0]['option_price'];

} elseif($option[0]['option_symbol']=="-"){

$optionsCost = $optionsCost - $option[0]['option_price'];

} elseif($option[0]['option_symbol']=="~"){

$optionsCost = 0;

}

}
$view_cart->parse("view_cart.cart_true.repeat_cart_contents.options");
}

}
bsmither
$key is declared as part of the foreach command about 60 lines earlier. Your basket has contents and for each of those contents there are options. For each option, there are possibly costs associated with that option. The rest of the code you quoted is dealing with these options.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.