function pp_admin_init()
{
    register_column_headers('projects', array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'prologue-projects'), 'description' => __('Description', 'prologue-projects'), 'slug' => __('Slug', 'prologue-projects'), 'posts' => __('Posts', 'prologue-projects')));
    // If we needed to load a javascript dependancy for the theme, this is how it should be done.
    //$template_dir = basename( dirname( __FILE__ ) );
    //wp_register_script( 'admin-projects', get_theme_root_uri() . '/' . $template_dir . '/js/projects.js', array('wp-lists'), '20090210' );
}
Exemplo n.º 2
0
function filebrowser_menu_entry()
{
    $hook = add_management_page(__('FileBrowser', 'filebrowser'), __('FileBrowser', 'filebrowser'), '10', 'FileBrowser', 'filebrowser_options_page');
    add_action('load-' . $hook, 'filebrowser_options_load');
    register_column_headers($hook, array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'filebrowser'), 'size' => __('Size', 'filebrowser'), 'mdate' => __('Date', 'filebrowser'), 'premissions' => __('Permissions', 'filebrowser')));
    add_contextual_help($hook, filebrowser_show_help());
}
Exemplo n.º 3
0
 public function __construct()
 {
     global $wpdb;
     $this->require_register = get_option('require_register', 0);
     $this->shipping_same_as_billing = get_option('shippingsameasbilling', 0);
     $this->force_ssl = get_option('wpsc_force_ssl', 0);
     $this->checkout_sets = get_option('wpsc_checkout_form_sets');
     $this->current_checkout_set = empty($_GET['checkout_set']) ? 0 : $_GET['checkout_set'];
     $this->field_types = get_option('wpsc_checkout_form_fields');
     $this->user_field_types = array('text', 'textarea', 'heading', 'select', 'radio', 'checkbox');
     $form_sql = $wpdb->prepare("\n\t\t\tSELECT *\n\t\t\tFROM " . WPSC_TABLE_CHECKOUT_FORMS . "\n\t\t\tWHERE checkout_set = %s\n\t\t\tORDER BY checkout_order\n\t\t", $this->current_checkout_set);
     $this->form_fields = $wpdb->get_results($form_sql);
     $columns = array('drag' => __('Drag', 'wpsc'), 'name' => __('Title', 'wpsc'), 'type' => __('Type', 'wpsc'), 'unique_name' => '&nbsp;', 'display' => __('Display', 'wpsc'), 'mandatory' => __('Mandatory', 'wpsc'), 'actions' => '&nbsp;');
     register_column_headers('display-checkout-list', $columns);
 }
function wpsc_additional_column_name_variations($columns)
{
    global $post;
    if (isset($post) && $post->post_parent != '0') {
        remove_meta_box('wpsc_product_variation_forms', 'wpsc-product', 'normal');
    }
    $columns['image'] = '';
    $columns['title'] = __('Name', 'wpsc');
    $columns['weight'] = __('Weight', 'wpsc');
    $columns['stock'] = __('Stock', 'wpsc');
    $columns['price'] = __('Price', 'wpsc');
    $columns['sale_price'] = __('Sale Price', 'wpsc');
    $columns['SKU'] = __('SKU', 'wpsc');
    $columns['hidden_alerts'] = '';
    //For BC for 3.0 (hoping to remove for WPEC 3.9)
    register_column_headers('wpsc-product_variants', $columns);
    return apply_filters('wpsc_variation_column_headers', $columns);
}
Exemplo n.º 5
0
 public function layout()
 {
     register_column_headers($this->id, array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'discount' => __('Discount', 'Shopp'), 'applied' => __('Type', 'Shopp'), 'eff' => __('Status', 'Shopp')));
 }
Exemplo n.º 6
0
 public function pages_ui()
 {
     register_column_headers('shopp_page_shopp-settings-pages', array('title' => __('Title', 'Shopp'), 'slug' => __('Slug', 'Shopp'), 'decription' => __('Description', 'Shopp')));
 }
Exemplo n.º 7
0
 /**
  * Registers the column headers for the orders list interface
  *
  * Uses the WordPress 2.7 function register_column_headers to provide
  * customizable columns that can be toggled to show or hide
  *
  * @author Jonathan Davis
  * @return void
  **/
 public function columns()
 {
     shopp_enqueue_script('calendar');
     shopp_enqueue_script('daterange');
     register_column_headers($this->screen, array('cb' => '<input type="checkbox" />', 'order' => __('Order', 'Shopp'), 'name' => __('Name', 'Shopp'), 'destination' => __('Destination', 'Shopp'), 'txn' => __('Transaction', 'Shopp'), 'date' => __('Date', 'Shopp'), 'total' => __('Total', 'Shopp')));
 }
Exemplo n.º 8
0
 /**
  * Registers the column headers for the customer list screen
  *
  * @author Jonathan Davis
  * @return void
  **/
 public function layout()
 {
     register_column_headers($this->id, array('cb' => '<input type="checkbox" />', 'customer-name' => Shopp::__('Name'), 'customer-login' => Shopp::__('Login'), 'email' => Shopp::__('Email'), 'customer-location' => Shopp::__('Location'), 'customer-orders' => Shopp::__('Orders'), 'customer-joined' => Shopp::__('Joined')));
 }
Exemplo n.º 9
0
/**
 * WP eCommerce edit and add product page functions
 *
 * These are the main WPSC Admin functions
 *
 * @package wp-e-commerce
 * @since 3.7
 */
function wpsc_display_edit_products_page()
{
    global $wpdb;
    $category_id = absint($_GET['category_id']);
    $columns = array('cb' => '<input type="checkbox" />', 'image' => 'Name', 'title' => '', 'price' => 'Price', 'categories' => 'Categories');
    register_column_headers('display-product-list', $columns);
    $baseurl = includes_url('js/tinymce');
    ?>
	<div class="wrap">
		<?php 
    // screen_icon();
    ?>
		<h2><?php 
    echo wp_specialchars(__('Display Products', 'wpsc'));
    ?>
 </h2>
		
		<?php 
    if (isset($_GET['ErrMessage']) && is_array($_SESSION['product_error_messages'])) {
        ?>
				<div id="message" class="error fade">
					<p>
						<?php 
        foreach ($_SESSION['product_error_messages'] as $error) {
            echo $error;
        }
        ?>
					</p>
				</div>
				<?php 
        unset($_GET['ErrMessage']);
        ?>
				<?php 
        $_SESSION['product_error_messages'] = '';
        ?>
		<?php 
    }
    ?>
			
		<?php 
    if (isset($_GET['flipped']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['message']) || isset($_GET['duplicated'])) {
        ?>
			<div id="message" class="updated fade">
				<p>
				<?php 
        if (isset($_GET['updated'])) {
            printf(__ngettext('%s product updated.', '%s products updated.', $_GET['updated']), number_format_i18n($_GET['updated']));
            unset($_GET['updated']);
        }
        if (isset($_GET['flipped'])) {
            printf(__ngettext('%s product updated.', '%s products updated.', $_GET['flipped']), number_format_i18n($_GET['flipped']));
            unset($_GET['flipped']);
        }
        if (isset($_GET['skipped'])) {
            unset($_GET['skipped']);
        }
        if (isset($_GET['deleted'])) {
            printf(__ngettext('Product deleted.', '%s products deleted.', $_GET['deleted']), number_format_i18n($_GET['deleted']));
            unset($_GET['deleted']);
        }
        if (isset($_GET['duplicated'])) {
            printf(__ngettext('Product duplicated.', '%s products duplicated.', $_GET['duplicated']), number_format_i18n($_GET['duplicated']));
            unset($_GET['duplicated']);
        }
        if (isset($_GET['message'])) {
            $message = absint($_GET['message']);
            $messages[1] = __('Product updated.');
            echo $messages[$message];
            unset($_GET['message']);
        }
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'message', 'duplicated'), $_SERVER['REQUEST_URI']);
        ?>
			</p>
		</div>
		<?php 
    }
    ?>
		
		<?php 
    $unwriteable_directories = array();
    if (!is_writable(WPSC_FILE_DIR)) {
        $unwriteable_directories[] = WPSC_FILE_DIR;
    }
    if (!is_writable(WPSC_PREVIEW_DIR)) {
        $unwriteable_directories[] = WPSC_PREVIEW_DIR;
    }
    if (!is_writable(WPSC_IMAGE_DIR)) {
        $unwriteable_directories[] = WPSC_IMAGE_DIR;
    }
    if (!is_writable(WPSC_THUMBNAIL_DIR)) {
        $unwriteable_directories[] = WPSC_THUMBNAIL_DIR;
    }
    if (!is_writable(WPSC_CATEGORY_DIR)) {
        $unwriteable_directories[] = WPSC_CATEGORY_DIR;
    }
    if (!is_writable(WPSC_UPGRADES_DIR)) {
        $unwriteable_directories[] = WPSC_UPGRADES_DIR;
    }
    if (count($unwriteable_directories) > 0) {
        echo "<div class='error fade'>" . str_replace(":directory:", "<ul><li>" . implode($unwriteable_directories, "</li><li>") . "</li></ul>", __('The following directories are not writable: :directory: You won&#39;t be able to upload any images or files here. You will need to change the permissions on these directories to make them writable.', 'wpsc')) . "</div>";
    }
    // class='stuffbox'
    ?>
		
		<div id="col-container">
			<div id="wpsc-col-right">			
				<div id='poststuff' class="col-wrap">
					<form id="modify-products" method="post" action="" enctype="multipart/form-data" >
					<?php 
    $product_id = absint($_GET['product_id']);
    wpsc_display_product_form($product_id);
    ?>
					</form>
				</div>
			</div>
			
			<div id="wpsc-col-left">
				<div class="col-wrap">		
					<?php 
    wpsc_admin_products_list($category_id);
    ?>
				</div>
			</div>
		</div>

	</div>
	<script type="text/javascript">
	/* <![CDATA[ */
	(function($){
		$(document).ready(function(){
			$('#doaction, #doaction2').click(function(){
				if ( $('select[name^="action"]').val() == 'delete' ) {
					var m = '<?php 
    echo js_escape(__("You are about to delete the selected products.\n  'Cancel' to stop, 'OK' to delete."));
    ?>
';
					return showNotice.warn(m);
				}
			});
		});
	})(jQuery);
	/* ]]> */
	</script>
	<?php 
}
/**
 * WP eCommerce edit and add variation group page functions
 *
 * These are the main WPSC Admin functions
 *
 * @package wp-e-commerce
 * @since 3.7
 */
function wpsc_display_variations_page()
{
    $columns = array('title' => __('Name', 'wpsc'), 'edit' => __('Edit', 'wpsc'));
    register_column_headers('display-variations-list', $columns);
    ?>
	<script language='javascript' type='text/javascript'>
		function conf() {
			var check = confirm("<?php 
    echo __('Are you sure you want to delete this product?', 'wpsc');
    ?>
");
			if(check) {
				return true;
			} else {
				return false;
			}
		}
		
		<?php 
    ?>
	</script><noscript>
	</noscript>
	
	<div class="wrap">
		<?php 
    ?>
<?php// screen_icon(); ?>
		<h2><?php 
    echo wp_specialchars(__('Display Variations', 'wpsc'));
    ?>
 </h2>
		<p>	
				<?php 
    echo __('A variation can be anything "optional" about a product. ie: Size, Color, etc <br />For example: if you are selling t-shirts you might setup a variation set called size with the values small, medium, large...', 'wpsc');
    ?>
		</p>
  
		
		<?php 
    if (isset($_GET['deleted']) || isset($_GET['message'])) {
        ?>
			<div id="message" class="updated fade">
				<p>
				<?php 
        if (isset($_GET['message'])) {
            $message = absint($_GET['message']);
            $messages[1] = __('Product updated.');
            echo $messages[$message];
            unset($_GET['message']);
        }
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted', 'message'), $_SERVER['REQUEST_URI']);
        ?>
			</p>
		</div>
		<?php 
    }
    ?>
				
		<div id="col-container" class=''>
			<div id="col-right">			
				<div id='poststuff' class="col-wrap">
					<form id="modify-variation-groups" method="post" action="" enctype="multipart/form-data" >
					<?php 
    //$product_id = absint($_GET['product_id']);
    //wpsc_display_product_form($product_id);
    wpsc_admin_variation_forms($_GET['variation_id']);
    ?>
					</form>
				</div>
			</div>
			
			<div id="col-left">
				<div class="col-wrap">		
					<?php 
    wpsc_admin_variation_group_list($category_id);
    ?>
				</div>
			</div>
		</div>
				
				
	</div>
	<?php 
}
Exemplo n.º 11
0
 public function controller_packing_slip()
 {
     if (!isset($_REQUEST['id'])) {
         die('Invalid sales log ID');
     }
     global $purchlogitem;
     $this->log_id = (int) $_REQUEST['id'];
     $purchlogitem = new wpsc_purchaselogs_items($this->log_id);
     $columns = array('title' => __('Item Name', 'wpsc'), 'sku' => __('SKU', 'wpsc'), 'quantity' => __('Quantity', 'wpsc'), 'price' => __('Price', 'wpsc'), 'shipping' => __('Item Shipping', 'wpsc'));
     if (wpec_display_product_tax()) {
         $columns['tax'] = __('Item Tax', 'wpsc');
     }
     $columns['total'] = __('Item Total', 'wpsc');
     $cols = count($columns) - 2;
     register_column_headers('wpsc_purchase_log_item_details', $columns);
     include 'includes/purchase-logs-page/packing-slip.php';
     exit;
 }
Exemplo n.º 12
0
 public function payments_ui()
 {
     register_column_headers('shopp_page_shopp-settings-payments', array('name' => __('Name', 'Shopp'), 'processor' => __('Processor', 'Shopp'), 'payments' => __('Payments', 'Shopp'), 'ssl' => __('SSL', 'Shopp'), 'captures' => __('Captures', 'Shopp'), 'recurring' => __('Recurring', 'Shopp'), 'refunds' => __('Refunds', 'Shopp')));
 }
Exemplo n.º 13
0
	function inventory_cols () {
		register_column_headers('ecart_page_ecart-products', array(
			'inventory'=>__('Inventory','Ecart'),
			'sku'=>__('SKU','Ecart'),
			'name'=>__('Name','Ecart'))
		);
	}
Exemplo n.º 14
0
 /**
  * Registers the column headers for the customer list screen
  *
  * @author Jonathan Davis
  * @return void
  **/
 function columns()
 {
     shopp_enqueue_script('calendar');
     register_column_headers('shopp_page_shopp-memberships', array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'type' => __('Type', 'Shopp'), 'products' => __('Products', 'Shopp'), 'members' => __('Members', 'Shopp')));
 }
Exemplo n.º 15
0
/**
 * Add a review of a specific release.
 *
 * @return void
 */
function ribcage_manage_reviews()
{
    global $releases, $release, $artist, $tracks, $track;
    $release = get_release($_REQUEST['release'], false, true);
    $reviews = $release['release_reviews'];
    $artist['artist_name'] = get_artistname_by_id($release['release_artist']);
    ?>
        <div class="wrap">
		<h2>Manage Reviews of <?php 
    artist_name();
    ?>
 - <?php 
    release_title();
    ?>
</h2>
        <?php 
    if (count($reviews) == 0) {
        echo "<p>No reviews yet. Why not add one now?</p>";
    } else {
        register_column_headers('ribcage-manage-reviews', array('cb' => '<input type="checkbox" />', 'review_' => 'Reviewer'));
        echo "<pre>" . print_r($reviews) . "</pre>";
    }
    ?>
                <h3>Add a review</h3>
                <table class="form-table">
                <tr valign="top">
                    <th scope="row"><label for="review_url">Review URL</label></th>
                    <td><input type="text" name="review_url" value="" class="regular-text code"/><span class="description">The URL of the review, if the review is online.</span>								</td>
		</tr>
		<tr valign="top">
                    <th scope="row"><label for="review_url">Publication</label></th>
                    <td><input type="text" name="review_url" value="" class="regular-text code"/><span class="description">The name of the publication that reviewed the release</span>
					</td>
				</tr>
		</table>
		<p class="submit">
                    <input type="submit" name="Submit" class="button-primary" value="Add Review" />
                </p>
		</form>
        </div>
        <?php 
}
Exemplo n.º 16
0
        }
    }
    //php method of loading the contact form
    if (!function_exists('getSubscriptions')) {
        function getSubscriptions()
        {
            global $byrdRoles;
            $byrdRoles->getSubscriptions();
        }
    }
    //filter replace the user input in the posts with the subscriptions
    add_filter('the_content', array(&$byrdRoles, 'contentFilters'));
    add_filter('manage_users_custom_column', array(&$byrdRoles, 'user_columns'), 10, 3);
    //adding a column header to the users table
    $columns = get_column_headers('users');
    //display the users expiration data
    if ($byrdRoles->displayexpirationdata) {
        $columns['subscription_expiration'] = 'Sub. Expiration';
        $columns['subscription_startdate'] = 'Started Sub.';
        $columns['subscription_name'] = 'Item Name';
    }
    //display the users address information
    if ($byrdRoles->displayusersaddress) {
        $columns['subscription_streetaddress'] = 'Street Address';
        $columns['subscription_city'] = 'City';
        $columns['subscription_state'] = 'State';
        $columns['subscription_zip'] = 'Zip';
        $columns['subscription_country'] = 'Country';
    }
    register_column_headers('users', $columns);
}
Exemplo n.º 17
0
	/**
	 * Registers the column headers for the orders list interface
	 *
	 * Uses the WordPress 2.7 function register_column_headers to provide
	 * customizable columns that can be toggled to show or hide
	 *	 
	 * @return void
	 **/
	function columns () {
		ecart_enqueue_script('calendar');
		register_column_headers('toplevel_page_ecart-orders', array(
			'cb'=>'<input type="checkbox" />',
			'order'=>__('Order','Ecart'),
			'name'=>__('Name','Ecart'),
			'destination'=>__('Destination','Ecart'),
			'txn'=>__('Transaction','Ecart'),
			'date'=>__('Date','Ecart'),
			'total'=>__('Total','Ecart'))
		);
	}
Exemplo n.º 18
0
function wpsc_options_checkout()
{
    global $wpdb;
    $form_types = get_option('wpsc_checkout_form_fields');
    $unique_names = get_option('wpsc_checkout_unique_names');
    do_action('wpsc_checkout_form_fields_page');
    $columns = array('drag' => __('Drag', 'wpsc'), 'name' => __('Name', 'wpsc'), 'type' => __('Type', 'wpsc'), 'unique_names' => __('Unique Names', 'wpsc'), 'mandatory' => __('Mandatory', 'wpsc'), 'trash' => __('Trash', 'wpsc'));
    register_column_headers('display-checkout-list', $columns);
    ?>

<form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
	<div class="wrap">
		<?php 
    /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
    wpsc_settings_page_update_notification();
    ?>

		<form method='post' action='' id='chekcout_options_tbl' class='wpsc_form_track'>
		<div class='metabox-holder' style='width:95%;'>
			<div class='postbox'>
			<input type='hidden' name='checkout_submits' value='true' />
			<h3 class='hndle'><?php 
    _e('Misc Checkout Options', 'wpsc');
    ?>
</h3>
			<div class='inside'>
			<table>
			<tr>
				<td><?php 
    _e('Users must register before checking out', 'wpsc');
    ?>
:</td>
				<td>
					<?php 
    $require_register = esc_attr(get_option('require_register'));
    $require_register1 = "";
    $require_register2 = "";
    switch ($require_register) {
        case 0:
            $require_register2 = "checked ='checked'";
            break;
        case 1:
            $require_register1 = "checked ='checked'";
            break;
    }
    ?>
						<input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php 
    echo $require_register1;
    ?>
 /> 					<label for='require_register1'><?php 
    _e('Yes', 'wpsc');
    ?>
</label> &nbsp;
						<input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php 
    echo $require_register2;
    ?>
 /> 					<label for='require_register2'><?php 
    _e('No', 'wpsc');
    ?>
</label>
					</td>
					<td>
						<a title='<?php 
    _e('If yes then you must also turn on the wordpress option "Any one can register"', 'wpsc');
    ?>
' class='flag_email' href='#' ><img src='<?php 
    echo WPSC_CORE_IMAGES_URL;
    ?>
/help.png' alt='' /> </a>
					</td>
     		</tr>
	  
			<tr>
						<?php 
    $shippingBilling = get_option('shippingsameasbilling');
    $shippingBilling1 = $shippingBilling2 = '';
    switch ($shippingBilling) {
        case 1:
            $shippingBilling1 = "checked ='checked'";
            break;
        case 0:
            $shippingBilling2 = "checked ='checked'";
            break;
    }
    ?>
				<td scope="row"><?php 
    _e('Enable Shipping Same as Billing Option: ', 'wpsc');
    ?>
:</td>
				<td>
				<input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php 
    if (!empty($shippingBilling1)) {
        echo $shippingBilling1;
    }
    ?>
 /> 
				<label for='shippingsameasbilling1'><?php 
    _e('Yes', 'wpsc');
    ?>
</label> &nbsp;
				<input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php 
    if (!empty($shippingBilling2)) {
        echo $shippingBilling2;
    }
    ?>
 /> 
				<label for='shippingsameasbilling2'><?php 
    _e('No', 'wpsc');
    ?>
</label>
				</td>
				
			</tr>
			<tr>
				<td><?php 
    _e('Force users to use SSL', 'wpsc');
    ?>
:</td>
				<td>
				<?php 
    $wpsc_force_ssl = esc_attr(get_option('wpsc_force_ssl'));
    $wpsc_force_ssl1 = "";
    $wpsc_force_ssl2 = "";
    switch ($wpsc_force_ssl) {
        case 0:
            $wpsc_force_ssl2 = "checked ='checked'";
            break;
        case 1:
            $wpsc_force_ssl1 = "checked ='checked'";
            break;
    }
    ?>
					<input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php 
    echo $wpsc_force_ssl1;
    ?>
 /> 					<label for='wpsc_force_ssl1'><?php 
    _e('Yes', 'wpsc');
    ?>
</label> &nbsp;
					<input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php 
    echo $wpsc_force_ssl2;
    ?>
 /> 					<label for='wpsc_force_ssl2'><?php 
    _e('No', 'wpsc');
    ?>
</label>
				</td>
				<td>
					<a title='<?php 
    _e('This can cause warnings for your users if you do not have a properly configured SSL certificate', 'wpsc');
    ?>
' class='flag_email' href='#' ><img src='<?php 
    echo WPSC_CORE_IMAGES_URL;
    ?>
/help.png' alt='' /> </a>
				</td>
			</tr>
			<?php 
    do_action('wpsc_checkout_settings_page');
    ?>
			</table>
		</div>
		</div>
		</div>
			<h3><?php 
    _e('Form Fields', 'wpsc');
    ?>
</h3>
  			<p><?php 
    _e('Here you can customise the forms to be displayed in your checkout page. The checkout page is where you collect important user information that will show up in your purchase logs i.e. the buyers address, and name...', 'wpsc');
    ?>
</p>
  			
				<p>
					<label for='wpsc_form_set'><?php 
    _e('Select a Form Set', 'wpsc');
    ?>
:</label>
					<select id='wpsc_form_set' name='wpsc_form_set'>
					<?php 
    $checkout_sets = get_option('wpsc_checkout_form_sets');
    foreach ((array) $checkout_sets as $key => $value) {
        $selected_state = "";
        if (isset($_GET['checkout-set']) && $_GET['checkout-set'] == $key) {
            $selected_state = "selected='selected'";
        }
        echo "<option {$selected_state} value='{$key}'>" . esc_attr(stripslashes($value)) . "</option>";
    }
    ?>
					</select>
					<input type='submit' value='Filter' name='wpsc_checkout_set_filter' class='button-secondary' />
					<a href='#' class='add_new_form_set'><?php 
    _e("+ Add New Form Set", 'wpsc');
    ?>
</a>
				</p>
				
				<p class='add_new_form_set_forms'>
					<label><?php 
    _e("Add new Form Set", 'wpsc');
    ?>
: <input type="text" value="" name="new_form_set" /></label>
					<input type="submit" value="<?php 
    _e('Add', 'wpsc');
    ?>
" class="button-secondary" id="formset-add-sumbit"/>
				</p>
				
				<?php 
    if (!isset($_GET['checkout-set']) || $_GET['checkout-set'] == 0) {
        $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `checkout_set` IN ('0', '') ORDER BY `checkout_order`;";
    } else {
        $filter = $wpdb->escape($_GET['checkout-set']);
        $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `checkout_set` IN ('" . $filter . "') ORDER BY `checkout_order`;";
    }
    $email_form_field = $wpdb->get_row("SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1", ARRAY_A);
    $form_data = $wpdb->get_results($form_sql, ARRAY_A);
    if (!isset($_GET['checkout-set'])) {
        $_GET['checkout-set'] = '';
    }
    $selected_checkout_set = esc_attr($_GET['checkout-set']);
    echo "<input type='hidden' name='selected_form_set' value='" . $selected_checkout_set . "' />";
    ?>
			<table id="wpsc_checkout_list" class="widefat page fixed"  cellspacing="0">
			<thead>
				<tr>
					<?php 
    print_column_headers('display-checkout-list');
    ?>
				</tr>
			</thead>
		
			<tfoot>
				<tr>
					<?php 
    print_column_headers('display-checkout-list', false);
    ?>
				</tr>
			</tfoot>
		
			<tbody id='wpsc_checkout_list_body'>
			<?php 
    foreach ((array) $form_data as $form_field) {
        echo "<tr id='checkout_" . $form_field['id'] . "' class='checkout_form_field'>\n\r";
        echo '<td class="drag"><a href="" onclick="return false;" title="' . __('Click and Drag to Order Checkout Fields', 'wpsc') . '"><img src="' . WPSC_CORE_IMAGES_URL . '/roll-over-drag.jpg" alt="roll-over-drag" /></a></td>';
        echo "<td class='namecol'><input type='text' name='form_name[" . $form_field['id'] . "]' value='" . esc_attr(htmlentities(stripslashes($form_field['name']), ENT_QUOTES, "UTF-8")) . "' /></td>";
        echo "      <td class='typecol'>";
        echo "<select class='wpsc_checkout_selectboxes' name='form_type[" . $form_field['id'] . "]'>";
        foreach ($form_types as $form_type_name => $form_type) {
            $selected = '';
            if ($form_type === $form_field['type']) {
                $selected = "selected='selected'";
            }
            echo "<option value='" . $form_type . "' " . $selected . ">" . $form_type_name . "</option>";
        }
        echo "</select>";
        if (in_array($form_field['type'], array('select', 'radio', 'checkbox'))) {
            echo "<a class='wpsc_edit_checkout_options' rel='form_options[" . $form_field['id'] . "]' href=''>" . __('more options', 'wpsc') . "</a>";
        }
        echo "</td>";
        $checked = "";
        echo "<td><select name='unique_names[" . $form_field['id'] . "]'>";
        echo "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
        foreach ($unique_names as $unique_name) {
            $selected = "";
            if ($unique_name == $form_field['unique_name']) {
                $selected = "selected='selected'";
            }
            echo "<option " . $selected . " value='" . $unique_name . "'>" . $unique_name . "</option>";
        }
        echo "</select></td>";
        if ($form_field['mandatory']) {
            $checked = "checked='checked'";
        }
        echo "      <td class='mandatorycol'><input {$checked} type='checkbox' name='form_mandatory[" . $form_field['id'] . "]' value='1' /></td>";
        echo "      <td><a class='image_link' href='#' onclick='return remove_form_field(\"checkout_" . $form_field['id'] . "\"," . $form_field['id'] . ");'><img src='" . WPSC_CORE_IMAGES_URL . "/trash.gif' alt='" . __('Delete', 'wpsc') . "' title='" . __('Delete', 'wpsc') . "' /></a>";
        if ($email_form_field['id'] == $form_field['id']) {
            echo "<a title='" . __('This will be the Email address that the Purchase Reciept is sent to.', 'wpsc') . "' class='flag_email' href='#' ><img src='" . WPSC_CORE_IMAGES_URL . "/help.png' alt='' /> </a>";
        }
        echo "</td>";
        echo "\n\t\t\t    </tr>";
    }
    ?>

			</tbody>
			</table>
		 <?php 
    ?>
	<p>
        <input type='hidden' name='wpsc_admin_action' value='checkout_settings' />
        
				<?php 
    wp_nonce_field('update-options', 'wpsc-update-options');
    ?>
        <input class='button-primary' type='submit' name='submit' value='<?php 
    _e('Save Changes', 'wpsc');
    ?>
' />
        <a href='#' onclick='return add_form_field();'><?php 
    _e('Add New Form Field', 'wpsc');
    ?>
</a>
  </p>
  </form>
</div>
</form>
		   <?php 
}
Exemplo n.º 19
0
	/**
	 * Registers column headings for the category list manager
	 *	 
	 * @since 1.0
	 * @return void
	 **/
	function products_cols () {
		register_column_headers('ecart_page_ecart-categories', array(
			'move'=>'<img src="'.ECART_ADMIN_URI.'/icons/updating.gif" alt="updating" width="16" height="16" class="hidden" />',
			'p'=>__('Product','Ecart'))
		);
	}
Exemplo n.º 20
0
/**
 * Manages artists - adds, deletes, edits.
 *
 * @author Alex Andrews <*****@*****.**>
 * @return void
 **/
function ribcage_manage_artists()
{
    global $artists;
    global $artist;
    $index = false;
    // If we aren't on an artist page then we are on the index page.
    if (isset($_REQUEST['artist'])) {
        $artist_id = (int) $_REQUEST['artist'];
    } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'add_artist') {
        $index = false;
    } else {
        $index = true;
    }
    register_column_headers('ribcage-manage-artist', array('cb' => '<input type="checkbox" />', 'artist' => 'Artist'));
    if (isset($_REQUEST['ribcage_action'])) {
        global $wpdb;
        // Refactor, this is a terrible place for this to do this.
        if ($_REQUEST['ribcage_action'] !== 'add') {
            check_admin_referer('manage_artists');
        } else {
            check_admin_referer('add_artist');
        }
        unset($_POST['_wpnonce']);
        unset($_POST['_wp_http_referer']);
        unset($_POST['Submit']);
        //split apart associative array into different parts to prepare for implodes
        $post_keys = array_keys($_POST);
        $post_vals = array_values($_POST);
        //construct field name list and vals to post
        $string_keys = implode($post_keys, ",");
        $string_vals = "'" . implode($post_vals, "','") . "'";
        $wpdb->show_errors();
        switch ($_REQUEST['ribcage_action']) {
            case 'edit':
                $sql = "UPDATE " . $wpdb->prefix . "ribcage_artists\n\t\t\t\t\t\tSET ";
                $i = 0;
                foreach ($post_keys as $field) {
                    $sql .= $field . "='" . $post_vals[$i] . "', ";
                    $i++;
                }
                $sql .= " artist_id = " . $artist_id . " \n\t\t\t\t\t\tWHERE artist_id = " . $artist_id;
                $results = $wpdb->query($sql);
                $wpdb->hide_errors();
                $artist = get_artist($artist_id);
                $message = 'updated';
                break;
            case 'add':
                $sql = "INSERT INTO " . $wpdb->prefix . "ribcage_artists\n\t\t\t\t\t\t({$string_keys})\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$string_vals})";
                $results = $wpdb->query($sql);
                $wpdb->hide_errors();
                $artist = get_artist_by_slug($_POST['artist_slug']);
                $message = 'added';
                break;
            case 'delete':
                $del_artist = get_artistname_by_id($_REQUEST['artist']);
                delete_artist($_REQUEST['artist']);
                $message = "{$del_artist} deleted";
                $index = 1;
                break;
        }
        echo '<div id="message" class="updated fade"><p><strong>Artist ' . $message . '.</strong></p></div>';
    }
    if (!$index) {
        if (isset($_REQUEST['artist'])) {
            $artist = get_artist($_REQUEST['artist']);
        }
        ?>
	<div class="wrap">
			<div id="icon-options-general" class="icon32"><br /></div>
		<?php 
        if ($_REQUEST['page'] == 'add_artist') {
            ?>
			<h2>Add Artist</h2>
			<form action="<?php 
            echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
            ?>
&ribcage_action=add" method="post" id="ribcage_edit_artist" name="edit_artist">
			<?php 
            wp_nonce_field('add_artist');
            ?>
		<?php 
        }
        ?>
		<?php 
        if (isset($_REQUEST['artist'])) {
            ?>
			<h2>Managing <?php 
            artist_name();
            ?>
</h2>
			<form action="<?php 
            echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
            ?>
&ribcage_action=edit" method="post" id="ribcage_edit_artist" name="edit_artist">
			<?php 
            wp_nonce_field('manage_artists');
            ?>
		<?php 
        }
        ?>
					<table class="form-table">             
						<tr valign="top">
							<th scope="row"><label for="artist_name">Name</label></th> 
							<td>
								<input type="text" value="<?php 
        artist_name();
        ?>
" name="artist_name" id="artist_name" class="regular-text"/>												
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Sort Name</th> 
							<td>
								<input type="text" value="<?php 
        artist_name_sort();
        ?>
" name="artist_name_sort" id="artist_name_sort" class="regular-text" />
								<span class="description">The name of the artist to be alphabetized. For example, 'Butterfly, The'.</span>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Slug</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_slug();
        ?>
" name="artist_slug" id="artist_slug" /><span class="description">The URL you want for the artist - for example <a href="<?php 
        echo home_url();
        ?>
/artists/artist_slug</span>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Signup Date</th> 
							<td>
								<input type="text" style="width:100px;" class="regular-text code" value="<?php 
        echo $artist['artist_signed'];
        ?>
" name="artist_signed" id="artist_signed" maxlength="50" /><span class="description">The date the artist signed for your label</span>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Creative Commons license</th> 
							<td>
								<?php 
        echo ribcage_cc_dropdown($artist_license_val);
        ?>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist's Music Brainz ID</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_musicbrainz();
        ?>
" name="artist_mbid" id="artist_mbid" maxlength="50" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Website URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_website_link();
        ?>
" name="artist_link_website" id="artist_link_website" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">MySpace URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_myspace_link();
        ?>
" name="artist_link_myspace" id="artist_link_myspace" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Facebook URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_facebook_link();
        ?>
" name="artist_link_facebook" id="artist_link_facebook" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Biography</th> 
							<td>
								<textarea rows="5" cols="50" name="artist_bio" id="artist_bio" class="regular-text"><?php 
        echo $artist['artist_bio'];
        ?>
</textarea>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Short One Paragraph Description of Artist</th> 
							<td>
								<textarea rows="5" cols="50" name="artist_blurb_tiny" id="artist_blurb_tiny" class="regular-text"><?php 
        echo $artist['artist_blurb_tiny'];
        ?>
</textarea>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture 1</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_picture_1();
        ?>
" name="artist_picture_1" id="artist_picture_1" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture 2</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_picture_2();
        ?>
" name="artist_picture_2" id="artist_picture_2" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture 3</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_picture_3();
        ?>
" name="artist_picture_3" id="artist_picture_3" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture HQ Zipfile URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        echo $artist_picture_zip_val;
        ?>
" name="artist_picture_zip" id="artist_picture_zip" maxlength="200" />
							</td> 
						</tr>
					</table>
					<p class="submit">
						<input type="submit" name="Submit" class="button-primary" value="Save Changes" />
					</p>
			</form>
	</div>
<?php 
    } else {
        ?>
	<?php 
        $artists = list_artists_blurb();
        $alt = 0;
        ?>
	<div class="wrap">
		<div id="icon-plugins" class="icon32"><br /></div>
		<h2>Manage Artists</h2>
			<form action="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
" method="post" id="ribcage_manage_artists" name="manage_artists"> 
				<table class="widefat post fixed" cellspacing="0">
						<thead>
						<tr>
						<?php 
        print_column_headers('ribcage-manage-artist');
        ?>
			
						</tr>
						</thead>
						<tfoot>
						<tr>			
						<?php 
        print_column_headers('ribcage-manage-artist', FALSE);
        ?>
	
						</tr>
						</tfoot>            
						<tbody>
							<?php 
        while (have_artists()) {
            the_artist();
            ?>
							<?php 
            $manage_link = wp_nonce_url('?page=ribcage&artist=' . artist_id(false), 'manage_artists');
            $delete_link = wp_nonce_url('?page=ribcage&artist=' . artist_id(false) . '&ribcage_action=delete', 'manage_artists');
            ?>
							<?php 
            echo $alt % 2 ? '<tr valign="top" class="">' : '<tr valign="top" class="alternate">';
            ++$alt;
            ?>
		
							<th scope="row" class="check-column"><input type="checkbox" name="artistcheck[]" value="2" /></th>
							<td class="column-name">
								<strong><a class="row-title" href="?page=manage_artists&artist=<?php 
            artist_id();
            ?>
" title="<?php 
            artist_name();
            ?>
" ><?php 
            artist_name();
            ?>
</strong></a><br /><div class="row-actions"><span class='edit'><a href="<?php 
            echo $manage_link;
            ?>
">Edit</a> | </span><span class='delete'><a class='submitdelete' href='<?php 
            echo $delete_link;
            ?>
' onclick="if ( confirm('You are about to delete \'<?php 
            artist_name();
            ?>
\'\n  \'Cancel\' to stop, \'OK\' to delete.') ) { return true;}return false;">Delete</a></span></div></td>
							</tr>
							<?php 
        }
        ?>
						</tbody>
					</table>
			</form>
	</div>
	<?php 
    }
}
Exemplo n.º 21
0
function wpsc_display_sales_log_index()
{
    global $purchlogs;
    ?>
	<div class="wrap">
		<?php 
    //screen_icon();
    ?>
		<h2><?php 
    echo wp_specialchars(TXT_WPSC_PURCHASELOG);
    ?>
 </h2>
		<?php 
    //START OF PURCHASE LOG DEFAULT VIEW
    ?>
		<?php 
    if (isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status'])) {
        wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
    }
    if (!isset($_REQUEST['purchaselog_id'])) {
        $columns = array('cb' => '<input type="checkbox" />', 'date' => 'Date', 'name' => '', 'amount' => 'Amount', 'details' => 'Details', 'status' => 'Status', 'delete' => 'Delete', 'track' => 'Track');
        register_column_headers('display-sales-list', $columns);
        ///// start of update message section //////
        //$fixpage = get_option('siteurl').'/wp-admin/admin.php?page='.WPSC_FOLDER.'/wpsc-admin/purchlogs_upgrade.php';
        $fixpage = get_option('siteurl') . '/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
        if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked'])) {
            ?>
			<div id="message" class="updated fade"><p>
			<?php 
            if (isset($_GET['updated']) && (int) $_GET['updated']) {
                printf(__ngettext('%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated']), number_format_i18n($_GET['updated']));
                unset($_GET['updated']);
            }
            if (isset($_GET['skipped']) && (int) $_GET['skipped']) {
                unset($_GET['skipped']);
            }
            if (isset($_GET['locked']) && (int) $_GET['locked']) {
                printf(__ngettext('%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked']), number_format_i18n($_GET['locked']));
                unset($_GET['locked']);
            }
            if (isset($_GET['deleted']) && (int) $_GET['deleted']) {
                printf(__ngettext('%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted']), number_format_i18n($_GET['deleted']));
                unset($_GET['deleted']);
            }
            //$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','wpsc_downloadcsv','rss_key','start_timestamp','end_timestamp','email_buyer_id'), $_SERVER['REQUEST_URI'] );
            ?>
			</p></div>
		<?php 
        }
        if (get_option('wpsc_purchaselogs_fixed') == false || wpsc_check_uniquenames()) {
            ?>
				<div class='error' style='padding:8px;line-spacing:8px;'><span ><?php 
            _e('When upgrading the Wp-E-Commerce Plugin from 3.6.* to 3.7 it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please ');
            ?>
 <a href='<?php 
            echo $fixpage;
            ?>
'>Click Here</a></span></div>
	<?php 
        }
        ///// end of update message section //////
        ?>
		<div id='dashboard-widgets' style='min-width: 825px;'>
			<!--
 <div class='inner-sidebar'> 
					<div class='meta-box-sortables'>			
						<?php 
        //if(IS_WP27){
        //	display_ecomm_rss_feed();
        //}
        ?>
					</div>
			</div>
-->
			<?php 
        /* end of sidebar start of main column */
        ?>
			<div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
				<div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>
			
				<?php 
        if (function_exists('wpsc_right_now')) {
            echo wpsc_right_now();
        }
        ?>
 
			   	</div><br />
			   	<div id='wpsc_purchlog_searchbox'>
			   		<?php 
        wpsc_purchaselogs_searchbox();
        ?>
			   	</div><br />
			   		<?php 
        wpsc_purchaselogs_displaylist();
        ?>
 				
				
			</div>
		</div>
		<?php 
    } else {
        //NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
        if (isset($_GET['cleared']) || isset($_GET['cleared'])) {
            ?>
			<div id="message" class="updated fade"><p>
			<?php 
            if (isset($_GET['cleared']) && $_GET['cleared'] == true) {
                printf(__ngettext('Downloads for this log have been released.', 'Downloads for this log have been released.', $_GET['cleared']), $_GET['cleared']);
                unset($_GET['cleared']);
            }
            if (isset($_GET['sent']) && (int) $_GET['sent']) {
                printf(__ngettext('Receipt has been resent ', 'Receipt has been resent ', $_GET['sent']), $_GET['sent']);
                unset($_GET['sent']);
            }
            ?>
 </p></div>
			<?php 
        }
        //$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','cleared'), $_SERVER['REQUEST_URI'] );
        ?>

			
			<?php 
        $page_back = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'purchaselog_id'), $_SERVER['REQUEST_URI']);
        $columns = array('title' => 'Name', 'sku' => 'SKU', 'quantity' => 'Quantity', 'price' => 'Price', 'tax' => 'Tax', 'total' => 'Total');
        register_column_headers('display-purchaselog-details', $columns);
        ?>
			<div id='post-body' class='has-sidebar' style='width:95%;'>
				<?php 
        if (wpsc_has_purchlog_shipping()) {
            ?>
				<div id='wpsc_shipping_details_box'>	
					<h3><?php 
            _e('Shipping Details');
            ?>
</h3>
					<p><strong><?php 
            echo wpsc_display_purchlog_shipping_name();
            ?>
</strong></p>
					<p>
					<?php 
            echo wpsc_display_purchlog_shipping_address();
            ?>
<br />
					<?php 
            echo wpsc_display_purchlog_shipping_city();
            ?>
<br />
					<?php 
            echo wpsc_display_purchlog_shipping_state_and_postcode();
            ?>
<br />
					<?php 
            echo wpsc_display_purchlog_shipping_country();
            ?>
<br />
					</p>
					<strong><?php 
            _e('Shipping Options');
            ?>
</strong>
					<p>
					
					<?php 
            _e('Shipping Method:');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_method();
            ?>
<br />
					<?php 
            _e('Shipping Option:');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_option();
            ?>
<br />
					<?php 
            if (wpsc_purchlogs_has_tracking()) {
                ?>
						<?php 
                _e('Tracking ID:');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackid();
                ?>
<br />
						<?php 
                _e('Shipping Status:');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackstatus();
                ?>
<br />
						<?php 
                _e('Track History:');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackhistory();
                ?>
					<?php 
            }
            ?>
					</p>
				</div>
				<?php 
        }
        ?>
				<div id='wpsc_billing_details_box'>
					<h3><?php 
        _e('Billing Details');
        ?>
</h3>
					<p><strong><?php 
        _e('Purchase Log Date:');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_date();
        ?>
 </p>
					<p><strong><?php 
        _e('Purchase Number:');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_purchnumber();
        ?>
 </p>
					<p><strong><?php 
        _e('Buyers Name:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_name();
        ?>
</p>
					<p><strong><?php 
        _e('Address:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_address();
        ?>
</p>

					<p><strong><?php 
        _e('Phone:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_phone();
        ?>
</p>
					<p><strong><?php 
        _e('Email:');
        ?>
 </strong><a href="mailto:<?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
?subject=Message From '<?php 
        echo get_option('siteurl');
        ?>
'"><?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
</a></p>
					<p><strong><?php 
        _e('Payment Method:');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_paymentmethod();
        ?>
</p>
					<?php 
        if (wpsc_display_purchlog_display_howtheyfoundus()) {
            ?>
					<p><strong><?php 
            _e('How User Found Us:');
            ?>
 </strong><?php 
            echo wpsc_display_purchlog_howtheyfoundus();
            ?>
</p>
					<?php 
        }
        ?>
				</div>
			
				<div id='wpsc_items_ordered'>
					<br />
					<h3><?php 
        _e('Items Ordered');
        ?>
</h3>
					<table class="widefat" cellspacing="0">
						<thead>
							<tr>
						<?php 
        print_column_headers('display-purchaselog-details');
        ?>
							</tr>
						</thead>
					
						<tfoot>
							<tr>
						<?php 
        php;
        ?>
							</tr>
						</tfoot>
					
						<tbody>
						<?php 
        wpsc_display_purchlog_details();
        ?>
						<tr> &nbsp;</tr>

						<tr>
							<td colspan="4">
								<?php 
        if (wpsc_purchlog_has_discount_data()) {
            ?>
								<?php 
            _e('Coupon Code');
            ?>
: <?php 
            echo wpsc_display_purchlog_discount_data();
            ?>
								<?php 
        }
        ?>
							</td>
							<th><?php 
        _e('Discount');
        ?>
 </th>
							<td><?php 
        echo wpsc_display_purchlog_discount();
        ?>
</td>
						</tr>
						
						<tr>
							<td colspan='4'></td>
							<th><?php 
        _e('Shipping');
        ?>
 </th>
							<td><?php 
        echo wpsc_display_purchlog_shipping();
        ?>
</td>
						</tr>
						<tr>
							<td colspan='4'></td>
							<th><?php 
        _e('Total');
        ?>
 </th>
							<td><?php 
        echo wpsc_display_purchlog_totalprice();
        ?>
</td>
						</tr>
						</tbody>
				</table>
				<div id='wpsc_purchlog_order_status'>
					<form action='' method='post'>
					<p><label for='<?php 
        echo $_GET['purchaselog_id'];
        ?>
'><?php 
        _e('Order Status:');
        ?>
</label><select class='selector' name='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' title='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' >
	 			<?php 
        while (wpsc_have_purch_items_statuses()) {
            wpsc_the_purch_status();
            ?>
	 				<option value='<?php 
            echo wpsc_the_purch_status_id();
            ?>
' <?php 
            echo wpsc_purchlog_is_checked_status();
            ?>
 ><?php 
            echo wpsc_the_purch_status_name();
            ?>
 </option>
	 			<?php 
        }
        ?>
		 			</select></p>
		 			</form>
 			</div>
 				<?php 
        wpsc_purchlogs_custom_fields();
        ?>
 				
 				
 				<!-- Start Order Notes (by Ben) -->
 				<?php 
        wpsc_purchlogs_notes();
        ?>
				<!-- End Order Notes (by Ben) -->
				
				<?php 
        wpsc_custom_checkout_fields();
        ?>
 				
				</div>
				</div>
				
				<div id='wpsc_purchlogitems_links'>
				<h3><?php 
        _e('Actions');
        ?>
</h3>
				<?php 
        if (wpsc_purchlogs_have_downloads_locked() != false) {
            ?>
<img src='<?php 
            echo WPSC_URL;
            ?>
/images/lock_open.png' alt='clear lock icon' />&ensp;<a href='<?php 
            echo $_SERVER['REQUEST_URI'] . '&amp;wpsc_admin_action=clear_locks';
            ?>
'><?php 
            echo wpsc_purchlogs_have_downloads_locked();
            ?>
</a><br /><br class='small' />
				<?php 
        }
        ?>
<img src='<?php 
        echo WPSC_URL;
        ?>
/images/printer.png' alt='printer icon' />&ensp;<a href='<?php 
        echo add_query_arg('wpsc_admin_action', 'wpsc_display_invoice');
        ?>
'><?php 
        echo TXT_WPSC_VIEW_PACKING_SLIP;
        ?>
</a>
		
<br /><br class='small' /><img src='<?php 
        echo WPSC_URL;
        ?>
/images/email_go.png' alt='email icon' />&ensp;<a href='<?php 
        echo add_query_arg('email_buyer_id', $_GET['purchaselog_id']);
        ?>
'><?php 
        echo TXT_WPSC_EMAIL_BUYER;
        ?>
</a>
		  
<br /><br class='small' /><a class='submitdelete' title='<?php 
        echo attribute_escape(__('Delete this log'));
        ?>
' href='<?php 
        echo wp_nonce_url("page.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=" . $_GET['purchaselog_id'], 'delete_purchlog_' . $_GET['purchaselog_id']);
        ?>
' onclick="if ( confirm(' <?php 
        echo js_escape(sprintf(__("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete."), wpsc_purchaselog_details_date()));
        ?>
') ) { return true;}return false;"><img src='<?php 
        echo WPSC_URL . "/images/cross.png";
        ?>
' alt='delete icon' />               &nbsp;<?php 
        echo TXT_WPSC_REMOVE_LOG;
        ?>
</a>

<br /><br class='small' />&emsp;&ensp; 	<a href='<?php 
        echo $page_back;
        ?>
'><?php 
        echo TXT_WPSC_GOBACK;
        ?>
</a>
<br /><br />
			</div>
			</div>
			<br />
			<?php 
    }
    ?>
	</div>
	<?php 
}
Exemplo n.º 22
0
function wpsc_options_checkout()
{
    global $wpdb;
    $form_types = array("Text" => "text", "Email Address" => "email", "Street Address" => "address", "City" => "city", "Country" => "country", "Delivery Address" => "delivery_address", "Delivery City" => "delivery_city", "Delivery Country" => "delivery_country", "Text Area" => "textarea", "Heading" => "heading", "Select" => "select", "Radio Button" => "radio", "Checkbox" => "checkbox");
    $unique_names = get_option('wpsc_unique_names');
    if (empty($unique_names)) {
        $unique_names = array('billingfirstname', 'billinglastname', 'billingaddress', 'billingcity', 'billingcountry', 'billingemail', 'billingphone', 'billingpostcode', 'delivertoafriend', 'shippingfirstname', 'shippinglastname', 'shippingaddress', 'shippingcity', 'shippingstate', 'shippingcountry', 'shippingpostcode');
        update_option('wpsc_unique_names', $unique_names);
    }
    $unique_names = apply_filters('wpsc_unique_names', $unique_names);
    update_option('wpsc_checkout_form_fields', $form_types);
    if (get_option('wpsc_checkout_form_fields') == '') {
        update_option('wpsc_checkout_form_fields', $form_types);
    }
    do_action('wpsc_checkout_form_fields_page');
    $columns = array('drag' => 'Drag', 'name' => 'Name', 'type' => 'Type', 'unique_names' => 'Unique Names', 'mandatory' => 'Mandatory', 'trash' => 'Trash');
    register_column_headers('display-checkout-list', $columns);
    $form_types = get_option('wpsc_checkout_form_fields');
    ?>

<form name='cart_options' id='cart_options' method='post' action=''>
	<div class="wrap">
  		<h2><?php 
    echo __('Checkout Options', 'wpsc');
    ?>
</h2>  
		<?php 
    /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
    wpsc_settings_page_update_notification();
    ?>

		<form method='post' action='' id='chekcout_options_tbl'>
		<div class='metabox-holder' style='width:95%;'>
			<div class='postbox'>
			<input type='hidden' name='checkout_submits' value='true' />
			<h3 class='hndle'>Misc Checkout Options</h3>
			<div class='inside'>
			<table>
			<tr>
				<td><?php 
    echo __('Users must register before checking out', 'wpsc');
    ?>
:</td>
				<td>
					<?php 
    $require_register = get_option('require_register');
    $require_register1 = "";
    $require_register2 = "";
    switch ($require_register) {
        case 0:
            $require_register2 = "checked ='checked'";
            break;
        case 1:
            $require_register1 = "checked ='checked'";
            break;
    }
    ?>
						<input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php 
    echo $require_register1;
    ?>
 /> 					<label for='require_register1'><?php 
    echo __('Yes', 'wpsc');
    ?>
</label> &nbsp;
						<input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php 
    echo $require_register2;
    ?>
 /> 					<label for='require_register2'><?php 
    echo __('No', 'wpsc');
    ?>
</label>
					</td>
					<td>
						<a title='<?php 
    echo __('If yes then you must also turn on the wordpress option "Any one can register"', 'wpsc');
    ?>
' class='flag_email' href='#' ><img src='<?php 
    echo WPSC_URL;
    ?>
/images/help.png' alt='' /> </a>
					</td>
     		</tr>
     				<tr>
			<?php 
    $lock_tax = get_option('lock_tax');
    switch ($lock_tax) {
        case 1:
            $lock_tax1 = "checked ='checked'";
            break;
        case 0:
            $lock_tax2 = "checked ='checked'";
            break;
    }
    ?>
			<td scope="row"><?php 
    echo __('Lock Tax to Billing Country', 'wpsc');
    ?>
:</td>
			<td>
				<input type='radio' value='1' name='wpsc_options[lock_tax]' id='lock_tax1' <?php 
    echo $lock_tax1;
    ?>
 /> 
				<label for='lock_tax1'><?php 
    echo __('Yes', 'wpsc');
    ?>
</label> &nbsp;
				<input type='radio' value='0' name='wpsc_options[lock_tax]' id='lock_tax2' <?php 
    echo $lock_tax2;
    ?>
 /> 
				<label for='lock_tax2'><?php 
    echo __('No', 'wpsc');
    ?>
</label>
			</td>
			</tr>
		<tr>
			<!-- Disregard Billing State for Tax Calculations -->
			<?php 
    $lock_tax_to_shipping = get_option('lock_tax_to_shipping');
    switch ($lock_tax_to_shipping) {
        case 1:
            $lock_tax_to_shipping1 = "checked ='checked'";
            break;
        case 0:
            $lock_tax_to_shipping2 = "checked ='checked'";
            break;
    }
    ?>
			<td scope="row"><?php 
    echo __(' Disregard Billing State for Tax Calculations', 'wpsc');
    ?>
:</td>
			<td>
				<input type='radio' value='1' name='wpsc_options[lock_tax_to_shipping]' id='lock_tax1' <?php 
    echo $lock_tax_to_shipping1;
    ?>
 /> 
				<label for='lock_tax_to_shipping1'><?php 
    echo __('Yes', 'wpsc');
    ?>
</label> &nbsp;
				<input type='radio' value='0' name='wpsc_options[lock_tax_to_shipping]' id='lock_tax2' <?php 
    echo $lock_tax_to_shipping2;
    ?>
 /> 
				<label for='lock_tax_to_shipping2'><?php 
    echo __('No', 'wpsc');
    ?>
</label>
			</td>


			
		</tr>
		<tr>
					<?php 
    $shippingBilling = get_option('shippingsameasbilling');
    switch ($shippingBilling) {
        case 1:
            $shippingBilling1 = "checked ='checked'";
            break;
        case 0:
            $shippingBilling2 = "checked ='checked'";
            break;
    }
    ?>
			<td scope="row"><?php 
    echo __('Enable Shipping Same as Billing Option: ', 'wpsc');
    ?>
:</td>
			<td>
			<input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php 
    echo $shippingBilling1;
    ?>
 /> 
			<label for='shippingsameasbilling1'><?php 
    echo __('Yes', 'wpsc');
    ?>
</label> &nbsp;
			<input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php 
    echo $shippingBilling2;
    ?>
 /> 
			<label for='shippingsameasbilling2'><?php 
    echo __('No', 'wpsc');
    ?>
</label>
			</td>
		</tr>
		
		<tr>
			<?php 
    $billing_unless_shipping_setting = get_option('use_billing_unless_is_shipping');
    switch ($billing_unless_shipping_setting) {
        case 1:
            $billing_unless_shipping['on'] = "checked ='checked'";
            break;
        case 0:
            $billing_unless_shipping['off'] = "checked ='checked'";
            break;
    }
    ?>
			<td scope="row"><?php 
    echo __('Use The Billing country for Shipping unless a shipping form is present: ', 'wpsc');
    ?>
:</td>
			<td>
			<input type='radio' value='1' name='wpsc_options[use_billing_unless_is_shipping]' id='use_billing_unless_is_shipping1' <?php 
    echo $billing_unless_shipping['on'];
    ?>
 /> 
			<label for='use_billing_unless_is_shipping1'><?php 
    echo __('Yes', 'wpsc');
    ?>
</label> &nbsp;
			<input type='radio' value='0' name='wpsc_options[use_billing_unless_is_shipping]' id='use_billing_unless_is_shipping2' <?php 
    echo $billing_unless_shipping['off'];
    ?>
 /> 
			<label for='use_billing_unless_is_shipping2'><?php 
    echo __('No', 'wpsc');
    ?>
</label>
			</td>
		</tr>
		
			</table>
		</div>
		</div>
		</div>
			<h3>Form Fields</h3>
  			<p><?php 
    echo __('Here you can customise the forms to be displayed in your checkout page. The checkout page is where you collect important user information that will show up in your purchase logs i.e. the buyers address, and name...', 'wpsc');
    ?>
</p>
  			
				<p>
					<label for='wpsc_form_set'>Select a Form Set:</label>
					<select id='wpsc_form_set' name='wpsc_form_set'>
					<?php 
    $checkout_sets = get_option('wpsc_checkout_form_sets');
    foreach ((array) $checkout_sets as $key => $value) {
        $selected_state = "";
        if ($_GET['checkout-set'] == $key) {
            $selected_state = "selected='selected'";
        }
        echo "<option {$selected_state} value='{$key}'>" . stripslashes($value) . "</option>";
    }
    ?>
					</select>
					<input type='submit' value='Filter' name='wpsc_checkout_set_filter' class='button-secondary' />
					<a href='#' class='add_new_form_set'><?php 
    _e("+ Add New Form Set", 'wpsc');
    ?>
</a>
				</p>
				
				<p class='add_new_form_set_forms'>
					<label><?php 
    _e("Add new Form Set", 'wpsc');
    ?>
: <input type="text" value="" name="new_form_set" /></label>
					<input type="submit" value="<?php 
    _e('Add');
    ?>
" class="button-secondary" id="formset-add-sumbit"/>
				</p>
				
				<?php 
    if (!isset($_GET['checkout-set'])) {
        $filter = 0;
        $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `checkout_set` IN ('" . $filter . "') ORDER BY `order`;";
    } else {
        $filter = $wpdb->escape($_GET['checkout-set']);
        $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `checkout_set` IN ('" . $filter . "') ORDER BY `order`;";
    }
    $email_form_field = $wpdb->get_row("SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `order` ASC LIMIT 1", ARRAY_A);
    $form_data = $wpdb->get_results($form_sql, ARRAY_A);
    $selected_checkout_set = $_GET['checkout-set'];
    echo "<input type='hidden' name='selected_form_set' value='" . $selected_checkout_set . "' />";
    ?>
			<table id="wpsc_checkout_list" class="widefat page fixed"  cellspacing="0">
			<thead>
				<tr>
					<?php 
    print_column_headers('display-checkout-list');
    ?>
				</tr>
			</thead>
		
			<tfoot>
				<tr>
					<?php 
    print_column_headers('display-checkout-list', false);
    ?>
				</tr>
			</tfoot>
		
			<tbody id='wpsc_checkout_list_body'>
			<?php 
    foreach ((array) $form_data as $form_field) {
        echo "<tr id='checkout_" . $form_field['id'] . "' class='checkout_form_field'>\n\r";
        echo '<td class="drag"><a href="" onclick="return false;" title="Click and Drag to Order Checkout Fields"><img src="' . WPSC_URL . '/images/roll-over-drag.jpg" alt="roll-over-drag" /></a></td>';
        echo "<td class='namecol'><input type='text' name='form_name[" . $form_field['id'] . "]' value='" . htmlentities(stripslashes($form_field['name']), ENT_QUOTES, "UTF-8") . "' /></td>";
        echo "      <td class='typecol'>";
        echo "<select class='wpsc_checkout_selectboxes' name='form_type[" . $form_field['id'] . "]'>";
        foreach ($form_types as $form_type_name => $form_type) {
            $selected = '';
            if ($form_type === $form_field['type']) {
                $selected = "selected='selected'";
            }
            // define('__('Textarea', 'wpsc')', 'Textarea');
            echo "<option value='" . $form_type . "' " . $selected . ">" . __($form_type_name, 'wpsc') . "</option>";
        }
        echo "</select>";
        if (in_array($form_field['type'], array('select', 'radio', 'checkbox'))) {
            echo "<a class='wpsc_edit_checkout_options' rel='form_options[" . $form_field['id'] . "]' href=''>more options</a>";
        }
        echo "</td>";
        $checked = "";
        echo "<td><select name='unique_names[" . $form_field['id'] . "]'>";
        echo "<option value='-1'>Select a Unique Name</option>";
        foreach ($unique_names as $unique_name) {
            $selected = "";
            if ($unique_name == $form_field['unique_name']) {
                $selected = "selected='selected'";
            }
            echo "<option " . $selected . " value='" . $unique_name . "'>" . $unique_name . "</option>";
        }
        echo "</select></td>";
        if ($form_field['mandatory']) {
            $checked = "checked='checked'";
        }
        echo "      <td class='mandatorycol'><input {$checked} type='checkbox' name='form_mandatory[" . $form_field['id'] . "]' value='1' /></td>";
        echo "      <td><a class='image_link' href='#' onclick='return remove_form_field(\"checkout_" . $form_field['id'] . "\"," . $form_field['id'] . ");'><img src='" . WPSC_URL . "/images/trash.gif' alt='" . __('Delete', 'wpsc') . "' title='" . __('Delete', 'wpsc') . "' /></a>";
        if ($email_form_field['id'] == $form_field['id']) {
            echo "<a title='" . __('This will be the Email address that the Purchase Reciept is sent to.', 'wpsc') . "' class='flag_email' href='#' ><img src='" . WPSC_URL . "/images/help.png' alt='' /> </a>";
        }
        echo "</td>";
        echo "\n\t\t\t    </tr>";
    }
    ?>

			</tbody>
			</table>
		 <?php 
    ?>
	<p>
        <input type='hidden' name='wpsc_admin_action' value='checkout_settings' />
        
				<?php 
    wp_nonce_field('update-options', 'wpsc-update-options');
    ?>
        <input class='button-primary' type='submit' name='submit' value='<?php 
    echo __('Save Changes', 'wpsc');
    ?>
' />
        <a href='#' onclick='return add_form_field();'><?php 
    echo __('Add New Form Field', 'wpsc');
    ?>
</a>
  </p>
  </form>
</div>
</form>
		   <?php 
}
Exemplo n.º 23
0
	/**
	 * Registers the column headers for the promotions list interface
	 *	 
	 * @return void
	 **/
	function columns () {
		register_column_headers('ecart_page_ecart-promotions', array(
			'cb'=>'<input type="checkbox" />',
			'name'=>__('Name','Ecart'),
			'discount'=>__('Discount','Ecart'),
			'applied'=>__('Applied To','Ecart'),
			'eff'=>__('Status','Ecart'))
		);
	}
Exemplo n.º 24
0
/**
 * Manages products - adds, edits, deletes products.
 *
 * @return void
 */
function ribcage_manage_products()
{
    global $wpdb;
    global $products, $product;
    global $releases, $release;
    global $artist;
    // Security check
    if (isset($_REQUEST['_wpnonce'])) {
        if (wp_verify_nonce($nonce, 'ribcage_manage_releases')) {
            die("Security check failed.");
        }
    }
    $nonce = wp_create_nonce('ribcage_manage_products');
    if (isset($_REQUEST['ribcage_action']) && $_REQUEST['ribcage_action']) {
        array_pop($_POST);
        $post_keys = array_keys($_POST);
        $post_vals = array_values($_POST);
        $string_keys = implode($post_keys, ",");
        $string_vals = "'" . implode($post_vals, "','") . "'";
        $wpdb->show_errors();
        switch ($_REQUEST['ribcage_action']) {
            case 'add':
                // Do we have all the fields we need to add something?
                if ($_POST['product_name'] == null) {
                    $product = $_POST;
                    ribcage_edit_product_form('Sorry you missed the name of your product.');
                    return;
                } elseif ($_POST['product_cost'] == null) {
                    $product = $_POST;
                    ribcage_edit_product_form("Sorry you didn't set a cost for your product.");
                    return;
                } elseif ($_POST['product_description'] == null) {
                    $product = $_POST;
                    ribcage_edit_product_form("Sorry you didn't write a description for your product.");
                    return;
                } elseif (!is_numeric($_POST['product_cost'])) {
                    $product = $_POST;
                    ribcage_edit_product_form("Sorry but that isn't a number for the cost of the product.");
                    return;
                }
                // Do we already have a physical product for this release?
                if ($_POST['product_related_release']) {
                    $sql = "SELECT release_physical FROM " . $wpdb->releases . " WHERE release_id = " . $_POST['product_related_release'];
                    $check = $wpdb->get_row($sql, ARRAY_A);
                    if ($check['release_physical'] == 1) {
                        $product = $_POST;
                        ribcage_edit_product_form("Sorry but that release already has a physical product associated with it.");
                        return;
                    }
                }
                $sql = "INSERT INTO " . $wpdb->products . "\n\t\t\t\t\t\t({$string_keys})\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$string_vals})";
                $results = $wpdb->query($sql);
                $wpdb->hide_errors();
                // Update our _ribcage_releases data with the correct details if we are relating this to a release.
                if ($_POST['product_related_release']) {
                    $sql = "SELECT product_id FROM " . $wpdb->products . " ORDER BY product_id DESC LIMIT 0,1";
                    $product = $wpdb->get_row($sql, ARRAY_A);
                    $sql = "UPDATE " . $wpdb->releases . " SET release_physical = 1, release_physical_cat_no ='" . $product['product_id'] . "' WHERE release_id = " . $_POST['product_related_release'];
                    $results = $wpdb->query($sql);
                }
                $message = ' added';
                break;
            case 'edit':
                ribcage_edit_product_form();
                return;
                break;
            case 'edited':
                // Do we have all the fields we need to add something?
                if ($_POST['product_name'] == null) {
                    $product = $_POST;
                    ribcage_edit_product_form('Sorry you missed the name of your product.');
                    return;
                } elseif ($_POST['product_cost'] == null) {
                    $product = $_POST;
                    ribcage_edit_product_form("Sorry you didn't set a price for your product.");
                    return;
                } elseif ($_POST['product_description'] == null) {
                    $product = $_POST;
                    ribcage_edit_product_form("Sorry you didn't set a price for your product.");
                    return;
                } elseif (!is_numeric($_POST['product_cost'])) {
                    $product = $_POST;
                    ribcage_edit_product_form("Sorry but that isn't a number for the cost of the product.");
                    return;
                }
                $product_before = get_product($_REQUEST['product']);
                $sql = "UPDATE " . $wpdb->prefix . "ribcage_products\n\t\t\t\t\t\tSET ";
                $i = 0;
                foreach ($post_keys as $field) {
                    $sql .= $field . "='" . $post_vals[$i] . "', ";
                    $i++;
                }
                $sql .= " product_id = " . $_REQUEST['product'] . " \n\t\t\t\t\t\tWHERE product_id = " . $_REQUEST['product'];
                $results = $wpdb->query($sql);
                $wpdb->hide_errors();
                // Update our _ribcage_releases data if we have changed the associated product.
                if ($product_before['product_related_release'] != $_REQUEST['product_related_release']) {
                    // Delete it from our previous holder of the release.
                    $sql = "UPDATE " . $wpdb->prefix . "ribcage_releases SET release_physical = 0, release_physical_cat_no = 0 WHERE release_id = " . $product_before['product_related_release'];
                    $results = $wpdb->query($sql);
                    // Add it to the current holder of the release.
                    $sql = "UPDATE " . $wpdb->prefix . "ribcage_releases SET release_physical = 1, release_physical_cat_no ='" . $_REQUEST['product'] . "' WHERE release_id = " . $_POST['product_related_release'];
                    $results = $wpdb->query($sql);
                }
                $message = ' updated';
                break;
            case 'delete':
                $product_before = get_product($_REQUEST['product']);
                delete_product($_REQUEST['product']);
                $sql = "UPDATE " . $wpdb->prefix . "ribcage_releases SET release_physical = 0, release_physical_cat_no = 0 WHERE release_id = " . $product_before['product_related_release'];
                $results = $wpdb->query($sql);
                $message = " deleted";
                break;
        }
        if (isset($message)) {
            echo '<div id="message" class="updated fade"><p><strong>Product ' . $message . '.</strong></p></div>';
        }
    }
    register_column_headers('ribcage-manage-products', array('cb' => '<input type="checkbox" />', 'product_name' => 'Product', 'local_downloads' => 'Related To Release'));
    $products = list_products();
    ?>
		<div class="wrap">
			<div id="icon-plugins" class="icon32"><br /></div>
			<h2>Manage Products</h2>
				<form action="<?php 
    echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
    ?>
" method="post" id="ribcage_manage_products" name="manage_artists"> 
					<table class="widefat post fixed" cellspacing="0">
							<thead>
							<tr>
							<?php 
    print_column_headers('ribcage-manage-products');
    ?>
			
							</tr>
							</thead>
							<tfoot>
							<tr>			
							<?php 
    print_column_headers('ribcage-manage-products', FALSE);
    ?>
	
							</tr>
							</tfoot>            
							<tbody>
								<?php 
    while (have_products()) {
        the_product();
        ?>
								<?php 
        $release = get_release($product['product_related_release']);
        ?>
								<?php 
        $artist['artist_name'] = get_artistname_by_id($release['release_artist']);
        ?>
								<?php 
        echo $alt % 2 ? '<tr valign="top" class="">' : '<tr valign="top" class="alternate">';
        ++$alt;
        ?>
		
								<th scope="row" class="check-column"><input type="checkbox" name="productcheck[]" value="2" /></th>
								<td class="column-name"><strong><a class="row-title" href="?page=manage_products&ribcage_action=edit&product=<?php 
        product_id();
        ?>
&amp;_wpnonce=<?php 
        echo $nonce;
        ?>
" title="<?php 
        product_name();
        ?>
" ><?php 
        product_name();
        ?>
</strong></a><br /><div class="row-actions"><span class='edit'><a href="?page=manage_products&ribcage_action=edit&product=<?php 
        product_id();
        ?>
&amp;_wpnonce=<?php 
        echo $nonce;
        ?>
">Edit</a> | </span><span class='delete'><a class='submitdelete' href="?page=manage_products&ribcage_action=delete&product=<?php 
        product_id();
        ?>
&amp;_wpnonce=<?php 
        echo $nonce;
        ?>
" onclick="if ( confirm('You are about to delete the product \'<?php 
        product_name();
        ?>
\'\n  \'Cancel\' to stop, \'OK\' to delete.') ) { return true;}return false;">Delete</a></span></div></td>
								<?php 
        if ($product['product_related_release']) {
            ?>
								<td class="column-name"><?php 
            artist_name();
            ?>
 - <?php 
            release_title();
            ?>
</td>
								<?php 
        } else {
            ?>
								<td class="column-name">None.</td>
								<?php 
        }
        ?>
								</tr>
								<?php 
    }
    ?>
							</tbody>
						</table>
				</form>
		</div>
		<?php 
}
function shopp_register_column_headers($screen, $columns)
{
    global $wp_version;
    if (version_compare($wp_version, "2.7.0", ">=")) {
        return register_column_headers($screen, $columns);
    }
    global $_wp_column_headers;
    if (!isset($_wp_column_headers)) {
        $_wp_column_headers = array();
    }
    $_wp_column_headers[$screen] = $columns;
}
Exemplo n.º 26
0
	/**
	 * Registers the column headers for the customer list screen
	 *	 
	 * @return void
	 **/
	function columns () {
		ecart_enqueue_script('calendar');
		register_column_headers('ecart_page_ecart-customers', array(
			'cb'=>'<input type="checkbox" />',
			'name'=>__('Name','Ecart'),
			'login'=>__('Login','Ecart'),
			'email'=>__('Email','Ecart'),
			'location'=>__('Location','Ecart'),
			'orders'=>__('Orders','Ecart'),
			'joined'=>__('Joined','Ecart'))
		);

	}
Exemplo n.º 27
0
 public function controller_packing_slip()
 {
     if (!isset($_REQUEST['id']) || isset($_REQUEST['id']) && !is_numeric($_REQUEST['id'])) {
         wp_die(__('Invalid sales log ID', 'wpsc'));
     }
     global $purchlogitem;
     $this->log_id = (int) $_REQUEST['id'];
     $purchlogitem = new wpsc_purchaselogs_items($this->log_id);
     $columns = array('title' => __('Item Name', 'wpsc'), 'sku' => __('SKU', 'wpsc'), 'quantity' => __('Quantity', 'wpsc'), 'price' => __('Price', 'wpsc'), 'shipping' => __('Item Shipping', 'wpsc'));
     if (wpec_display_product_tax()) {
         $columns['tax'] = __('Item Tax', 'wpsc');
     }
     $columns['total'] = __('Item Total', 'wpsc');
     $cols = count($columns) - 2;
     register_column_headers('wpsc_purchase_log_item_details', $columns);
     if (file_exists(get_stylesheet_directory() . '/wpsc-packing-slip.php')) {
         $packing_slip_file = get_stylesheet_directory() . '/wpsc-packing-slip.php';
     } else {
         $packing_slip_file = 'includes/purchase-logs-page/packing-slip.php';
     }
     $packing_slip_file = apply_filters('wpsc_packing_packing_slip_path', $packing_slip_file);
     include $packing_slip_file;
     exit;
 }
Exemplo n.º 28
0
function wpsc_display_coupons_page()
{
    global $wpdb;
    if (isset($_POST) && is_array($_POST) && !empty($_POST)) {
        if (isset($_POST['add_coupon']) && $_POST['add_coupon'] == 'true' && (!isset($_POST['is_edit_coupon']) || !($_POST['is_edit_coupon'] == 'true'))) {
            $coupon_code = $_POST['add_coupon_code'];
            $discount = (double) $_POST['add_discount'];
            $discount_type = (int) $_POST['add_discount_type'];
            $use_once = (int) (bool) $_POST['add_use-once'];
            $every_product = (int) (bool) $_POST['add_every_product'];
            $is_active = (int) (bool) $_POST['add_active'];
            $start_date = date('Y-m-d', strtotime($_POST['add_start'])) . " 00:00:00";
            $end_date = date('Y-m-d', strtotime($_POST['add_end'])) . " 00:00:00";
            $rules = $_POST['rules'];
            foreach ($rules as $key => $rule) {
                foreach ($rule as $k => $r) {
                    $new_rule[$k][$key] = $r;
                }
            }
            foreach ($new_rule as $key => $rule) {
                if ('' == $rule['value']) {
                    unset($new_rule[$key]);
                }
            }
            $insert = $wpdb->insert(WPSC_TABLE_COUPON_CODES, array('coupon_code' => $coupon_code, 'value' => $discount, 'is-percentage' => $discount_type, 'use-once' => $use_once, 'is-used' => 0, 'active' => $is_active, 'every_product' => $every_product, 'start' => $start_date, 'expiry' => $end_date, 'condition' => serialize($new_rule)), array('%s', '%f', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
            if ($insert) {
                echo "<div class='updated'><p align='center'>" . esc_html__('Thanks, the coupon has been added.', 'wpsc') . "</p></div>";
            }
        }
        if (isset($_POST['is_edit_coupon']) && $_POST['is_edit_coupon'] == 'true' && !isset($_POST['delete_condition']) && !isset($_POST['submit_condition'])) {
            foreach ((array) $_POST['edit_coupon'] as $coupon_id => $coupon_data) {
                $coupon_id = (int) $coupon_id;
                $coupon_data['start'] = get_gmt_from_date($coupon_data['start'] . " 00:00:00");
                $coupon_data['expiry'] = get_gmt_from_date($coupon_data['expiry'] . " 23:59:59");
                $check_values = $wpdb->get_row($wpdb->prepare("SELECT `id`, `coupon_code`, `value`, `is-percentage`, `use-once`, `active`, `start`, `expiry`,`every_product` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d", $coupon_id), ARRAY_A);
                // Sort both arrays to make sure that if they contain the same stuff,
                // that they will compare to be the same, may not need to do this, but what the heck
                if ($check_values != null) {
                    ksort($check_values);
                }
                ksort($coupon_data);
                if ($check_values != $coupon_data) {
                    $insert_array = array();
                    foreach ($coupon_data as $coupon_key => $coupon_value) {
                        if ($coupon_key == "submit_coupon" || $coupon_key == "delete_coupon") {
                            continue;
                        }
                        if (isset($check_values[$coupon_key]) && $coupon_value != $check_values[$coupon_key]) {
                            $insert_array[] = "`{$coupon_key}` = '{$coupon_value}'";
                        }
                    }
                    if (isset($check_values['every_product']) && $coupon_data['add_every_product'] != $check_values['every_product']) {
                        $insert_array[] = "`every_product` = '{$coupon_data['add_every_product']}'";
                    }
                    if (count($insert_array) > 0) {
                        $wpdb->query($wpdb->prepare("UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET " . implode(", ", $insert_array) . " WHERE `id` = %d LIMIT 1;", $coupon_id));
                    }
                    unset($insert_array);
                    $rules = $_POST['rules'];
                    foreach ((array) $rules as $key => $rule) {
                        foreach ($rule as $k => $r) {
                            $new_rule[$k][$key] = $r;
                        }
                    }
                    foreach ((array) $new_rule as $key => $rule) {
                        if ($rule['value'] == '') {
                            unset($new_rule[$key]);
                        }
                    }
                    $conditions = $wpdb->get_var($wpdb->prepare("SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d LIMIT 1", $_POST['coupon_id']));
                    $conditions = unserialize($conditions);
                    $new_cond = array();
                    if ($_POST['rules']['value'][0] != '') {
                        $new_cond['property'] = $_POST['rules']['property'][0];
                        $new_cond['logic'] = $_POST['rules']['logic'][0];
                        $new_cond['value'] = $_POST['rules']['value'][0];
                        $conditions[] = $new_cond;
                    }
                    $wpdb->update(WPSC_TABLE_COUPON_CODES, array('condition' => serialize($conditions)), array('id' => $_POST['coupon_id']), '%s', '%d');
                }
            }
        }
        if (isset($_POST['delete_condition'])) {
            $conditions = $wpdb->get_var($wpdb->prepare("SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d LIMIT 1", $_POST['coupon_id']));
            $conditions = unserialize($conditions);
            unset($conditions[(int) $_POST['delete_condition']]);
            $wpdb->update(WPSC_TABLE_COUPON_CODES, array('condition' => serialize($conditions)), array('id' => $_POST['coupon_id']), '%s', '%d');
        }
        if (isset($_POST['submit_condition'])) {
            $conditions = $wpdb->get_var("SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int) $_POST['coupon_id'] . "' LIMIT 1");
            $conditions = unserialize($conditions);
            $new_cond = array();
            $new_cond['property'] = $_POST['rules']['property'][0];
            $new_cond['logic'] = $_POST['rules']['logic'][0];
            $new_cond['value'] = $_POST['rules']['value'][0];
            $conditions[] = $new_cond;
            $wpdb->update(WPSC_TABLE_COUPON_CODES, array('condition' => serialize($conditions)), array('id' => $_POST['coupon_id']), '%s', '%d');
        }
    }
    $currency_data = $wpdb->get_row("SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . esc_attr(get_option('currency_type')) . "' LIMIT 1", ARRAY_A);
    $currency_sign = !empty($currency_data['symbol']) ? $currency_data['symbol_html'] : $currency_data['code'];
    ?>

	<script type='text/javascript'>
		jQuery(".pickdate").datepicker();
		/* jQuery datepicker selector */
		if (typeof jQuery('.pickdate').datepicker != "undefined") {
			jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
		}
	</script>

	<div class="wrap">
		<h2>
			<?php 
    esc_html_e('Coupons', 'wpsc');
    ?>
			<a href="#" id="add_coupon_box_link" class="add_item_link button add-new-h2" onClick="return show_status_box( 'add_coupon_box', 'add_coupon_box_link' );">
				<?php 
    esc_html_e('Add New', 'wpsc');
    ?>
			</a>
		</h2>

		<table style="width: 100%;">
			<tr>
				<td id="coupon_data">
					<div id='add_coupon_box' class='modify_coupon' >
						<form name='add_coupon' method='post' action=''>
							<table class='add-coupon' >
								<tr>
									<th><?php 
    esc_html_e('Coupon Code', 'wpsc');
    ?>
</th>
									<th><?php 
    esc_html_e('Discount', 'wpsc');
    ?>
</th>
									<th><?php 
    esc_html_e('Start', 'wpsc');
    ?>
</th>
									<th><?php 
    esc_html_e('Expiry', 'wpsc');
    ?>
</th>
								</tr>
								<tr>
									<td>
										<input type='text' value='' name='add_coupon_code' />
									</td>
									<td>
										<input type='text' value='' size='3' name='add_discount' />
										<select name='add_discount_type'>
											<option value='0' ><?php 
    echo esc_html($currency_sign);
    ?>
</option>
											<option value='1' ><?php 
    _ex('%', 'Percentage sign as discount type in coupons page', 'wpsc');
    ?>
</option>
											<option value='2' ><?php 
    esc_html_e('Free shipping', 'wpsc');
    ?>
</option>
										</select>
									</td>
									<td>
										<input type='text' class='pickdate' size='11' value="<?php 
    echo date('Y-m-d');
    ?>
" name='add_start' />
									</td>
									<td>
										<input type='text' class='pickdate' size='11' name='add_end' value="<?php 
    echo date('Y') + 1 . date('-m-d');
    ?>
">
									</td>
									<td>
										<input type='hidden' value='true' name='add_coupon' />
										<input type='submit' value='<?php 
    esc_attr_e('Add Coupon', 'wpsc');
    ?>
' name='submit_coupon' class='button-primary' />
									</td>
								</tr>

								<tr>
									<td colspan='3' scope="row">
										<p>
											<span class='input_label'><?php 
    esc_html_e('Active', 'wpsc');
    ?>
</span><input type='hidden' value='0' name='add_active' />
											<input type='checkbox' value='1' checked='checked' name='add_active' />
											<span class='description'><?php 
    esc_html_e('Activate coupon on creation.', 'wpsc');
    ?>
</span>
										</p>
									</td>
								</tr>

								<tr>
									<td colspan='3' scope="row">
										<p>
											<span class='input_label'><?php 
    esc_html_e('Use Once', 'wpsc');
    ?>
</span><input type='hidden' value='0' name='add_use-once' />
											<input type='checkbox' value='1' name='add_use-once' />
											<span class='description'><?php 
    esc_html_e('Deactivate coupon after it has been used.', 'wpsc');
    ?>
</span>
										</p>
									</td>
								</tr>

								<tr>
									<td colspan='3' scope="row">
										<p>
											<span class='input_label'><?php 
    esc_html_e('Apply On All Products', 'wpsc');
    ?>
</span><input type='hidden' value='0' name='add_every_product' />
											<input type="checkbox" value="1" name='add_every_product'/>
											<span class='description'><?php 
    esc_html_e('This coupon affects each product at checkout.', 'wpsc');
    ?>
</span>
										</p>
									</td>
								</tr>

								<tr><td colspan='3'><span id='table_header'><?php 
    esc_html_e('Conditions', 'wpsc');
    ?>
</span></td></tr>
								<tr>
									<td colspan="8">
									<div class='coupon_condition' >
										<div class='first_condition'>
											<select class="ruleprops" name="rules[property][]">
												<option value="item_name" rel="order"><?php 
    esc_html_e('Item name', 'wpsc');
    ?>
</option>
												<option value="item_quantity" rel="order"><?php 
    esc_html_e('Item quantity', 'wpsc');
    ?>
</option>
												<option value="total_quantity" rel="order"><?php 
    esc_html_e('Total quantity', 'wpsc');
    ?>
</option>
												<option value="subtotal_amount" rel="order"><?php 
    esc_html_e('Subtotal amount', 'wpsc');
    ?>
</option>
												<?php 
    echo apply_filters('wpsc_coupon_rule_property_options', '');
    ?>
											</select>

											<select name="rules[logic][]">
												<option value="equal"><?php 
    esc_html_e('Is equal to', 'wpsc');
    ?>
</option>
												<option value="greater"><?php 
    esc_html_e('Is greater than', 'wpsc');
    ?>
</option>
												<option value="less"><?php 
    esc_html_e('Is less than', 'wpsc');
    ?>
</option>
												<option value="contains"><?php 
    esc_html_e('Contains', 'wpsc');
    ?>
</option>
												<option value="not_contain"><?php 
    esc_html_e('Does not contain', 'wpsc');
    ?>
</option>
												<option value="begins"><?php 
    esc_html_e('Begins with', 'wpsc');
    ?>
</option>
												<option value="ends"><?php 
    esc_html_e('Ends with', 'wpsc');
    ?>
</option>
												<option value="category"><?php 
    esc_html_e('In Category', 'wpsc');
    ?>
</option>
											</select>

											<span><input type="text" name="rules[value][]"/></span>
											<script>
												var coupon_number=1;
												function add_another_property(this_button){
													var new_property='<div class="coupon_condition">\n'+
														'<div> \n'+
														'<select class="ruleprops" name="rules[property][]"> \n'+
														'<option value="item_name" rel="order"><?php 
    echo esc_js(__('Item name', 'wpsc'));
    ?>
</option> \n'+
														'<option value="item_quantity" rel="order"><?php 
    echo esc_js(__('Item quantity', 'wpsc'));
    ?>
</option>\n'+
														'<option value="total_quantity" rel="order"><?php 
    echo esc_js(__('Total quantity', 'wpsc'));
    ?>
</option>\n'+
														'<option value="subtotal_amount" rel="order"><?php 
    echo esc_js(__('Subtotal amount', 'wpsc'));
    ?>
</option>\n'+
														'<?php 
    echo apply_filters('wpsc_coupon_rule_property_options', '');
    ?>
'+
														'</select> \n'+
														'<select name="rules[logic][]"> \n'+
														'<option value="equal"><?php 
    echo esc_js(__('Is equal to', 'wpsc'));
    ?>
</option> \n'+
														'<option value="greater"><?php 
    echo esc_js(__('Is greater than', 'wpsc'));
    ?>
</option> \n'+
														'<option value="less"><?php 
    echo esc_js(__('Is less than', 'wpsc'));
    ?>
</option> \n'+
														'<option value="contains"><?php 
    echo esc_js(__('Contains', 'wpsc'));
    ?>
</option> \n'+
														'<option value="not_contain"><?php 
    echo esc_js(__('Does not contain', 'wpsc'));
    ?>
</option> \n'+
														'<option value="begins"><?php 
    echo esc_js(__('Begins with', 'wpsc'));
    ?>
</option> \n'+
														'<option value="ends"><?php 
    echo esc_js(__('Ends with', 'wpsc'));
    ?>
</option> \n'+
														'</select> \n'+
														'<span> \n'+
														'<input type="text" name="rules[value][]"/> \n'+
														'</span>  \n'+
														'<img height="16" width="16" class="delete" alt="<?php 
    esc_attr_e('Delete', 'wpsc');
    ?>
" src="<?php 
    echo WPSC_CORE_IMAGES_URL;
    ?>
/cross.png" onclick="jQuery(this).parent().remove();"/></div> \n'+
														'</div> ';

													jQuery('#coupon_data .coupon_condition :last').after(new_property);
													coupon_number++;
												}
											</script>
										</div>
									</div>
								</tr>

								<tr>
									<td>
										<a class="wpsc_coupons_condition_add" onclick="add_another_property(jQuery(this));">
											<?php 
    esc_html_e('Add New Condition', 'wpsc');
    ?>
										</a>
									</td>
								</tr>
							</table>
						</form>
					</div>
				</td>
			</tr>
		</table>

		<?php 
    $columns = array('coupon_code' => __('Coupon Code', 'wpsc'), 'discount' => __('Discount', 'wpsc'), 'start' => __('Start', 'wpsc'), 'expiry' => __('Expiry', 'wpsc'), 'active' => __('Active', 'wpsc'), 'apply_on_prods' => __('Apply On All Products', 'wpsc'), 'edit' => __('Edit', 'wpsc'));
    register_column_headers('display-coupon-details', $columns);
    ?>

		<table class="coupon-list widefat" cellspacing="0">
			<thead>
				<tr>
					<?php 
    print_column_headers('display-coupon-details');
    ?>
				</tr>
			</thead>

			<tfoot>
				<tr>
					<?php 
    print_column_headers('display-coupon-details', false);
    ?>
				</tr>
			</tfoot>

			<tbody>
				<?php 
    $i = 0;
    $coupon_data = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` ", ARRAY_A);
    foreach ((array) $coupon_data as $coupon) {
        $alternate = "";
        $i++;
        if ($i % 2 != 0) {
            $alternate = "class='alt'";
        }
        $start = get_date_from_gmt($coupon['start'], 'd/m/Y');
        $expiry = get_date_from_gmt($coupon['expiry'], 'd/m/Y');
        echo "<tr {$alternate}>\n\r";
        echo "    <td>\n\r";
        echo esc_attr($coupon['coupon_code']);
        echo "    </td>\n\r";
        echo "    <td>\n\r";
        if ($coupon['is-percentage'] == 1) {
            echo esc_attr($coupon['value']) . "%";
        } else {
            if ($coupon['is-percentage'] == 2) {
                _e('Free Shipping', 'wpsc');
            } else {
                echo wpsc_currency_display(esc_attr($coupon['value']));
            }
        }
        echo "    </td>\n\r";
        echo "    <td>\n\r";
        echo $start;
        echo "    </td>\n\r";
        echo "    <td>\n\r";
        echo $expiry;
        echo "    </td>\n\r";
        echo "    <td>\n\r";
        switch ($coupon['active']) {
            case 1:
                echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
                break;
            case 0:
            default:
                echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
                break;
        }
        echo "    </td>\n\r";
        echo "    <td>\n\r";
        switch ($coupon['every_product']) {
            case 1:
                echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
                break;
            case 0:
            default:
                echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
                break;
        }
        echo "    </td>\n\r";
        echo "    <td>\n\r";
        echo "<a title='" . esc_attr($coupon['coupon_code']) . "' href='#' rel='" . $coupon['id'] . "' class='wpsc_edit_coupon'  >" . esc_html__('Edit', 'wpsc') . "</a>";
        echo "    </td>\n\r";
        echo "  </tr>\n\r";
        echo "  <tr class='coupon_edit'>\n\r";
        echo "    <td colspan='7' style='padding-left:0px;'>\n\r";
        echo "      <div id='coupon_box_" . $coupon['id'] . "' class='displaynone modify_coupon' >\n\r";
        coupon_edit_form($coupon);
        echo "      </div>\n\r";
        echo "    </td>\n\r";
        echo "  </tr>\n\r";
    }
    ?>
			</tbody>
		</table>

		<p style='margin: 10px 0px 5px 0px;'>
			<?php 
    _e('<strong>Note:</strong> Due to a current PayPal limitation, when a purchase is made using a coupon we cannot send a detailed list of items through for processing. Instead we send the total amount of the purchase so the customer will see your shop name and the total within PayPal.', 'wpsc');
    ?>
		</p>

	</div>

<?php 
}
 /**
  * Includes the plugin's CSS and JavaScript in the header.
  * Also includes a module's CSS/JavaScript on its administration page.
  * 
  * @todo Link to global plugin includes only when on plugin pages.
  * 
  * @since 0.1
  * @uses $modules
  * @uses $plugin_file_url
  * @uses $plugin_dir_url
  * @uses hook_to_key()
  */
 function admin_includes()
 {
     //Global CSS/JS
     $this->queue_css('plugin', 'global');
     $this->queue_js('plugin', 'global');
     //SDF Styling
     if ($this->is_plugin_admin_page()) {
         $sdf_ads_localized_data = array('sdf_banners_url' => $this->plugin_dir_url . 'modules/sdf-ads/banners/');
         $this->queue_js('modules/sdf-ads', 'sdf-ads', '', $sdf_ads_localized_data);
         $this->queue_css('modules/sdf-ads', 'sdf-ads');
         // white background
         $this->queue_css('plugin/sdf', 'sdf.wp');
         // overwrite submenu on wp 3.8+ with "light" color style
         global $_wp_admin_css_colors, $wp_version;
         if ($wp_version >= 3.8) {
             $color_scheme = get_user_option('admin_color');
             if (empty($_wp_admin_css_colors[$color_scheme])) {
                 $color_scheme = 'light';
             }
             if ('light' == $color_scheme) {
                 $this->queue_css('plugin/sdf', 'sdf.wp-color');
             }
         }
     }
     //load if SDF is not active
     global $pagenow;
     $current = isset($_GET['page']) ? $_GET['page'] : '';
     $pages = array('index.php', 'edit.php', 'post.php', 'post-new.php');
     $sdf_admin_pages = array('sdf', 'sdf-settings', 'sdf-silo', 'sdf-silo-manual-builder', 'sdf-header', 'sdf-layout', 'sdf-shortcode', 'sdf-styles', 'revslider', 'sdf-footer', 'seo', 'su-fofs', 'su-misc', 'su-user-code', 'su-autolinks', 'su-files', 'su-internal-link-aliases', 'su-meta-descriptions', 'su-meta-keywords', 'su-meta-robots', 'su-opengraph', 'seo-ultimate', 'su-wp-settings', 'su-titles', 'su-sds-blog');
     if (in_array($pagenow, $pages) || in_array($current, $sdf_admin_pages)) {
         // admin styles
         wp_register_style('sdf-bootstrap-admin', $this->plugin_dir_url . 'plugin/sdf/bootstrap/css/bootstrap.admin.css', array(), null, 'screen');
         wp_register_style('sdf-bootstrap-admin-theme', $this->plugin_dir_url . 'plugin/sdf/bootstrap/css/bootstrap-theme.admin.css', array(), null, 'screen');
         wp_register_style('sdf-font-awesome', 'https://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array(), null, 'screen');
         wp_register_style('seo-css-admin', $this->plugin_dir_url . 'plugin/seo.admin.css', array(), null, 'screen');
         wp_enqueue_style('sdf-bootstrap-admin');
         wp_enqueue_style('sdf-bootstrap-admin-theme');
         wp_enqueue_style('sdf-font-awesome');
         wp_enqueue_style('seo-css-admin');
         wp_register_script('sdf_bs_js_admin', $this->plugin_dir_url . 'plugin/sdf/bootstrap/js/bootstrap.js', array('jquery'), null, true);
         wp_register_script('media_upload_js', $this->plugin_dir_url . 'plugin/sdf/sdf.media.upload.js', array('jquery'), '');
         wp_enqueue_script('sdf_bs_js_admin');
         wp_enqueue_script('media_upload_js');
         wp_enqueue_media();
     }
     // load dashboard widget
     $sdf_ads_localized_data = array('sdf_banners_url' => $this->plugin_dir_url . 'modules/sdf-ads/banners/');
     if ($pagenow == 'index.php') {
         $this->queue_js('modules/sdf-ads', 'sdf-ads', '', $sdf_ads_localized_data);
     }
     //Figure out what plugin admin page we're on
     global $plugin_page;
     $pp = $this->hook_to_key($plugin_page);
     if (strlen($pp)) {
         $outputted_module_files = false;
         foreach ($this->modules as $key => $module) {
             //Does the current admin page belong to this module?
             if (strcmp($key, $pp) == 0) {
                 //Output AJAX page var fix
                 echo "\n<script type='text/javascript'>pagenow = '" . su_esc_attr($module->plugin_page_hook) . "';</script>\n";
             }
             //Does the current admin page belong to this module or its parent?
             if (strcmp($key, $pp) == 0 || strcmp($module->get_parent_module(), $pp) == 0) {
                 //We're viewing a module page, so print links to the CSS/JavaScript files loaded for all modules
                 if (!$outputted_module_files) {
                     $this->queue_css('modules', 'modules');
                     $this->queue_js('modules', 'modules', array('jquery'), array('unloadConfirmMessage' => __("It looks like you made changes to the settings of this SEO Ultimate module. If you leave before saving, those changes will be lost.", 'seo-ultimate')));
                     $outputted_module_files = true;
                 }
                 //Print links to the module's CSS and JavaScript.
                 $this->queue_css($module->module_dir_rel_url, $module->get_module_key());
                 $this->queue_js($module->module_dir_rel_url, $module->get_module_key());
                 //Queue up the module's columns, if any
                 if (count($columns = $module->get_admin_table_columns())) {
                     register_column_headers($module->plugin_page_hook, $columns);
                 }
             }
         }
     }
 }
Exemplo n.º 30
0
function wpsc_display_sales_log_index()
{
    global $purchlogitem;
    ?>
   <div class="wrap">
      <h2><?php 
    echo esc_html(__('Sales', 'wpsc'));
    ?>
 </h2>
      <?php 
    //START OF PURCHASE LOG DEFAULT VIEW
    ?>
      <?php 
    if (isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status'])) {
        wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
    }
    if (isset($_POST['purchlogs_searchbox'])) {
        wpsc_search_purchlog_view($_POST['purchlogs_searchbox']);
    }
    if (!isset($_REQUEST['purchaselog_id'])) {
        $columns = array('cb' => '<input type="checkbox" />', 'purchid' => __('Order ID', 'wpsc'), 'date' => __('Date / Time', 'wpsc'), 'name' => '', 'amount' => __('Amount', 'wpsc'), 'details' => __('Details', 'wpsc'), 'status' => __('Status', 'wpsc'), 'delete' => __('Delete', 'wpsc'), 'track' => __('Tracking ID', 'wpsc'));
        register_column_headers('display-sales-list', $columns);
        ///// start of update message section //////
        $fixpage = get_option('siteurl') . '/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
        if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked'])) {
            ?>
         <div id="message" class="updated fade"><p>
         <?php 
            if (isset($_GET['updated']) && (int) $_GET['updated']) {
                printf(_n('%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated'], 'wpsc'), absint($_GET['updated']));
                unset($_GET['updated']);
            }
            if (isset($_GET['skipped']) && (int) $_GET['skipped']) {
                unset($_GET['skipped']);
            }
            if (isset($_GET['locked']) && (int) $_GET['locked']) {
                printf(_n('%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked'], 'wpsc'), absint($_GET['locked']));
                unset($_GET['locked']);
            }
            if (isset($_GET['deleted']) && (int) $_GET['deleted']) {
                printf(_n('%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted'], 'wpsc'), absint($_GET['deleted']));
                unset($_GET['deleted']);
            }
            ?>
         </p></div>
      <?php 
        }
        if (get_option('wpsc_purchaselogs_fixed') == false || wpsc_check_uniquenames()) {
            ?>
            <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php 
            printf(__('When upgrading the WP e-Commerce Plugin from 3.6.* to 3.7 it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">Click Here</a>', 'wpsc'), $fixpage);
            ?>
</span></div>
   <?php 
        }
        ///// end of update message section //////
        ?>
      <div id='dashboard-widgets' style='min-width: 825px;'>
         <?php 
        /* end of sidebar start of main column */
        ?>
         <div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
            <div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>

            <?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        do_meta_boxes('dashboard_page_wpsc-sales-logs', 'top', true);
        ?>
               </div><br />
               <div id='wpsc_purchlog_searchbox'>
                  <?php 
        wpsc_purchaselogs_searchbox();
        ?>
               </div><br />
                  <?php 
        wpsc_purchaselogs_displaylist();
        ?>

         </div>
         <script type="text/javascript">
         	jQuery(document).ready(function(){postboxes.add_postbox_toggles(pagenow);});
         </script>
      </div>
      <?php 
    } else {
        //NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
        if (isset($_REQUEST['purchaselog_id'])) {
            $purchlogitem = new wpsc_purchaselogs_items((int) $_REQUEST['purchaselog_id']);
        }
        if (isset($_GET['cleared']) || isset($_GET['cleared'])) {
            ?>
         <div id="message" class="updated fade"><p>
         <?php 
            if (isset($_GET['cleared']) && $_GET['cleared'] == true) {
                _e('Downloads for this log have been released.', 'wpsc');
                unset($_GET['cleared']);
            }
            if (isset($_GET['sent']) && (int) $_GET['sent']) {
                _e('Receipt has been resent ', 'wpsc');
                unset($_GET['sent']);
            }
            ?>
 </p></div>
         <?php 
        }
        ?>


         <?php 
        $page_back = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'purchaselog_id'), $_SERVER['REQUEST_URI']);
        $columns = array('title' => __('Name', 'wpsc'), 'sku' => __('SKU', 'wpsc'), 'quantity' => __('Quantity', 'wpsc'), 'price' => __('Price', 'wpsc'), 'shipping' => __('Shipping', 'wpsc'), 'tax' => '', 'total' => __('Total', 'wpsc'));
        if (wpec_display_product_tax()) {
            $columns['tax'] = __('Tax Included', 'wpsc');
        }
        // if
        register_column_headers('display-purchaselog-details', $columns);
        ?>
         <div id='post-body' class='has-sidebar' style='width:95%;'>
            <?php 
        if (wpsc_has_purchlog_shipping()) {
            ?>
            <div id='wpsc_shipping_details_box'>
               <h3><?php 
            _e('Shipping Address', 'wpsc');
            ?>
</h3>
               <p><strong><?php 
            echo wpsc_display_purchlog_shipping_name();
            ?>
</strong></p>
               <p>
               <?php 
            echo wpsc_display_purchlog_shipping_address();
            ?>
<br />
               <?php 
            echo wpsc_display_purchlog_shipping_city();
            ?>
<br />
               <?php 
            echo wpsc_display_purchlog_shipping_state_and_postcode();
            ?>
<br />
               <?php 
            echo wpsc_display_purchlog_shipping_country();
            ?>
<br />
               </p>
               <strong><?php 
            _e('Shipping Options', 'wpsc');
            ?>
</strong>
               <p>

               <?php 
            _e('Shipping Method:', 'wpsc');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_method();
            ?>
<br />
               <?php 
            _e('Shipping Option:', 'wpsc');
            ?>
 <?php 
            echo wpsc_display_purchlog_shipping_option();
            ?>
<br />
               <?php 
            if (wpsc_purchlogs_has_tracking()) {
                ?>
                  <?php 
                _e('Tracking ID:', 'wpsc');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackid();
                ?>
<br />
                  <?php 
                _e('Shipping Status:', 'wpsc');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackstatus();
                ?>
<br />
                  <?php 
                _e('Track History:', 'wpsc');
                ?>
 <?php 
                echo wpsc_purchlogitem_trackhistory();
                ?>
               <?php 
            }
            ?>
               </p>
            </div>
            <?php 
        }
        ?>
            <div id='wpsc_billing_details_box'>
	           <?php 
        do_action('wpsc_billing_details_top');
        ?>
               <h3><?php 
        _e('Billing Details', 'wpsc');
        ?>
</h3>
               <p><strong><?php 
        _e('Purchase Log Date:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_date();
        ?>
 </p>
               <p><strong><?php 
        _e('Purchase Number:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_purchaselog_details_purchnumber();
        ?>
 </p>
               <p><strong><?php 
        _e('Buyers Name:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_name();
        ?>
</p>
               <p><strong><?php 
        _e('Address:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_address();
        ?>
</p>

               <p><strong><?php 
        _e('Phone:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_buyers_phone();
        ?>
</p>
               <p><strong><?php 
        _e('Email:', 'wpsc');
        ?>
 </strong><a href="mailto:<?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
?subject=Message From '<?php 
        echo get_option('siteurl');
        ?>
'"><?php 
        echo wpsc_display_purchlog_buyers_email();
        ?>
</a></p>
               <p><strong><?php 
        _e('Payment Method:', 'wpsc');
        ?>
 </strong><?php 
        echo wpsc_display_purchlog_paymentmethod();
        ?>
</p>
               <?php 
        if (wpsc_display_purchlog_display_howtheyfoundus()) {
            ?>
               <p><strong><?php 
            _e('How User Found Us:', 'wpsc');
            ?>
 </strong><?php 
            echo wpsc_display_purchlog_howtheyfoundus();
            ?>
</p>
               <?php 
        }
        ?>
               <?php 
        do_action('wpsc_billing_details_bottom');
        ?>
            </div>

            <div id='wpsc_items_ordered'>
               <br />
               <h3><?php 
        _e('Items Ordered', 'wpsc');
        ?>
</h3>
               <table class="widefat" cellspacing="0">
                  <thead>
                     <tr>
                  <?php 
        print_column_headers('display-purchaselog-details');
        ?>
                     </tr>
                  </thead>

                  <tfoot>
                  </tfoot>

                  <tbody>
                  <?php 
        wpsc_display_purchlog_details();
        ?>
                  <tr> &nbsp;</tr>

                  <tr class="wpsc_purchaselog_start_totals">
                     <td colspan="5">
                        <?php 
        if (wpsc_purchlog_has_discount_data()) {
            ?>
                        <?php 
            _e('Coupon Code', 'wpsc');
            ?>
: <?php 
            echo wpsc_display_purchlog_discount_data();
            ?>
                        <?php 
        }
        ?>
                     </td>
                     <th><?php 
        _e('Discount', 'wpsc');
        ?>
 </th>
                     <td><?php 
        echo wpsc_display_purchlog_discount();
        ?>
</td>
                  </tr>

                  <?php 
        if (!wpec_display_product_tax()) {
            ?>
                     <tr>
                        <td colspan='5'></td>
                        <th><?php 
            _e('Taxes', 'wpsc');
            ?>
 </th>
                        <td><?php 
            echo wpec_display_purchlog_taxes();
            ?>
</td>
                     </tr>
                  <?php 
        }
        ?>

                  <tr>
                     <td colspan='5'></td>
                     <th><?php 
        _e('Shipping', 'wpsc');
        ?>
 </th>
                     <td><?php 
        echo wpsc_display_purchlog_shipping();
        ?>
</td>
                  </tr>
                  <tr>
                     <td colspan='5'></td>
                     <th><?php 
        _e('Total', 'wpsc');
        ?>
 </th>
                     <td><?php 
        echo wpsc_display_purchlog_totalprice();
        ?>
</td>
                  </tr>
                  </tbody>
            </table>
            <div id='wpsc_purchlog_order_status'>
               <form action='' method='post'>
               <p><label for='<?php 
        echo $_GET['purchaselog_id'];
        ?>
'><?php 
        _e('Order Status:', 'wpsc');
        ?>
</label><select class='selector' name='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' title='<?php 
        echo $_GET['purchaselog_id'];
        ?>
' >
            <?php 
        while (wpsc_have_purch_items_statuses()) {
            wpsc_the_purch_status();
            ?>
               <option value='<?php 
            echo wpsc_the_purch_status_id();
            ?>
' <?php 
            echo wpsc_purchlog_is_checked_status();
            ?>
 ><?php 
            echo wpsc_the_purch_status_name();
            ?>
 </option>
            <?php 
        }
        ?>
               </select></p>
               </form>
         </div>
            <?php 
        wpsc_purchlogs_custom_fields();
        ?>


            <!-- Start Order Notes (by Ben) -->
            <?php 
        wpsc_purchlogs_notes();
        ?>
            <!-- End Order Notes (by Ben) -->

            <?php 
        wpsc_custom_checkout_fields();
        ?>

            </div>
            </div>

            <div id='wpsc_purchlogitems_links'>
            <h3><?php 
        _e('Actions', 'wpsc');
        ?>
</h3>
            <?php 
        do_action('wpsc_purchlogitem_links_start');
        ?>
            <?php 
        if (wpsc_purchlogs_have_downloads_locked() != false) {
            ?>
<img src='<?php 
            echo WPSC_CORE_IMAGES_URL;
            ?>
/lock_open.png' alt='clear lock icon' />&ensp;<a href='<?php 
            echo $_SERVER['REQUEST_URI'] . '&amp;wpsc_admin_action=clear_locks';
            ?>
'><?php 
            echo wpsc_purchlogs_have_downloads_locked();
            ?>
</a><br /><br class='small' />
            <?php 
        }
        ?>
<img src='<?php 
        echo WPSC_CORE_IMAGES_URL;
        ?>
/printer.png' alt='printer icon' />&ensp;<a href='<?php 
        echo add_query_arg('wpsc_admin_action', 'wpsc_display_invoice');
        ?>
'><?php 
        _e('View Packing Slip', 'wpsc');
        ?>
</a>

<br /><br class='small' /><img src='<?php 
        echo WPSC_CORE_IMAGES_URL;
        ?>
/email_go.png' alt='email icon' />&ensp;<a href='<?php 
        echo add_query_arg('email_buyer_id', $_GET['purchaselog_id']);
        ?>
'><?php 
        _e('Resend Receipt to Buyer', 'wpsc');
        ?>
</a>

<br /><br class='small' /><a class='submitdelete' title='<?php 
        echo esc_attr(__('Delete this log', 'wpsc'));
        ?>
' href='<?php 
        echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=" . $_GET['purchaselog_id'], 'delete_purchlog_' . $_GET['purchaselog_id']);
        ?>
' onclick="if ( confirm(' <?php 
        echo esc_js(sprintf(__("You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.", 'wpsc'), wpsc_purchaselog_details_date()));
        ?>
') ) { return true;}return false;"><img src='<?php 
        echo WPSC_CORE_IMAGES_URL . "/cross.png";
        ?>
' alt='delete icon' />               &nbsp;<?php 
        _e('Remove this record', 'wpsc');
        ?>
</a>

<br /><br class='small' />&emsp;&ensp;    <a href='<?php 
        echo $page_back;
        ?>
'><?php 
        _e('Go Back', 'wpsc');
        ?>
</a>
<br /><br />
         </div>
         </div>
         <br />
         <?php 
    }
    ?>
   </div>
   <?php 
}