Jump to content

Recommended Posts

Hello!

 

I'm having problems getting this options box to work.

 

http://www.unifiedchamp.com/ucforum/cartplog.php?do=viewitem&cartplogproductid=22

 

The first option box to the left was what came originally with the program. The second was what I have added.

 

Here is the php code:

if ($_REQUEST['do'] == 'viewitem')
{
$vbulletin->input->clean_array_gpc('r', array(
	'cartplogproductid' => TYPE_UINT,
));
$cartplog['productid'] = $vbulletin->GPC['cartplogproductid'];

$cartplog_product_check = $db->query_first("SELECT *
	FROM " . TABLE_PREFIX . "cartplog_products
	WHERE productid = " . intval($cartplog['productid']) . "
");

if ($cartplog_product_check)
{
	$cartplog['product_productid'] = intval($cartplog_product_check['productid']);
	$cartplog['product_thumb'] = strval($cartplog_product_check['thumb']);
	$cartplog['product_title'] = htmlspecialchars_uni($cartplog_product_check['title']);
	$cartplog['product_description'] = strval($cartplog_product_check['description']);
	$cartplog['product_price'] = round(floatval($cartplog_product_check['price']), 2);
	$cartplog['product_options'] = '';
	$cartplog['product_options2'] = '';
                //Fix productprice
        $cartplog['product_price'] = '$' . number_format($cartplog['product_price'], 2);

	$cartplog_product_options = array_map('trim', unserialize($cartplog_product_check['options']));
	$cartplog_product_options2 = array_map('trim', unserialize($cartplog_product_check['options2']));
	if (!is_array($cartplog_product_options))
	{
		$cartplog_product_options = array();
	}
	if (!is_array($cartplog_product_options2))
	{
		$cartplog_product_options2 = array();
	}
	foreach($cartplog_product_options AS $cartplog_options_key => $cartplog_options_title)
	{
		if (vbstrlen($cartplog_options_title))
		{
			$cartplog['options_title'] = htmlspecialchars_uni($cartplog_options_title);
			$cartplog['product_options'] .= '<option value="' . $cartplog['options_title'] . '">' . $cartplog['options_title'] . '</option>';
			$cartplog['product_options'] .= "\n";
		}
	}
	foreach($cartplog_product_options2 AS $cartplog_options_key => $cartplog_options_title)
	{
		if (vbstrlen($cartplog_options_title))
		{
			$cartplog['options_title'] = htmlspecialchars_uni($cartplog_options_title);
			$cartplog['product_options2'] .= '<option value="' . $cartplog['options_title'] . '">' . $cartplog['options_title'] . '</option>';
			$cartplog['product_options2'] .= "\n";
		}
	}


	if ($cartplog['product_options'])
	{
		$cartplog['product_options'] = '<select name="cartplogoptions">' . $cartplog['product_options'] . '</select>';
	}
	if ($cartplog['product_options2'])
	{
		$cartplog['product_options2'] = '<select name="cartplogoptions2">' . $cartplog['product_options2'] . '</select>';
	}

	$navbits = array();
	$navbits['cartplog.php' . $vbulletin->session->vars['sessionurl_q']] = htmlspecialchars_uni($vbphrase['cartplog']);
	$navbits[''] = htmlspecialchars_uni($vbphrase['cartplog_view_item']);
	$navbits = construct_navbits($navbits);

	eval('$navbar = "' . fetch_template('navbar') . '";');
	eval('print_output("' . fetch_template('cartplog_view_item') . '");');
}
else
{
	$cartplog_url = 'cartplog.php?' . $vbulletin->session->vars['sessionurl'] . 'do=viewindex';
	exec_header_redirect($cartplog_url);
	exit();
}
}

Anywhere you see the number 2 following the word options is what I have added. Some of this may not even need to be in there as I am just using trial and error.

 

Let me know what you think I can do. The drop down box to the right should reflect options for color. These colors have already been inputted through my admincp.

 

Let me know if you need to take a look at the full php script.

Link to comment
https://forums.phpfreaks.com/topic/91329-trouble-with-options-box/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.