Wordpress footer widget settings - php

Hello this is the link of my website
http://webienz.com/
In footer i want to set 3rd widget as contact info like this
Contact info
Contact Info UK (with flag of UK)
phone
email
address
Contact Info Pakistan (with flag of Pakistan)
phone
email
address
I have purchased theme and i have done some some editing boc.widgets.php but one contact info displaying at a time not both UK and Pakistan here is the original code of contact widget
* Contact Info Widget
class contact_info_widget extends WP_Widget {
function contact_info_widget()
{
$widget_ops = array('classname' => 'contact_info', 'description' => '');
$this->WP_Widget('contact_info-widget', 'Terra: Contact Info', $widget_ops);
}
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if($title) {
echo $before_title.$title.$after_title;
}
?>
<?php if($instance['phone']): ?>
<div class="icon_phone"><?php echo $instance['phone']; ?></div>
<?php endif; ?>
<?php if($instance['email']): ?>
<div class="icon_mail"><?php echo $instance['email']; ?></div>
<?php endif; ?>
<?php if($instance['address']): ?>
<div class="icon_loc"><?php echo $instance['address']; ?></div>
<?php endif; ?>
<div class="clear h10"></div>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = $new_instance['title'];
$instance['address'] = $new_instance['address'];
$instance['phone'] = $new_instance['phone'];
$instance['fax'] = $new_instance['fax'];
$instance['email'] = $new_instance['email'];
$instance['web'] = $new_instance['web'];
return $instance;
}
function form($instance)
{
$defaults = array('title' => 'Contact Info');
$instance = wp_parse_args((array) $instance, $defaults); ?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('phone'); ?>">Phone:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('phone'); ?>" name="<?php echo $this->get_field_name('phone'); ?>" value="<?php echo $instance['phone']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('email'); ?>">Email:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('email'); ?>" name="<?php echo $this->get_field_name('email'); ?>" value="<?php echo $instance['email']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('address'); ?>">Address:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('address'); ?>" name="<?php echo $this->get_field_name('address'); ?>" value="<?php echo $instance['address']; ?>" />
</p>
<?php
}
}
and this is the code i have edited
/**
* Contact Info Widget
*/
class contact_info_widget extends WP_Widget {
function contact_info_widget()
{
$widget_ops = array('classname' => 'contact_info', 'description' => '');
$this->WP_Widget('contact_info-widget', 'Terra: Contact Info', $widget_ops);
}
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if($title) {
echo $before_title.$title.$after_title;
}
?>
<?php if($instance['phone']): ?>
<div class="icon_phone"><?php echo $instance['phone']; ?></div>
<?php endif; ?>
<?php if($instance['phone2']): ?>
<div class="icon_phone"><?php echo $instance['phone2']; ?></div>
<?php endif; ?>
<?php if($instance['email']): ?>
<div class="icon_mail"><?php echo $instance['email']; ?></div>
<?php endif; ?>
<?php if($instance['email2']): ?>
<div class="icon_mail"><?php echo $instance['email2']; ?></div>
<?php endif; ?>
<?php if($instance['address']): ?>
<div class="icon_loc"><?php echo $instance['address']; ?></div>
<?php endif; ?>
<?php if($instance['address2']): ?>
<div class="icon_loc"><?php echo $instance['address2']; ?></div>
<?php endif; ?>
<div class="clear h10"></div>
<?php
echo $after_widget;
}
function update($new_instance, $old_instance)
{
$instance = $old_instance;
$instance['title'] = $new_instance['title'];
$instance['address'] = $new_instance['address'];
$instance['address2'] = $new_instance['address2'];
$instance['phone'] = $new_instance['phone'];
$instance['phone2'] = $new_instance['phone2'];
$instance['fax'] = $new_instance['fax'];
$instance['email'] = $new_instance['email'];
$instance['email2'] = $new_instance['email2'];
$instance['web'] = $new_instance['web'];
return $instance;
}
function form($instance)
{
$defaults = array('title' => 'Contact Info');
$instance = wp_parse_args((array) $instance, $defaults); ?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Title:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('phone'); ?>">Phone:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('phone'); ?>" name="<?php echo $this->get_field_name('phone'); ?>" value="<?php echo $instance['phone']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('email'); ?>">Email:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('email'); ?>" name="<?php echo $this->get_field_name('email'); ?>" value="<?php echo $instance['email']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('address'); ?>">Address:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('address'); ?>" name="<?php echo $this->get_field_name('address'); ?>" value="<?php echo $instance['address']; ?>" />
</p>
get_field_id('title'); ?>">Title:
get_field_id('title'); ?>" name="get_field_name('title'); ?>" value="" />
<p>
<label for="<?php echo $this->get_field_id('phone2'); ?>">Phone:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('phone2'); ?>" name="<?php echo $this->get_field_name('phone2'); ?>" value="<?php echo $instance['phone2']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('email2'); ?>">Email:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('email2'); ?>" name="<?php echo $this->get_field_name('email2'); ?>" value="<?php echo $instance['email2']; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('address2'); ?>">Address:</label>
<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('address'); ?>" name="<?php echo $this->get_field_name('address2'); ?>" value="<?php echo $instance['address2']; ?>" />
</p>
<?php
}
}
Please help me out in this code that how i can get desired output in footer i dont have too much know how about php.
Thanks

if you are having trouble with duplicating the fields, then just try a text widget
as a replacement

Related

Wordpress Theme-My-Login plugin profile page drop down will not save change to "Language"

I am using Theme-My-Login for wordpress.
I am using user_phone field to save language preference in register-form.php
<?php
/*
If you would like to edit this file, copy it to your current theme's directory and edit it there.
Theme My Login will always look in your theme's directory first, before using this default template.
*/
?>
<div class="tml tml-register" id="theme-my-login<?php $template->the_instance(); ?>">
<?php $template->the_errors(); ?>
<form name="registerform" id="registerform<?php $template->the_instance(); ?>" action="<?php $template->the_action_url( 'register', 'login_post' ); ?>" method="post">
<?php if ( 'email' != $theme_my_login->get_option( 'login_type' ) ) : ?>
<p class="tml-user-login-wrap">
<label for="user_login<?php $template->the_instance(); ?>"><?php _e( 'Username', 'theme-my-login' ); ?></label>
<input type="text" name="user_login" id="user_login<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_login' ); ?>" size="20" />
</p>
<?php endif; ?>
<p class="tml-user-email-wrap">
<label for="user_email<?php $template->the_instance(); ?>"><?php _e( 'E-mail', 'theme-my-login' ); ?></label>
<input type="text" name="user_email" id="user_email<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_email' ); ?>" size="20" />
</p>
<p>
<label for="first_name<?php $template->the_instance(); ?>"><?php _e( 'First name', 'theme-my-login' ) ?></label>
<input type="text" name="first_name" id="first_name<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'first_name' ); ?>" size="20" />
</p>
<p>
<label for="last_name<?php $template->the_instance(); ?>"><?php _e( 'Last name', 'theme-my-login' ) ?></label>
<input type="text" name="last_name" id="last_name<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'last_name' ); ?>" size="20" />
</p>
<p>
<label for="user_phone<?php $template->the_instance(); ?>"><?php _e('Preferred Language'); ?></label>
<select name="user_phone" id="user_phone<?php $template->the_instance(); ?>">
<option value="English" <?php selected( $template->the_posted_value( 'user_phone' ), 'english' ); ?>>English</option>
<option value="French" <?php selected( $template->the_posted_value( 'user_phone' ), 'french' ); ?>>French</option>
</select>
</p>
<?php do_action( 'register_form' ); ?>
<p class="tml-registration-confirmation" id="reg_passmail<?php $template->the_instance(); ?>"><?php echo apply_filters( 'tml_register_passmail_template_message', __( 'Registration confirmation will be e-mailed to you.', 'theme-my-login' ) ); ?></p>
<p class="tml-submit-wrap">
<input type="submit" name="wp-submit" id="wp-submit<?php $template->the_instance(); ?>" value="<?php esc_attr_e( 'Register', 'theme-my-login' ); ?>" />
<input type="hidden" name="redirect_to" value="<?php $template->the_redirect_url( 'register' ); ?>" />
<input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />
<input type="hidden" name="action" value="register" />
</p>
</form>
<?php $template->the_action_links( array( 'register' => false ) ); ?>
</div>
Following part is the language part in above code
<p>
<label for="user_phone<?php $template->the_instance(); ?>"><?php _e('Preferred Language'); ?></label>
<select name="user_phone" id="user_phone<?php $template->the_instance(); ?>">
<option value="English" <?php selected( $template->the_posted_value( 'user_phone' ), 'english' ); ?>>English</option>
<option value="French" <?php selected( $template->the_posted_value( 'user_phone' ), 'french' ); ?>>French</option>
</select>
</p>
Following code is where I want to call the language in Profile page and allow user to change language preference to either English or French.
I am able to call the language with below code but It's txt field and it does not save any change. How do I go about change it to drop down and save the new selection?
<?php
/*
If you would like to edit this file, copy it to your current theme's directory and edit it there.
Theme My Login will always look in your theme's directory first, before using this default template.
*/
?>
<div class="tml tml-profile" id="theme-my-login<?php $template->the_instance(); ?>">
<?php $template->the_action_template_message( 'profile' ); ?>
<?php $template->the_errors(); ?>
<form id="your-profile" action="<?php $template->the_action_url( 'profile', 'login_post' ); ?>" method="post">
<?php wp_nonce_field( 'update-user_' . $current_user->ID ); ?>
<input type="hidden" name="from" value="profile" />
<input type="hidden" name="checkuser_id" value="<?php echo $current_user->ID; ?>" />
<?php do_action( 'profile_personal_options', $profileuser ); ?>
<h3><?php _e( 'Name', 'theme-my-login' ); ?></h3>
<table class="tml-form-table">
<tr class="tml-user-login-wrap">
<th><label for="user_login"><?php _e( 'Username', 'theme-my-login' ); ?> (User ID Cannot be changed)</label></th>
<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /></td>
</tr>
<tr class="tml-user-email-wrap">
<th><label for="email"><?php _e( 'E-mail', 'theme-my-login' ); ?> <span class="description"><?php _e( '(required)', 'theme-my-login' ); ?></span></label></th>
<td><input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text" /></td>
<?php
$new_email = get_option( $current_user->ID . '_new_email' );
if ( $new_email && $new_email['newemail'] != $current_user->user_email ) : ?>
<div class="updated inline">
<p><?php
printf(
__( 'There is a pending change of your e-mail to %1$s. Cancel', 'theme-my-login' ),
'<code>' . $new_email['newemail'] . '</code>',
esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) )
); ?></p>
</div>
<?php endif; ?>
</tr>
<tr class="tml-first-name-wrap">
<th><label for="first_name"><?php _e( 'First Name', 'theme-my-login' ); ?></label></th>
<td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" /></td>
</tr>
<tr class="tml-last-name-wrap">
<th><label for="last_name"><?php _e( 'Last Name', 'theme-my-login' ); ?></label></th>
<td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" /></td>
</tr>
<tr class="tml-last-name-wrap">
<th><label for="language"><label for="user_phone<?php $template->the_instance(); ?>"><?php _e('Preferred Language'); ?></label></th>
<td><input type="text" name="user_phone" id="user_phone" value="<?php echo esc_attr( $profileuser->user_phone ); ?>" class="regular-text" />
</td>
</tr>
<input type="hidden" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" />
<?php
foreach ( wp_get_user_contact_methods() as $name => $desc ) {
?>
<tr class="tml-user-contact-method-<?php echo $name; ?>-wrap">
<th><label for="<?php echo $name; ?>"><?php echo apply_filters( 'user_'.$name.'_label', $desc ); ?></label></th>
<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ); ?>" class="regular-text" /></td>
</tr>
<?php
}
?>
<?php
$show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );
if ( $show_password_fields ) :
?>
<tr id="password" class="user-pass1-wrap">
<th><label for="pass1"><?php _e( 'New Password', 'theme-my-login' ); ?></label></th>
<td>
<input class="hidden" value=" " /><!-- #24364 workaround -->
<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Generate Password', 'theme-my-login' ); ?></button>
<div class="wp-pwd hide-if-js">
<span class="password-input-wrapper">
<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
</span>
<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password', 'theme-my-login' ); ?>">
<span class="dashicons dashicons-hidden"></span>
<span class="text"><?php _e( 'Hide', 'theme-my-login' ); ?></span>
</button>
<button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change', 'theme-my-login' ); ?>">
<span class="text"><?php _e( 'Cancel', 'theme-my-login' ); ?></span>
</button>
</div>
</td>
</tr>
<tr class="user-pass2-wrap hide-if-js">
<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password', 'theme-my-login' ); ?></label></th>
<td>
<input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" />
<p class="description"><?php _e( 'Type your new password again.', 'theme-my-login' ); ?></p>
</td>
</tr>
<tr class="pw-weak">
<th><?php _e( 'Confirm Password', 'theme-my-login' ); ?></th>
<td>
<label>
<input type="checkbox" name="pw_weak" class="pw-checkbox" />
<?php _e( 'Confirm use of weak password', 'theme-my-login' ); ?>
</label>
</td>
</tr>
<?php endif; ?>
</table>
<?php do_action( 'show_user_profile', $profileuser ); ?>
<p class="tml-submit-wrap">
<input type="hidden" name="action" value="profile" />
<input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $current_user->ID ); ?>" />
<input type="submit" class="button-primary" value="<?php esc_attr_e( 'Update Profile', 'theme-my-login' ); ?>" name="submit" id="submit" />
</p>
</form>
</div>

Registration page of opencart

I want to edit my register.tpl file of registration process of my opencart page.
I just want to keep the email, password and confirm password fields. When I remove all other fields including first name, last name, address etc and only leave in email, password and confirm password fields, it stops registration. How can I make it continue registration with only 3 fields and also agree to the terms check box I have to keep.
This is the register.tpl file
<div id="content"><?php echo $content_top; ?>
<h1><?php echo $heading_title; ?></h1>
<p><?php echo $text_account_already; ?></p>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
<h2><?php echo $text_your_details; ?></h2>
<div class="content">
<table class="form">
<tr>
<td><span class="required">*</span> <?php echo $entry_firstname; ?></td>
<td><input class="form-control" type="text" name="firstname" value="<?php echo $firstname; ?>" />
<?php if ($error_firstname) { ?>
<span class="error"><?php echo $error_firstname; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_lastname; ?></td>
<td><input class="form-control" type="text" name="lastname" value="<?php echo $lastname; ?>" />
<?php if ($error_lastname) { ?>
<span class="error"><?php echo $error_lastname; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_email; ?></td>
<td><input class="form-control" type="text" name="email" value="<?php echo $email; ?>" />
<?php if ($error_email) { ?>
<span class="error"><?php echo $error_email; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
<td><input class="form-control" type="text" name="telephone" value="<?php echo $telephone; ?>" />
<?php if ($error_telephone) { ?>
<span class="error"><?php echo $error_telephone; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><?php echo $entry_fax; ?></td>
<td><input class="form-control" type="text" name="fax" value="<?php echo $fax; ?>" /></td>
</tr>
</table>
</div>
<h2><?php echo $text_your_address; ?></h2>
<div class="content">
<table class="form">
<tr>
<td><?php echo $entry_company; ?></td>
<td><input class="form-control" type="text" name="company" value="<?php echo $company; ?>" /></td>
</tr>
<tr style="display: <?php echo (count($customer_groups) > 1 ? 'table-row' : 'none'); ?>;">
<td><?php echo $entry_customer_group; ?></td>
<td><?php foreach ($customer_groups as $customer_group) { ?>
<?php if ($customer_group['customer_group_id'] == $customer_group_id) { ?>
<input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" id="customer_group_id<?php echo $customer_group['customer_group_id']; ?>" checked="checked" />
<label for="customer_group_id<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></label>
<br />
<?php } else { ?>
<input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" id="customer_group_id<?php echo $customer_group['customer_group_id']; ?>" />
<label for="customer_group_id<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></label>
<br />
<?php } ?>
<?php } ?></td>
</tr>
<tr id="company-id-display">
<td><span id="company-id-required" class="required">*</span> <?php echo $entry_company_id; ?></td>
<td><input class="form-control" type="text" name="company_id" value="<?php echo $company_id; ?>" />
<?php if ($error_company_id) { ?>
<span class="error"><?php echo $error_company_id; ?></span>
<?php } ?></td>
</tr>
<tr id="tax-id-display">
<td><span id="tax-id-required" class="required">*</span> <?php echo $entry_tax_id; ?></td>
<td><input class="form-control" type="text" name="tax_id" value="<?php echo $tax_id; ?>" />
<?php if ($error_tax_id) { ?>
<span class="error"><?php echo $error_tax_id; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_address_1; ?></td>
<td><input class="form-control" type="text" name="address_1" value="<?php echo $address_1; ?>" />
<?php if ($error_address_1) { ?>
<span class="error"><?php echo $error_address_1; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><?php echo $entry_address_2; ?></td>
<td><input class="form-control" type="text" name="address_2" value="<?php echo $address_2; ?>" /></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_city; ?></td>
<td><input class="form-control" type="text" name="city" value="<?php echo $city; ?>" />
<?php if ($error_city) { ?>
<span class="error"><?php echo $error_city; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span id="postcode-required" class="required">*</span> <?php echo $entry_postcode; ?></td>
<td><input class="form-control" type="text" name="postcode" value="<?php echo $postcode; ?>" />
<?php if ($error_postcode) { ?>
<span class="error"><?php echo $error_postcode; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_country; ?></td>
<td><select class="form-control" name="country_id">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($countries as $country) { ?>
<?php if ($country['country_id'] == $country_id) { ?>
<option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
<?php if ($error_country) { ?>
<span class="error"><?php echo $error_country; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_zone; ?></td>
<td><select class="form-control" name="zone_id">
</select>
<?php if ($error_zone) { ?>
<span class="error"><?php echo $error_zone; ?></span>
<?php } ?></td>
</tr>
</table>
</div>
<h2><?php echo $text_your_password; ?></h2>
<div class="content">
<table class="form">
<tr>
<td><span class="required">*</span> <?php echo $entry_password; ?></td>
<td><input class="form-control" type="password" name="password" value="<?php echo $password; ?>" />
<?php if ($error_password) { ?>
<span class="error"><?php echo $error_password; ?></span>
<?php } ?></td>
</tr>
<tr>
<td><span class="required">*</span> <?php echo $entry_confirm; ?></td>
<td><input class="form-control" type="password" name="confirm" value="<?php echo $confirm; ?>" />
<?php if ($error_confirm) { ?>
<span class="error"><?php echo $error_confirm; ?></span>
<?php } ?></td>
</tr>
</table>
</div>
<h2><?php echo $text_newsletter; ?></h2>
<div class="content">
<table class="form">
<tr>
<td><?php echo $entry_newsletter; ?></td>
<td><?php if ($newsletter) { ?>
<input type="radio" name="newsletter" value="1" checked="checked" />
<?php echo $text_yes; ?>
<input type="radio" name="newsletter" value="0" />
<?php echo $text_no; ?>
<?php } else { ?>
<input type="radio" name="newsletter" value="1" />
<?php echo $text_yes; ?>
<input type="radio" name="newsletter" value="0" checked="checked" />
<?php echo $text_no; ?>
<?php } ?></td>
</tr>
</table>
</div>
<?php if ($text_agree) { ?>
<div class="buttons">
<div class="right"><?php echo $text_agree; ?>
<?php if ($agree) { ?>
<input type="checkbox" name="agree" value="1" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="agree" value="1" />
<?php } ?>
<input type="submit" value="<?php echo $button_continue; ?>" class="button" />
</div>
</div>
<?php } else { ?>
<div class="buttons">
<div class="right">
<input type="submit" value="<?php echo $button_continue; ?>" class="button" />
</div>
</div>
<?php } ?>
</form>
<?php echo $content_bottom; ?></div>
Go to catalog/controller/account/register.php (controller) and into the function validate(). Remove the unnecessary fields. Then remove the fields from your tpl. In this way, you will be able to proceed with only three fields.

How to fix this Wordpress widget

could anyone help me , how to make this widget working? It is copied from original code but there were many widgets in one file. I cuted only this one because i need this one standalone.
I cant load it as plugin.
Here is code:
<?php
/**
----> Custom Pricing Box Widget
**/
add_action( 'widgets_init', 'load_pricing_box_widget' );
function load_pricing_box_widget() {
register_widget( 'Price_Box' );
}
class Price_Box extends WP_Widget {
function Price_Box() {
$widget_ops = array( 'classname' => 'plan', 'description' => __('Custom Pricing box widget - for the Home-Page only!', 'example') );
$control_ops = array( 'width' => 300, 'height' => 550, 'id_base' => 'pricing-box' );
$this->WP_Widget( 'pricing-box', __('Bluz Themes - Pricing Box', 'example'), $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title']);
$content = $instance['content'];
$price = $instance['price'];
$longer = $instance['longer'];
$per = $instance['per'];
$button_link = $instance['button_link'];
$button_color = $instance['button_color'];
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '<div class="content">';
if ( $longer ) { echo '<div class="price" style="font-size:20px;">'; } else {echo '<div class="price">';}
echo '<div class="inside">';
echo $price.'<br><span>'.$per.'</span>';
echo '</div>';
echo 'Order Now!';
echo '</div>';
if ( $content )
printf( '%1$s' , $content );
echo '</div>';
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip tags for title and name to remove HTML (important for text inputs). */
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['content'] = stripslashes( $new_instance['content'] );
$instance['price'] = strip_tags( $new_instance['price'] );
$instance['longer'] = $new_instance['longer'];
$instance['per'] = strip_tags($new_instance['per']);
$instance['button_link'] = strip_tags($new_instance['button_link']);
$instance['button_color'] = $new_instance['button_color'];
return $instance;
}
function form( $instance ) {
$defaults = array( 'title' => __('Pricing Box Title', 'example'), 'content' => __('This is our pricing box content, you can use html to style it', 'example'), 'button_color' => __('red', 'example'));
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<!-- Widget Title: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Pricing Box Title:', 'hybrid'); ?></label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Your Content: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'content' ); ?>"><?php _e('Content (You can use HTML):', 'example'); ?></label>
<textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" type="textarea" cols="12" rows="12" class="widefat" ><?php echo $instance['content']; ?></textarea>
</p>
<!-- Widget Price: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'price' ); ?>"><?php _e('Price:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'price' ); ?>" name="<?php echo $this->get_field_name( 'price' ); ?>" value="<?php echo $instance['price']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Widget Per: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'per' ); ?>"><?php _e('Price Per... <em>(examples: /month, /year, /day)</em>:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'per' ); ?>" name="<?php echo $this->get_field_name( 'per' ); ?>" value="<?php echo $instance['per']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Price Longer? Checkbox -->
<p>
<input class="checkbox" type="checkbox" <?php if( $instance['longer'] == true ) { ?>checked="checked"<?php } ?> id="<?php echo $this->get_field_id( 'longer' ); ?>" name="<?php echo $this->get_field_name( 'longer' ); ?>" />
<label for="<?php echo $this->get_field_id( 'longer' ); ?>"><?php _e('<strong>Check this if your price is longer the 2 Didgets</strong>', 'example'); ?></label>
</p>
<!-- Widget Button Link: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'button_link' ); ?>"><?php _e('The url you want the "order now!" button to link to:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'button_link' ); ?>" name="<?php echo $this->get_field_name( 'button_link' ); ?>" value="<?php echo $instance['button_link']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Button Color: Select Box -->
<p>
<label for="<?php echo $this->get_field_id( 'button_color' ); ?>"><?php _e('Choose a color for the "order now!" button <em>(default color is red)</em>:', 'example'); ?></label>
<select id="<?php echo $this->get_field_id( 'button_color' ); ?>" name="<?php echo $this->get_field_name( 'button_color' ); ?>" class="widefat" style="width:100%;">
<option <?php if ( 'red' == $instance['button_color'] ) echo 'selected="selected"'; ?>>red</option>
<option <?php if ( 'orange' == $instance['button_color'] ) echo 'selected="selected"'; ?>>orange</option>
<option <?php if ( 'green' == $instance['button_color'] ) echo 'selected="selected"'; ?>>green</option>
<option <?php if ( 'blue' == $instance['button_color'] ) echo 'selected="selected"'; ?>>blue</option>
<option <?php if ( 'grey' == $instance['button_color'] ) echo 'selected="selected"'; ?>>grey</option>
<option <?php if ( 'black' == $instance['button_color'] ) echo 'selected="selected"'; ?>>black</option>
<option <?php if ( 'special' == $instance['button_color'] ) echo 'selected="selected"'; ?>>special</option>
</select>
</p>
?>
Update your code like this instead of your post code .
<?php
/**
----> Custom Pricing Box Widget
**/
add_action( 'widgets_init', 'load_pricing_box_widget' );
function load_pricing_box_widget() {
register_widget( 'Price_Box' );
}
class Price_Box extends WP_Widget {
function Price_Box() {
$widget_ops = array( 'classname' => 'plan', 'description' => __('Custom Pricing box widget - for the Home-Page only!', 'example') );
$control_ops = array( 'width' => 300, 'height' => 550, 'id_base' => 'pricing-box' );
$this->WP_Widget( 'pricing-box', __('Bluz Themes - Pricing Box', 'example'), $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title']);
$content = $instance['content'];
$price = $instance['price'];
$longer = $instance['longer'];
$per = $instance['per'];
$button_link = $instance['button_link'];
$button_color = $instance['button_color'];
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '<div class="content">';
if ( $longer ) { echo '<div class="price" style="font-size:20px;">'; } else {echo '<div class="price">';}
echo '<div class="inside">';
echo $price.'<br><span>'.$per.'</span>';
echo '</div>';
echo 'Order Now!';
echo '</div>';
if ( $content )
printf( '%1$s' , $content );
echo '</div>';
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip tags for title and name to remove HTML (important for text inputs). */
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['content'] = stripslashes( $new_instance['content'] );
$instance['price'] = strip_tags( $new_instance['price'] );
$instance['longer'] = $new_instance['longer'];
$instance['per'] = strip_tags($new_instance['per']);
$instance['button_link'] = strip_tags($new_instance['button_link']);
$instance['button_color'] = $new_instance['button_color'];
return $instance;
}
function form( $instance ) {
$defaults = array( 'title' => __('Pricing Box Title', 'example'), 'content' => __('This is our pricing box content, you can use html to style it', 'example'), 'button_color' => __('red', 'example'));
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<!-- Widget Title: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Pricing Box Title:', 'hybrid'); ?></label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Your Content: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'content' ); ?>"><?php _e('Content (You can use HTML):', 'example'); ?></label>
<textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" type="textarea" cols="12" rows="12" class="widefat" ><?php echo $instance['content']; ?></textarea>
</p>
<!-- Widget Price: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'price' ); ?>"><?php _e('Price:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'price' ); ?>" name="<?php echo $this->get_field_name( 'price' ); ?>" value="<?php echo $instance['price']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Widget Per: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'per' ); ?>"><?php _e('Price Per... <em>(examples: /month, /year, /day)</em>:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'per' ); ?>" name="<?php echo $this->get_field_name( 'per' ); ?>" value="<?php echo $instance['per']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Price Longer? Checkbox -->
<p>
<input class="checkbox" type="checkbox" <?php if( $instance['longer'] == true ) { ?>checked="checked"<?php } ?> id="<?php echo $this->get_field_id( 'longer' ); ?>" name="<?php echo $this->get_field_name( 'longer' ); ?>" />
<label for="<?php echo $this->get_field_id( 'longer' ); ?>"><?php _e('<strong>Check this if your price is longer the 2 Didgets</strong>', 'example'); ?></label>
</p>
<!-- Widget Button Link: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'button_link' ); ?>"><?php _e('The url you want the "order now!" button to link to:', 'example'); ?></label>
<input id="<?php echo $this->get_field_id( 'button_link' ); ?>" name="<?php echo $this->get_field_name( 'button_link' ); ?>" value="<?php echo $instance['button_link']; ?>" style="width:97%;" class="widefat" />
</p>
<!-- Button Color: Select Box -->
<p>
<label for="<?php echo $this->get_field_id( 'button_color' ); ?>"><?php _e('Choose a color for the "order now!" button <em>(default color is red)</em>:', 'example'); ?></label>
<select id="<?php echo $this->get_field_id( 'button_color' ); ?>" name="<?php echo $this->get_field_name( 'button_color' ); ?>" class="widefat" style="width:100%;">
<option <?php if ( 'red' == $instance['button_color'] ) echo 'selected="selected"'; ?>>red</option>
<option <?php if ( 'orange' == $instance['button_color'] ) echo 'selected="selected"'; ?>>orange</option>
<option <?php if ( 'green' == $instance['button_color'] ) echo 'selected="selected"'; ?>>green</option>
<option <?php if ( 'blue' == $instance['button_color'] ) echo 'selected="selected"'; ?>>blue</option>
<option <?php if ( 'grey' == $instance['button_color'] ) echo 'selected="selected"'; ?>>grey</option>
<option <?php if ( 'black' == $instance['button_color'] ) echo 'selected="selected"'; ?>>black</option>
<option <?php if ( 'special' == $instance['button_color'] ) echo 'selected="selected"'; ?>>special</option>
</select>
</p>
<?php }
}
?>
Becuase you never end your function name and there class name .

POST from inside Form

how can I put value of text into the selector inside the form? I need to post text with name=sum into <option value="<?php echo $met->request; ?>"<?php if (isset($method) && $method == $met->request && $currentMethod = $met) { echo ' selected="selected"'; $shownext = true; } ?>><?php echo "$met->description - $met->full_summ $met->valute"; ?></option>
This is my form
<form id="com_telecomax_buydid" action="
<?php echo JRoute::_('index.php',true); ?>" method="post" onsubmit="return telecomax.complete;">
<input type="hidden" name="option" value="com_telecomax" />
<input type="hidden" name="task" value="payment" />
<h3>
<?php if (isset($cart) && $cart) {?>
<p><?php echo JText::_('COM_TELECOMAX_TOTAL_COST_OF_YOUR_CART'); ?>:<span id="com_telecomax_payment_cart_text"><?php echo $cart.' '.JText::_('COM_TELECOMAX_USD'); ?></span></p>
<?php } ?>
<input type="hidden" name="cart" id="com_telecomax_payment_cart" value="<?php echo isset($cart) && $cart ? 1 : ''; ?>" />
<p><label for="com_telecomax_payment_sum"><?php echo JText::_($cart ? 'COM_TELECOMAX_ADDITIONAL_PAY_FOR_TALK' : 'COM_TELECOMAX_DEPOSIT_FUNDS'); ?>:</label>
<input type="text" class="inp-txt" name="sum" id="com_telecomax_payment_sum" value="<?php echo isset($sum) && $sum ? $sum : $default; ?>" /></p>
<p><?php echo JText::_('COM_TELECOMAX_TOTAL_PAYMENT'); ?>:<span id="com_telecomax_payment_total">
<?php echo isset($sum) && $sum ? $sum : $default; ?>
</span> <?php echo JText::_('COM_TELECOMAX_USD'); ?></p>
</h3>
<p><input type="button" id="com_telecomax_payment_getmethod" value="<?php echo JText::_('COM_TELECOMAX_GET_PAYMENT_METHOD'); ?>" />
<p><label for="com_telecomax_payment_method"><?php echo JText::_('COM_TELECOMAX_PAYMENT_METHOD'); ?>:</label></p>
<p><select name="method" id="com_telecomax_payment_method">
<option value=""<?php if (!isset($method) || !$method) echo ' selected="selected"'; ?> disabled="disabled"><?php echo JText::_('COM_TELECOMAX_PLEASE_SELECT_PAYMENT_METHOD'); ?></option>
<?php foreach($this->methods['data'] as $item) { ?>
<optgroup label="<?php echo $item['title']; ?>">
<?php foreach($item['list'] as $met) { ?>
<option value="<?php echo $met->request; ?>"<?php if (isset($method) && $method == $met->request && $currentMethod = $met) { echo ' selected="selected"'; $shownext = true; } ?>><?php echo "$met->description - $met->full_summ $met->valute"; ?></option>
<?php } ?>
</optgroup>
<?php }
?>
</select><input type="hidden" name="paysum" id="com_telecomax_payment_paysum" value="<?php echo isset($currentMethod) ? "$currentMethod->description#$currentMethod->full_summ#$currentMethod->valute" : '##'; ?>" /></p>
<p>
<?php if (isset($cart) && $cart) { ?>
<input type="button" value="<?php echo JText::_('COM_TELECOMAX_BACK'); ?>" onclick="location.href='<?php echo JRoute::_('index.php?option=com_telecomax&task=cart',true); ?>'; return false;" />
<?php } ?>
<input type="submit" value="<?php echo JText::_('COM_TELECOMAX_NEXT'); ?>" id="com_telecomax_payment_next" style="display: <?php echo isset($shownext) ? 'block' : 'none' ; ?>;" />
</p>
</form>

How to change position of product options?

Is there a way to change position of product options? I want to show options below product quantity.
I tried to call wrapper.phtml in app/design/frontend/gallins/default/template/catalog/product/view/addtocart.phtml but couldn't get it to work.
What I have right now is:
- option
- qty
- add to cart button
But I wan't options to be shown below qty.
addtocart.phtml ->
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if ($_product->isSaleable()): ?>
<div class="add-to-cart">
<?php if (!$_product->isGrouped()): ?>
<div class="quantity">
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<div class="clear"></div>
</div>
<?php endif; ?>
<!-- This is where I want to show options -->
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml('', true, true) ?>
</div>
I tried <?php echo $this->getChildHtml('wrapper'), but that didn't work.
you have to make 2 changes in 2 files as if you have product options then
in addtocart.phtml
<?php $_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>
<div class="add-to-cart">
<?php if(!$_product->isGrouped()): ?>
<?php if (count($_attributes) == 0):?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<?php endif; ?>
<?php endif; ?>
<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml('', true, true) ?>
</div>
<?php endif; ?>
and Please also change in options\configurable.phtml file change like below
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<label for="qty"><?php echo $this->__('Qty:') ?></label>
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<dl>
<?php foreach($_attributes as $_attribute): ?>
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</div>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
</script>
<?php endif;?>
let me know if i can help you more.

Categories