Wanting to move text field below button...

Hello…I am new to this forum. My PHP is very limited. I am using a plug-in for Wordpress and I am trying to change the look of the output. As you can see from my test page here…

http://livefitrevolution.org/?page_id=196555

…I am setting up different donation levels for my non-profit. The last one is a used defined amount. The output of the plug-in puts the field where they enter the amount they wish to donate ABOVE the button. I simply want that field to be BELOW the button and centered under it.

The plug-in I am using is WP sStore. This is the PHP code for that output in the “eStore_misc_functions.php” file…

[php]//If custom price option is set
if($ret_product->custom_price_option==‘1’)
{
$currSymbol = get_option(‘cart_currency_symbol’);
$replacement .= $currSymbol.’ ';
if ($line_break) $replacement .= ‘
’;
}[/php]

Any help on how to change the PHP to get the dollar amount field below the button and centered? Do I need to provide any more code or info? Thank in advance. You are helping a non-profit with a great cause and I appreciate your time.

Is there any code beneath the above part? Something that references the “your amount” image? Looks like it’s gathering page content into the $resplacement variable for later display. Should be as simple as changing the order of the input and img lines…

I believe the code for the button is actually above the code I originally posted (the user-defined amount field). I think this is the code for the button…

[php]function get_button_code_for_product($id)
{
global $wpdb;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$id = strip_tags($id);
$ret_product = $wpdb->get_row(“SELECT * FROM $products_table_name WHERE id = ‘$id’”, OBJECT);
if($ret_product){
$output = get_button_code_for_element($ret_product);
}
else{
$output = eStore_wrong_product_id_error_msg($id);
}
return $output;
}[/php]

I am using a shortcode that references a “Product ID”. In the plugin, you have the option of using their default button or creating and uploading your own. The button I am using are buttons that I created. So, I believe this is the code that accesses that button.

To give you a bigger picture, here is all of the code from the above snippet (getting the button code function) and the original snippet I posted (for the user-defined amount), including the code for the entire function…

[php]function get_button_code_for_product($id)
{
global $wpdb;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$id = strip_tags($id);
$ret_product = $wpdb->get_row(“SELECT * FROM $products_table_name WHERE id = ‘$id’”, OBJECT);
if($ret_product){
$output = get_button_code_for_element($ret_product);
}
else{
$output = eStore_wrong_product_id_error_msg($id);
}
return $output;
}

function get_button_code_for_element($ret_product,$line_break=true,$nggImage=’’,$buttonImage=’’)
{
$replacement = “”;
if($ret_product)
{
if (is_numeric ($ret_product->available_copies))
{
if ($ret_product->available_copies < 1)// No more copies left
{
$replacement = ‘’;
return $replacement;
}
}
if (!empty($ret_product->target_button_url))
{
$replacement = ‘’;
$replacement .= get_input_button($ret_product->button_image_url);
$replacement .= ‘’;
return $replacement;
}
$replacement .= ‘’;
$replacement .= ‘’;

    $var_output = get_variation_and_input_code($ret_product,$line_break,1,$nggImage);
    if (!empty($var_output))
    {
         $replacement .= $var_output;
    }

	//If custom price option is set
	if($ret_product->custom_price_option=='1')
	{
		$currSymbol = get_option('cart_currency_symbol');
		$replacement .= $currSymbol.'<input type="text" name="custom_price" size="3" value="" />&nbsp;';
		if ($line_break) $replacement .= '<br />';
	}
		    
    if($ret_product->show_qty=='1')
    {
		$replacement .= ESTORE_QUANTITY.': <input type="text" name="add_qty" size="1" value="1" />&nbsp;';
		if ($line_break) $replacement .= '<br />';
    }
    else
    {
    	$replacement .= '<input type="hidden" name="add_qty" value="1" />';
    }    
	    
    if(!empty($buttonImage)){
    	$replacement .= get_input_button($buttonImage);
    }
    else{
    	$replacement .= get_input_button($ret_product->button_image_url);
    }
    
	if(!empty($nggImage->alttext))
	{			
		$replacement .= '<input type="hidden" name="product" value="'.htmlspecialchars($nggImage->alttext).'" /><input type="hidden" name="product_name_tmp1" value="'.htmlspecialchars($nggImage->alttext).'" />';
	}
	else
	{
    	$replacement .= '<input type="hidden" name="product" value="'.htmlspecialchars($ret_product->name).'" /><input type="hidden" name="product_name_tmp1" value="'.htmlspecialchars($ret_product->name).'" />';
	}	
	if(!empty($nggImage->imageURL)){
		$replacement .= '<input type="hidden" name="thumbnail_url" value="'.$nggImage->imageURL.'" />';
	}
	else{
		$replacement .= '<input type="hidden" name="thumbnail_url" value="'.$ret_product->thumbnail_url.'" />';
	}	
	$replacement .= '<input type="hidden" name="price" value="'.$ret_product->price.'" /><input type="hidden" name="price_tmp1" value="'.$ret_product->price.'" />';
	$replacement .= '<input type="hidden" name="item_number" value="'.$ret_product->id.'" /><input type="hidden" name="shipping" value="'.$ret_product->shipping_cost.'" /><input type="hidden" name="tax" value="'.$ret_product->tax.'" /><input type="hidden" name="addcart_eStore" value="1" />';
	if(!empty($ret_product->product_url)){
		$replacement .= '<input type="hidden" name="cartLink" value="'.$ret_product->product_url.'" />';
	}
	else{
		$replacement .= '<input type="hidden" name="cartLink" value="'.digi_cart_current_page_url().'" />';
	}		
	if(wp_eStore_is_digital_product($ret_product)){//flag this as a digital product			
		$replacement .= '<input type="hidden" name="digital_flag" value="1" />';
	}
	$replacement .= '</form>';
	$replacement .= '</object>';
	return $replacement;
}
else //could not retrieve product from database
{		
	return eStore_wrong_product_id_error_msg($ret_product->id);
}

}[/php]

Does that give you a better picture of what is going on and if the order of the inputs and img lines can be changed? Thanks for all your help…

Sponsor our Newsletter | Privacy Policy | Terms of Service