예제 #1
0
파일: Discounts.php 프로젝트: msigley/shopp
 public function screen()
 {
     if (!current_user_can('shopp_promotions')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $table = ShoppDatabaseObject::tablename(ShoppPromo::$table);
     $defaults = array('page' => false, 'status' => false, 'type' => false, 'paged' => 1, 'per_page' => 20, 's' => '');
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     $url = add_query_arg(array_merge($_GET, array('page' => $this->page)), admin_url('admin.php'));
     $f = array('action', 'selected', 's');
     $url = remove_query_arg($f, $url);
     $pagenum = absint($paged);
     $start = $per_page * ($pagenum - 1);
     $where = array();
     if (!empty($s)) {
         $where[] = "name LIKE '%{$s}%'";
     }
     if ($status) {
         $datesql = ShoppPromo::activedates();
         switch (strtolower($status)) {
             case 'active':
                 $where[] = "status='enabled' AND {$datesql}";
                 break;
             case 'inactive':
                 $where[] = "status='enabled' AND NOT {$datesql}";
                 break;
             case 'enabled':
                 $where[] = "status='enabled'";
                 break;
             case 'disabled':
                 $where[] = "status='disabled'";
                 break;
         }
     }
     if ($type) {
         switch (strtolower($type)) {
             case 'catalog':
                 $where[] = "target='Catalog'";
                 break;
             case 'cart':
                 $where[] = "target='Cart'";
                 break;
             case 'cartitem':
                 $where[] = "target='Cart Item'";
                 break;
         }
     }
     $select = sDB::select(array('table' => $table, 'columns' => 'SQL_CALC_FOUND_ROWS *', 'where' => $where, 'orderby' => 'created DESC', 'limit' => "{$start},{$per_page}"));
     $Promotions = sDB::query($select, 'array');
     $count = sDB::found();
     $num_pages = ceil($count / $per_page);
     $ListTable = ShoppUI::table_set_pagination($this->id, $count, $num_pages, $per_page);
     $states = array('active' => __('Active', 'Shopp'), 'inactive' => __('Not Active', 'Shopp'), 'enabled' => __('Enabled', 'Shopp'), 'disabled' => __('Disabled', 'Shopp'));
     $types = array('catalog' => __('Catalog Discounts', 'Shopp'), 'cart' => __('Cart Discounts', 'Shopp'), 'cartitem' => __('Cart Item Discounts', 'Shopp'));
     $num_pages = ceil($count / $per_page);
     $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'total' => $num_pages, 'current' => $pagenum));
     include $this->ui('discounts.php');
 }
예제 #2
0
파일: ui.php 프로젝트: forthrobot/inuvik
function images_meta_box($Category)
{
    ?>
	<ul id="lightbox">
		<?php 
    if (isset($Category->images) && !empty($Category->images)) {
        ?>
		<?php 
        foreach ((array) $Category->images as $i => $Image) {
            ?>
			<li id="image-<?php 
            echo $Image->id;
            ?>
"><input type="hidden" name="images[]" value="<?php 
            echo $Image->id;
            ?>
" />
			<div id="image-<?php 
            echo $Image->id;
            ?>
-details">
				<img src="?siid=<?php 
            echo $Image->id;
            ?>
&amp;<?php 
            echo $Image->resizing(96, 0, 1);
            ?>
" width="96" height="96" />
				<input type="hidden" name="imagedetails[<?php 
            echo $i;
            ?>
][id]" value="<?php 
            echo $Image->id;
            ?>
" />
				<input type="hidden" name="imagedetails[<?php 
            echo $i;
            ?>
][title]" value="<?php 
            echo $Image->title;
            ?>
" class="imagetitle" />
				<input type="hidden" name="imagedetails[<?php 
            echo $i;
            ?>
][alt]" value="<?php 
            echo $Image->alt;
            ?>
"  class="imagealt" />
				<?php 
            if (count($Image->cropped) > 0) {
                foreach ($Image->cropped as $cache) {
                    $cropping = join(',', array($cache->settings['dx'], $cache->settings['dy'], $cache->settings['cropscale']));
                    $c = "{$cache->width}:{$cache->height}";
                    ?>
					<input type="hidden" name="imagedetails[<?php 
                    echo $i;
                    ?>
][cropping][<?php 
                    echo $cache->id;
                    ?>
]" alt="<?php 
                    echo $c;
                    ?>
" value="<?php 
                    echo $cropping;
                    ?>
" class="imagecropped" />
				<?php 
                }
            }
            ?>
			</div>
			<?php 
            echo ShoppUI::button('delete', 'deleteImage', array('type' => 'button', 'class' => 'delete deleteButton', 'value' => $Image->id, 'title' => Shopp::__('Remove image&hellip;')));
            ?>
			</li>
		<?php 
        }
    }
    ?>
	</ul>
	<div class="clear"></div>
	<input type="hidden" name="category" value="<?php 
    echo $_GET['id'];
    ?>
" id="image-category-id" />
	<input type="hidden" name="deleteImages" id="deleteImages" value="" />
	<div id="swf-uploader-button"></div>
	<div id="swf-uploader">
	<button type="button" class="button-secondary" name="add-image" id="add-image" tabindex="10"><small><?php 
    _e('Add New Image', 'Shopp');
    ?>
</small></button></div>
	<div id="browser-uploader">
		<button type="button" name="image_upload" id="image-upload" class="button-secondary"><small><?php 
    _e('Add New Image', 'Shopp');
    ?>
</small></button><br class="clear"/>
	</div>

	<p><?php 
    _e('Double-click images to edit their details. Save the product to confirm deleted images.', 'Shopp');
    ?>
</p>
<?php 
}
예제 #3
0
 public function editor($Item)
 {
     $data = array('${id}' => $Item->id, '${name}' => $Item->name, '${width}' => $Item->width, '${height}' => $Item->height, '${sharpen}' => $Item->sharpen, '${select_fit_' . $Item->fit . '}' => ' selected="selected"', '${select_quality_' . $Item->quality . '}' => ' selected="selected"');
     echo ShoppUI::template($this->editor, $data);
 }
예제 #4
0
파일: Pages.php 프로젝트: msigley/shopp
 public function editor($Item)
 {
     $data = array('${id}' => "edit-{$Item->name}-page", '${name}' => $Item->name, '${title}' => $Item->title, '${slug}' => $Item->slug, '${description}' => $Item->description);
     echo ShoppUI::template($this->editor, $data);
 }
예제 #5
0
파일: Reports.php 프로젝트: msigley/shopp
    /**
     * Renders the report table to the WP admin screen
     *
     * @author Jonathan Davis
     * @since 1.3
     *
     * @return void
     **/
    public function table()
    {
        extract($this->options, EXTR_SKIP);
        // Get only the records for this page
        $beginning = (int) ($paged - 1) * $per_page;
        $report = array_values($this->data);
        $report = array_slice($report, $beginning, $beginning + $per_page, true);
        unset($this->data);
        // Free memory
        ?>


			<table class="widefat" cellspacing="0">
				<thead>
				<tr><?php 
        ShoppUI::print_column_headers($this->screen);
        ?>
</tr>
				</thead>
			<?php 
        if (false !== $report && count($report) > 0) {
            ?>
				<tbody id="report" class="list stats">
				<?php 
            $columns = get_column_headers($this->screen);
            $hidden = get_hidden_columns($this->screen);
            $even = false;
            $records = 0;
            while (list($id, $data) = each($report)) {
                if ($records++ > $per_page) {
                    break;
                }
                ?>
					<tr<?php 
                if (!$even) {
                    echo " class='alternate'";
                }
                $even = !$even;
                ?>
>
				<?php 
                foreach ($columns as $column => $column_title) {
                    $classes = array($column, "column-{$column}");
                    if (in_array($column, $hidden)) {
                        $classes[] = 'hidden';
                    }
                    if (method_exists(get_class($this), $column)) {
                        ?>
							<td class="<?php 
                        echo esc_attr(join(' ', $classes));
                        ?>
"><?php 
                        echo call_user_func(array($this, $column), $data, $column, $column_title, $this->options);
                        ?>
</td>
						<?php 
                    } else {
                        ?>
							<td class="<?php 
                        echo esc_attr(join(' ', $classes));
                        ?>
">
							<?php 
                        do_action('shopp_manage_report_custom_column', $column, $column_title, $data);
                        ?>
							</td>
						<?php 
                    }
                }
                /* $columns */
                ?>
				</tr>
				<?php 
            }
            /* records */
            ?>

				<tr class="summary average">
					<?php 
            $averages = clone $this->totals;
            $first = true;
            foreach ($columns as $column => $column_title) {
                if ($first) {
                    $averages->id = $averages->period = $averages->{$column} = __('Average', 'Shopp');
                    $first = false;
                } else {
                    $value = isset($averages->{$column}) ? $averages->{$column} : null;
                    $total = isset($this->total) ? $this->total : 0;
                    if (null == $value) {
                        $averages->{$column} = '';
                    } elseif (0 === $total) {
                        $averages->{$column} = 0;
                    } else {
                        $averages->{$column} = $value / $total;
                    }
                }
                $classes = array($column, "column-{$column}");
                if (in_array($column, $hidden)) {
                    $classes[] = 'hidden';
                }
                ?>
						<td class="<?php 
                echo esc_attr(join(' ', $classes));
                ?>
">
							<?php 
                if (method_exists(get_class($this), $column)) {
                    echo call_user_func(array($this, $column), $averages, $column, $column_title, $this->options);
                } else {
                    do_action('shopp_manage_report_custom_column_average', $column, $column_title, $data);
                }
                ?>
						</td>
					<?php 
            }
            ?>
				</tr>
				<tr class="summary total">
					<?php 
            $first = true;
            foreach ($columns as $column => $column_title) {
                if ($first) {
                    $label = __('Total', 'Shopp');
                    $this->totals->id = $this->totals->period = $this->totals->{$column} = $label;
                    $first = false;
                }
                $classes = array($column, "column-{$column}");
                if (in_array($column, $hidden)) {
                    $classes[] = 'hidden';
                }
                ?>
						<td class="<?php 
                echo esc_attr(join(' ', $classes));
                ?>
">
							<?php 
                if (method_exists(get_class($this), $column)) {
                    echo call_user_func(array($this, $column), $this->totals, $column, $column_title, $this->options);
                } else {
                    do_action('shopp_manage_report_custom_column_total', $column, $column_title, $data);
                }
                ?>
						</td>
					<?php 
            }
            ?>
				</tr>

				</tbody>
			<?php 
        } else {
            ?>
				<tbody><tr><td colspan="<?php 
            echo count(get_column_headers($this->screen));
            ?>
"><?php 
            _e('No report data available.', 'Shopp');
            ?>
</td></tr></tbody>
			<?php 
        }
        ?>
			<tfoot>
			<tr><?php 
        ShoppUI::print_column_headers($this->screen, false);
        ?>
</tr>
			</tfoot>
			</table>
	<?php 
    }
예제 #6
0
파일: Taxes.php 프로젝트: msigley/shopp
 public function editor($Item)
 {
     extract($Item);
     $conditions = array();
     foreach ($rules as $ruleid => $rule) {
         $conditionals = array('${id}' => $edit, '${ruleid}' => $ruleid, '${property_menu}' => $this->property_menu($rule['p']), '${rulevalue}' => esc_attr($rule['v']));
         $conditions[] = str_replace(array_keys($conditionals), $conditionals, $this->template_conditional());
     }
     $localrates = array();
     foreach ($locals as $localename => $localerate) {
         $localrate_data = array('${id}' => $edit, '${localename}' => $localename, '${localerate}' => (double) $localerate);
         $localrates[] = str_replace(array_keys($localrate_data), $localrate_data, $this->template_localrate());
     }
     $data = array('${id}' => $id, '${rate}' => percentage($rate, array('precision' => 4)), '${countries}' => menuoptions($this->countries, $country, true), '${zones}' => !empty($zones[$country]) ? menuoptions($zones[$country], $zone, true) : '', '${conditions}' => join('', $conditions), '${haslocals}' => $haslocals, '${localrates}' => join('', $localrates), '${instructions}' => $localerror ? '<p class="error">' . $localerror . '</p>' : $instructions, '${compounded}' => Shopp::str_true($compound) ? 'checked="checked"' : '', '${cancel_href}' => add_query_arg(array('id' => null, '_wpnonce' => null)));
     if ($conditions) {
         $data['no-conditions'] = '';
     }
     if (!empty($zones[$country])) {
         $data['no-zones'] = '';
     }
     if ($haslocals) {
         $data['no-local-rates'] = '';
     } else {
         $data['has-local-rates'] = '';
     }
     if (count($locals) > 0) {
         $data['instructions'] = 'hidden';
     }
     echo ShoppUI::template($this->editor, $data);
 }
예제 #7
0
파일: ui.php 프로젝트: forthrobot/inuvik
}
ShoppUI::addmetabox('promotion-discount', __('Discount', 'Shopp') . $Admin->boxhelp('promo-editor-discount'), 'discount_meta_box', 'shopp_page_shopp-discounts', 'normal', 'core');
function rules_meta_box($Promotion)
{
    $targets = array('Catalog' => __('catalog product', 'Shopp'), 'Cart' => __('shopping cart', 'Shopp'), 'Cart Item' => __('cart item', 'Shopp'));
    $target = '<select name="target" id="promotion-target" class="small">';
    $target .= menuoptions($targets, $Promotion->target, true);
    $target .= '</select>';
    if (empty($Promotion->search)) {
        $Promotion->search = "all";
    }
    $logic = '<select name="search" class="small">';
    $logic .= menuoptions(array('any' => Shopp::__('any'), 'all' => strtolower(Shopp::__('All'))), $Promotion->search, true);
    $logic .= '</select>';
    ?>
<p><strong><?php 
    printf(__('Apply discount to %s', 'Shopp'), $target, $logic);
    ?>
 <strong id="target-property"></strong></strong></p>
<table class="form-table" id="cartitem"></table>

<p><strong><?php 
    printf(__('When %s of these conditions match the', 'Shopp'), $logic);
    ?>
 <strong id="rule-target">:</strong></strong></p>

<table class="form-table" id="rules"></table>
<?php 
}
ShoppUI::addmetabox('promotion-rules', __('Conditions', 'Shopp') . $Admin->boxhelp('promo-editor-conditions'), 'rules_meta_box', 'shopp_page_shopp-discounts', 'normal', 'core');
예제 #8
0
 /**
  * Registers column headings for the category list manager
  *
  * @author Jonathan Davis
  * @since 1.0
  * @return void
  **/
 public function layout()
 {
     $columns = array('cb' => '<input type="checkbox" />', 'name' => Shopp::__('Name'), 'slug' => Shopp::__('Slug'), 'products' => Shopp::__('Products'), 'templates' => Shopp::__('Templates'), 'menus' => Shopp::__('Menus'));
     ShoppUI::register_column_headers($this->id, apply_filters('shopp_manage_category_columns', $columns));
 }
예제 #9
0
        $data = array('${id}' => $edit, '${rate}' => $rate, '${countries}' => menuoptions($countries, $country, true), '${zones}' => !empty($zones[$country]) ? menuoptions(array_merge(array('' => ''), $zones[$country]), $zone, true) : '', '${conditions}' => join('', $conditions), '${haslocals}' => $haslocals, '${localrates}' => join('', $localrates), '${errors}' => $localerror ? '<p class="error">' . $localerror . '</p>' : '', '${compounded}' => Shopp::str_true($compound) ? 'checked="checked"' : '', '${cancel_href}' => $this->url);
        if ($conditions) {
            $data['no-conditions'] = '';
        }
        if (!empty($zones[$country])) {
            $data['no-zones'] = '';
        }
        if ($haslocals) {
            $data['no-local-rates'] = '';
        } else {
            $data['has-local-rates'] = '';
        }
        if (count($locals) > 0) {
            $data['instructions'] = 'hidden';
        }
        echo ShoppUI::template($editor, $data);
        if ($edit === $index) {
            continue;
        }
    }
    $label = "{$rate} &mdash; {$location}";
    ?>
		<tr class="<?php 
    echo join(' ', $classes);
    ?>
" id="taxrates-<?php 
    echo $index;
    ?>
">
			<td class="name column-name"><a href="<?php 
    echo esc_url($editurl);
예제 #10
0
파일: Orders.php 프로젝트: msigley/shopp
 public function layout()
 {
     $Purchase = ShoppPurchase();
     ShoppUI::register_column_headers($this->id, apply_filters('shopp_order_manager_columns', array('items' => __('Items', 'Shopp'), 'qty' => __('Quantity', 'Shopp'), 'price' => __('Price', 'Shopp'), 'total' => __('Total', 'Shopp'))));
     new ShoppAdminOrderContactBox($this->id, 'topside', 'core', array('Purchase' => $Purchase));
     new ShoppAdminOrderBillingAddressBox($this->id, 'topic', 'core', array('Purchase' => $Purchase));
     new ShoppAdminOrderShippingAddressBox($this->id, 'topsider', 'core', array('Purchase' => $Purchase));
     new ShoppAdminOrderManageBox($this->id, 'normal', 'core', array('Purchase' => $Purchase, 'Gateway' => $Purchase->gateway()));
     if (isset($Purchase->data) && '' != join('', (array) $Purchase->data) || apply_filters('shopp_orderui_show_orderdata', false)) {
         new ShoppAdminOrderDataBox($this->id, 'normal', 'core', array('Purchase' => $Purchase));
     }
     if (count($Purchase->events) > 0) {
         new ShoppAdminOrderHistoryBox($this->id, 'normal', 'core', array('Purchase' => $Purchase));
     }
     new ShoppAdminOrderNotesBox($this->id, 'normal', 'core', array('Purchase' => $Purchase));
     do_action('shopp_order_new_layout');
 }
예제 #11
0
파일: ui.php 프로젝트: forthrobot/inuvik
<?php 
    }
    ?>
</select><label for="wp-roles"><?php 
    _e('Default User Role', 'Shopp');
    ?>
</p>

<?php 
}
ShoppUI::addmetabox('membership-settings', __('Settings', 'Shopp') . $Admin->boxhelp('membership-editor-settings'), 'settings_meta_box', 'shopp_page_shopp-memberships', 'side', 'core');
function sources_meta_box($MemberPlan)
{
    ?>
<ul id="sources"></ul>
<p>Show list of content sources...</p>
<?php 
}
ShoppUI::addmetabox('membership-sources', __('Content', 'Shopp') . $Admin->boxhelp('membership-editor-sources'), 'sources_meta_box', 'shopp_page_shopp-memberships', 'side', 'core');
function rules_meta_box($MemberPlan)
{
    ?>
<ul id="rules"></ul>
<input type="button" id="add-stage" name="add-stage" value="<?php 
    _e('Add Step', 'Shopp');
    ?>
" class="button-secondary" />
<?php 
}
ShoppUI::addmetabox('membership-rules', __('Access', 'Shopp') . $Admin->boxhelp('membership-editor-rules'), 'rules_meta_box', 'shopp_page_shopp-memberships', 'normal', 'core');
예제 #12
0
        $shipment[] = $default;
    }
    // Build the shipment entry UIs
    foreach ($shipment as $id => $package) {
        extract($package);
        $menu = Shopp::menuoptions($carriers_menu, $carrier, true);
        $shipmentuis = ShoppUI::template($shipmentui, array('${id}' => $id, '${num}' => $id + 1, '${tracking}' => $tracking, '${carriermenu}' => $menu));
    }
    echo ShoppUI::template($shipnotice_ui, array('${shipments}' => $shipmentuis, '${shipmentnum}' => count($shipment) + 1));
}
if ('refund-order' == $action) {
    $data = array('${action}' => 'refund', '${title}' => __('Refund Order', 'Shopp'), '${reason}' => __('Reason for refund', 'Shopp'), '${send}' => __('Send to gateway', 'Shopp'), '${cancel}' => __('Cancel Refund', 'Shopp'), '${process}' => __('Process Refund', 'Shopp'));
    if (isset($_POST['cancel-order'])) {
        $data = array('${action}' => 'cancel', '${disable_amount}' => ' disabled="disabled"', '${title}' => __('Cancel Order', 'Shopp'), '${reason}' => __('Reason for cancellation', 'Shopp'), '${send}' => __('Send to gateway', 'Shopp'), '${cancel}' => __('Do Not Cancel', 'Shopp'), '${process}' => __('Cancel Order', 'Shopp'));
    }
    echo ShoppUI::template($refundui, $data);
}
?>
		</div>
	</div>
</div>
<?php 
if (!($Purchase->isvoid() && $Purchase->refunded)) {
    ?>
	<div id="major-publishing-actions">
		<?php 
    if (!$Purchase->isvoid()) {
        ?>
		<div class="alignleft">
			<?php 
        if (current_user_can('shopp_void') && !$Purchase->captured) {
예제 #13
0
    $customer = array();
}
if (isset($_REQUEST['s']) && isset($_REQUEST['select-customer'])) {
    echo ShoppUI::template($search);
    return;
} elseif (empty($Purchase->customer)) {
    echo ShoppUI::template($editcustomer);
    return;
} elseif (isset($_REQUEST['edit-customer'])) {
    ?>
		<form action="<?php 
    echo $this->url(array('id' => (int) $Purchase->id));
    ?>
" method="POST">
		<?php 
    echo ShoppUI::template($editcustomer, $customer);
    ?>
		</form>
	<?php 
    return;
}
?>
<form action="<?php 
echo $this->url(array('id' => (int) $Purchase->id));
?>
" method="post" id="customer-editor-form"></form>
<div class="display">
	<form action="<?php 
echo $this->url(array('id' => $Purchase->id));
?>
" method="get">
예제 #14
0
파일: Payments.php 프로젝트: msigley/shopp
 public function editor($Item)
 {
     $data = array('${editing_class}' => "{$event}-editing", '${cancel_href}' => add_query_arg(array('id' => null, '_wpnonce' => null)), '${instance}' => $id);
     // Handle payment data value substitution for multi-instance payment systems
     foreach ($payment as $name => $value) {
         $data['${' . $name . '}'] = $value;
     }
     echo ShoppUI::template($this->editor, $data);
 }
예제 #15
0
 public function images_ui()
 {
     ShoppUI::register_column_headers('shopp_page_shopp-settings-images', array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'dimensions' => __('Dimensions', 'Shopp'), 'fit' => __('Fit', 'Shopp'), 'quality' => __('Quality', 'Shopp'), 'sharpness' => __('Sharpness', 'Shopp')));
 }
예제 #16
0
			properties_name = (type=='cartitem')?'rules[item]['+i+'][property]':'rules['+i+'][property]',
			properties = $('<select name="'+properties_name+'" class="ruleprops"></select>').appendTo(cell);

		if (type == "cartitem") target = "Cart Item Target";
		if (conditions[target])
			for (var label in conditions[target])
				$('<option></option>').html(RULES_LANG[label]).val(label).attr('rel',target).appendTo(properties);

		var operation_name = (type=='cartitem')?'rules[item]['+i+'][logic]':'rules['+i+'][logic]',
			operation = $('<select name="'+operation_name+'" ></select>').appendTo(cell),
			value = $('<span></span>').appendTo(cell),

			addspan = $('<span></span>').appendTo(cell);

		$('<?php 
echo ShoppUI::button('add', 'add', array('type' => 'button'));
?>
').appendTo(addspan).click(function () { new Conditional(type,false,row); });

		cell.hover(function () {
			if (i > 1) deleteButton.css({'opacity':100,'visibility':'visible'});
		},function () {
			deleteButton.animate({'opacity':0});
		});

		var valuefield = function (fieldtype) {
			value.empty();
			var name = (type=='cartitem')?'rules[item]['+i+'][value]':'rules['+i+'][value]';
			if (fieldtype == "number") field = $('<input type="number" name="'+name+'" class="selectall" size="5" />').appendTo(value);
			else field = $('<input type="text" name="'+name+'" class="selectall" />').appendTo(value);
			if (fieldtype == "price") field.change(function () { this.value = asMoney(this.value); });
예제 #17
0
function contact_meta_box($Purchase)
{
    $screen = get_current_screen();
    $pre = 'page_';
    $page = substr($screen->id, strpos($screen->id, $pre) + strlen($pre));
    ?>
	<script id="customer-editor" type="text/x-jquery-tmpl">
	<?php 
    ob_start();
    ?>

	<div class="editor ${action}">
		<input type="hidden" name="order-action" value="${action}" />
		<p class="inline-fields">
			<span>
			<input type="text" name="customer[firstname]" id="customer-firstname" value="${firstname}" /><br />
			<label for="address-city"><?php 
    _e('First Name', 'Shopp');
    ?>
</label>
			</span>
			<span>
			<input type="text" name="customer[lastname]" id="customer-lastname" value="${lastname}" /><br />
			<label for="address-city"><?php 
    _e('Last Name', 'Shopp');
    ?>
</label>
			</span>
		</p>
		<p>
			<input type="text" name="customer[company]" id="customer-company" value="${company}" /><br />
			<label for="address-address"><?php 
    _e('Company', 'Shopp');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="customer[email]" id="customer-email" value="${email}" /><br />
			<label for="customer-email"><?php 
    _e('Email', 'Shopp');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="customer[phone]" id="customer-phone" value="${phone}" /><br />
			<label for="customer-phone"><?php 
    _e('Phone', 'Shopp');
    ?>
</label>
		</p>
		<?php 
    if ('wordpress' == shopp_setting('account_system')) {
        ?>
		<p class="loginname">
			<input type="text" name="customer[loginname]" id="customer-loginname" value="${loginname}" /><br />
			<label for="customer-loginname"><?php 
        _e('Login Name', 'Shopp');
        ?>
</label>
		</p>
		<?php 
    }
    ?>
		<div>
			<input type="submit" id="cancel-edit-customer" name="cancel-edit-customer" value="<?php 
    Shopp::esc_attr_e('Cancel');
    ?>
" class="button-secondary" />
			<input type="submit" name="save" value="<?php 
    Shopp::esc_attr_e('Save Customer');
    ?>
" class="button-primary alignright" />
		</div>
		<?php 
    if (!isset($_POST['select-customer'])) {
        ?>
		<p class="change-button"><br class="clear" /><input type="submit" id="change-customer" name="change-customer" value="<?php 
        _e('Change Customer', 'Shopp');
        ?>
" class="button-secondary" /></p>
		<?php 
    }
    ?>
	</div>
	<?php 
    $editcustomer = ob_get_contents();
    ob_end_clean();
    echo $editcustomer;
    $customer = array('${action}' => 'update-customer', '${firstname}' => $Purchase->firstname, '${lastname}' => $Purchase->lastname, '${company}' => $Purchase->company, '${email}' => $Purchase->email, '${phone}' => $Purchase->phone, '${marketing}' => isset($Purchase->marketing) ? $Purchase->marketing : false, '${login}' => 'wordpress' == shopp_setting('account_system'));
    $js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($customer));
    shopp_custom_script('orders', 'var customer = ' . $js . ';');
    ?>
	</script>

	<script id="customer-s" type="text/x-jquery-tmpl">
	<?php 
    $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : false;
    ob_start();
    if (isset($_POST['select-customer']) && empty($s)) {
        $searchurl = wp_nonce_url(ShoppAdminController::url(array('page' => $page, 'id' => $Purchase->id)), 'wp_ajax_shopp_select_customer');
    } else {
        $searchurl = wp_nonce_url(add_query_arg(array('action' => 'shopp_select_customer', 'page' => $page, 'id' => $Purchase->id), admin_url('admin-ajax.php')), 'wp_ajax_shopp_select_customer');
    }
    if (!isset($_POST['select-customer']) || isset($_POST['select-customer']) && !empty($s)) {
        $iframe = true;
    }
    if (!empty($s)) {
        $searchurl = add_query_arg('s', $s, $searchurl);
    }
    ?>
	<form id="customer-search" action="<?php 
    echo $searchurl;
    ?>
" method="post" <?php 
    if ($iframe) {
        ?>
target="customer-search-results"<?php 
    }
    ?>
><input type="hidden" name="change-customer" value="true" /><input type="hidden" name="action" value="shopp_select_customer" /><input type="hidden" name="page" value="<?php 
    echo esc_attr($page);
    ?>
" /><?php 
    wp_nonce_field('wp_ajax_shopp_select_customer');
    ?>
<p><input type="search" name="s" value="<?php 
    echo esc_attr($s);
    ?>
" placeholder="<?php 
    _e('Search...', 'Shopp');
    ?>
" /></p>
	</form>
	<?php 
    if ($iframe) {
        ?>
	<iframe id="customer-search-results" name="customer-search-results" src="<?php 
        echo esc_url($searchurl);
        ?>
"></iframe>
	<form action="<?php 
        echo ShoppAdminController::url(array('page' => $page, 'id' => (int) $Purchase->id));
        ?>
" method="POST">
	<div><input type="submit" id="cancel-change-customer" name="cancel-change-customer" value="<?php 
        _e('Cancel', 'Shopp');
        ?>
" class="button-secondary" /></div>
	</form>
	<?php 
    }
    ?>
	<?php 
    $search = ob_get_contents();
    ob_end_clean();
    echo $search;
    ?>
	</script>

	<script id="change-customer-ui" type="text/x-jquery-tmpl">
	<?php 
    ob_start();
    ?>
	<h4><?php 
    _e('Search for Customer', 'Shopp');
    ?>
</h4>
	<?php 
    echo ShoppUI::template($search);
    ?>
	<form id="change-customer" action="<?php 
    echo ShoppAdminController::url(array('id' => (int) $Purchase->id));
    ?>
" method="POST">
	<h4><?php 
    _e('Add New Customer', 'Shopp');
    ?>
</h4>
	<input type="hidden" name="change-customer" value="true" />
	<?php 
    echo ShoppUI::template($editcustomer, array('${action}' => 'new-customer', '${savelabel}' => __('Add New Customer', 'Shopp')));
    ?>
	</form>
	<?php 
    $changecustomer = ob_get_contents();
    ob_end_clean();
    echo $changecustomer;
    ?>
	</script>


	<?php 
    if (isset($_POST['select-customer'])) {
        $customer = array();
    }
    if (isset($_REQUEST['s']) && isset($_REQUEST['select-customer'])) {
        echo ShoppUI::template($search);
        return;
    } elseif (isset($_POST['select-customer'])) {
        echo ShoppUI::template($changecustomer);
        return;
    } elseif (isset($_REQUEST['edit-customer'])) {
        ?>
			<form action="<?php 
        echo ShoppAdminController::url(array('id' => (int) $Purchase->id));
        ?>
" method="POST">
			<?php 
        echo ShoppUI::template($editcustomer, $customer);
        ?>
			</form>
		<?php 
        return;
    }
    ?>
	<div id="change-customer-editor"></div>
	<form action="<?php 
    echo ShoppAdminController::url(array('id' => (int) $Purchase->id));
    ?>
" method="post" id="customer-editor-form"></form>
	<div class="display">
		<form action="<?php 
    echo ShoppAdminController::url(array('id' => $Purchase->id));
    ?>
" method="get">
		<?php 
    $targets = shopp_setting('target_markets');
    ?>
			<input type="hidden" id="edit-customer-data" value="<?php 
    echo esc_attr(json_encode($customer));
    ?>
" />
			<input type="hidden" name="page" value="<?php 
    echo $page;
    ?>
" />
			<input type="hidden" name="id" value="<?php 
    echo $Purchase->id;
    ?>
" />
			<input type="submit" id="edit-customer" name="edit-customer" value="<?php 
    _e('Edit', 'Shopp');
    ?>
" class="button-secondary button-edit" />
		</form>
	<?php 
    $avatar = get_avatar($Purchase->email, 64);
    $customer_url = add_query_arg(array('page' => 'shopp-customers', 'id' => $Purchase->customer), admin_url('admin.php'));
    $customer_url = apply_filters('shopp_order_customer_url', $customer_url);
    $email_url = 'mailto:' . $Purchase->email . '?subject=' . sprintf(__('RE: %s: Order #%s', 'Shopp'), get_bloginfo('sitename'), $Purchase->id);
    $email_url = apply_filters('shopp_order_customer_email_url', $email_url);
    $phone_url = 'callto:' . preg_replace('/[^\\d+]/', '', $Purchase->phone);
    $phone_url = apply_filters('shopp_order_customer_phone_url', $phone_url);
    $accounts = shopp_setting('account_system');
    $wp_user = false;
    if ('wordpress' == $accounts) {
        $Customer = new ShoppCustomer($Purchase->customer);
        $WPUser = get_userdata($Customer->wpuser);
        $edituser_url = add_query_arg('user_id', $Customer->wpuser, admin_url('user-edit.php'));
        $edituser_url = apply_filters('shopp_order_customer_wpuser_url', $edituser_url);
    }
    ?>
	<div class="alignleft"><?php 
    echo $avatar;
    ?>
</div>
	<div class="alignleft">
	<span class="fn"><a href="<?php 
    echo esc_url($customer_url);
    ?>
"><?php 
    echo esc_html("{$Purchase->firstname} {$Purchase->lastname}");
    ?>
</a></span>
	<?php 
    if ('wordpress' == $accounts && !empty($WPUser->user_login)) {
        ?>
<br /><span class="wplogin"><a href="<?php 
        echo esc_attr($edituser_url);
        ?>
"><?php 
        echo esc_html($WPUser->user_login);
        ?>
</a></span><?php 
    }
    ?>
	<?php 
    if (!empty($Purchase->company)) {
        echo '<br /> <div class="org">' . esc_html($Purchase->company) . '</div>';
    }
    ?>
	<?php 
    if (!empty($Purchase->email)) {
        echo '<br /><span class="email"><a href="' . esc_url($email_url) . '">' . esc_html($Purchase->email) . '</a></span>';
    }
    ?>
	<?php 
    if (!empty($Purchase->phone)) {
        echo '<br /><span class="phone"><a href="' . esc_attr($phone_url) . '">' . esc_html($Purchase->phone) . '</a></span>';
    }
    ?>
	<p class="customer <?php 
    echo $Purchase->Customer->marketing == "yes" ? 'marketing' : 'nomarketing';
    ?>
"><?php 
    $Purchase->Customer->marketing == "yes" ? _e('Agreed to marketing', 'Shopp') : _e('No marketing', 'Shopp');
    ?>
</p>
	</div>
	<br class="clear" />
	</div>
	<?php 
}
예제 #18
0
 public function tablerate_row_tier($row = 0, $tier = 0, array $attrs = array(), array $setting = array())
 {
     $unit = isset($attrs['unit'][1]) ? $attrs['unit'][1] : false;
     $threshold_class = !empty($attrs['threshold_class']) ? $attrs['threshold_class'] : '';
     $rate_class = !empty($attrs['rate_class']) ? $attrs['rate_class'] : 'money';
     $defaults = array('threshold' => 0, 'rate' => '1.00');
     $setting = array_merge($defaults, $setting);
     if ($this->template) {
         $row = '${row}';
         $tier = '${tier}';
         $unit = '${unitabbr}';
         $setting['rate'] = '${rate}';
         $setting['threshold'] = '${threshold}';
         $rate_class = '${rate_class}';
         $threshold_class = '${threshold_class}';
     }
     $_ = array();
     $_[] = '<tr>';
     $_[] = '<td class="control">' . ShoppUI::button('delete', 'deletetier', array('class' => 'delete' . ($tier == 0 ? ' hidden' : ''), 'value' => "{$row},{$tier}")) . '</td>';
     $_[] = '<td class="unit leftfield"><label><input type="text" name="' . $this->module . '[table][' . $row . '][tiers][' . $tier . '][threshold]" size="7" value="' . $setting['threshold'] . '" class="threshold selectall ' . $threshold_class . '" /> ' . $unit . ' ' . __('and above', 'Shopp') . '</label></td>';
     $_[] = '<td class="rate rightfield"><input type="text" name="' . $this->module . '[table][' . $row . '][tiers][' . $tier . '][rate]" size="7" class="rate selectall ' . $rate_class . '" value="' . $setting['rate'] . '" /></td>';
     $_[] = '<td class="control">' . ShoppUI::button('add', 'addtier') . '</td>';
     $_[] = '</tr>';
     return join('', $_);
 }
예제 #19
0
 /**
  * Provides overall layout for the order manager interface
  *
  * Makes use of WordPress postboxes to generate panels (box) content
  * containers that are customizable with drag & drop, collapsable, and
  * can be toggled to be hidden or visible in the interface.
  *
  * @author Jonathan Davis
  * @return
  **/
 public function layout()
 {
     $Shopp = Shopp::object();
     $Admin =& $Shopp->Flow->Admin;
     ShoppUI::register_column_headers($this->screen, apply_filters('shopp_order_manager_columns', array('items' => __('Items', 'Shopp'), 'qty' => __('Quantity', 'Shopp'), 'price' => __('Price', 'Shopp'), 'total' => __('Total', 'Shopp'))));
     include $this->ui('events.php');
     include $this->ui('ui.php');
     do_action('shopp_order_manager_layout');
 }
예제 #20
0
파일: ui.php 프로젝트: forthrobot/inuvik
function images_meta_box($Product)
{
    ?>
	<div id="confirm-delete-images" class="notice hidden"><p><?php 
    _e('Save the product to confirm deleted images.', 'Shopp');
    ?>
</p></div>
	<ul id="lightbox">
	<?php 
    foreach ((array) $Product->images as $i => $Image) {
        ?>
		<li id="image-<?php 
        echo (int) $Image->id;
        ?>
"><input type="hidden" name="images[]" value="<?php 
        echo $Image->id;
        ?>
" />
			<div id="image-<?php 
        echo (int) $Image->id;
        ?>
-details" title="<?php 
        _e('Double-click images to edit their details&hellip;', 'Shopp');
        ?>
">
				<img src="?siid=<?php 
        echo (int) $Image->id;
        ?>
&amp;<?php 
        echo $Image->resizing(96, 0, 1);
        ?>
" width="96" height="96" />
				<input type="hidden" name="imagedetails[<?php 
        echo (int) $i;
        ?>
][id]" value="<?php 
        echo (int) $Image->id;
        ?>
" />
				<input type="hidden" name="imagedetails[<?php 
        echo (int) $i;
        ?>
][title]" value="<?php 
        echo $Image->title;
        ?>
" class="imagetitle" />
				<input type="hidden" name="imagedetails[<?php 
        echo (int) $i;
        ?>
][alt]" value="<?php 
        echo $Image->alt;
        ?>
"  class="imagealt" />
				<?php 
        if (isset($Product->cropped) && count($Product->cropped) > 0 && isset($Product->cropped[$Image->id])) {
            $cropped = is_array($Product->cropped[$Image->id]) ? $Product->cropped[$Image->id] : array($Product->cropped[$Image->id]);
            foreach ($cropped as $cache) {
                $cropimage = unserialize($cache->value);
                $cropdefaults = array('dx' => '', 'dy' => '', 'cropscale' => '');
                $cropsettings = array_intersect_key($cropimage->settings, $cropdefaults);
                $cropping = array_filter($cropsettings) == array() ? '' : join(',', array_merge($cropdefaults, $cropsettings));
                $c = "{$cropimage->width}:{$cropimage->height}";
                ?>
					<input type="hidden" name="imagedetails[<?php 
                echo $i;
                ?>
][cropping][<?php 
                echo $cache->id;
                ?>
]" alt="<?php 
                echo $c;
                ?>
" value="<?php 
                echo $cropping;
                ?>
" class="imagecropped" />
				<?php 
            }
        }
        ?>
			</div>
			<?php 
        echo ShoppUI::button('delete', 'deleteImage', array('type' => 'button', 'class' => 'delete', 'value' => $Image->id, 'title' => Shopp::__('Remove image&hellip;')));
        ?>
			</li>
	<?php 
    }
    ?>
	</ul>
	<div class="clear"></div>
	<input type="hidden" name="product" value="<?php 
    echo $_GET['id'];
    ?>
" id="image-product-id" />
	<input type="hidden" name="deleteImages" id="deleteImages" value="" />
	<div id="swf-uploader-button"></div>
	<div id="browser-uploader">
		<button type="button" name="image_upload" id="image-upload" class="button-secondary"><small><?php 
    _e('Add New Image', 'Shopp');
    ?>
</small></button><br class="clear"/>
	</div>
<?php 
}
예제 #21
0
 public function editor($Item)
 {
     $deliverymenu = ShoppLookup::timeframes_menu();
     echo '<script id="delivery-menu" type="text/x-jquery-tmpl">' . Shopp::menuoptions($deliverymenu, false, true) . '</script>';
     $data = array('${mindelivery_menu}' => Shopp::menuoptions($deliverymenu, $Item->settings['mindelivery'], true), '${maxdelivery_menu}' => Shopp::menuoptions($deliverymenu, $Item->settings['maxdelivery'], true), '${fallbackon}' => 'on' == $Item->settings['fallback'] ? 'checked="checked"' : '', '${cancel_href}' => $this->url);
     echo ShoppUI::template($Item->editor, $data);
 }
예제 #22
0
</a>
		</div>
		<div class="clear"></div>
	</div>
	<div class="clear"></div>

	<table id="arrange-products" class="widefat" cellspacing="0">
		<thead>
		<tr><?php 
ShoppUI::print_column_headers($this->screen);
?>
</tr>
		</thead>
		<tfoot>
		<tr><?php 
ShoppUI::print_column_headers($this->screen, false);
?>
</tr>
		</tfoot>
	<?php 
if (sizeof($CategoryProducts) > 0) {
    ?>
		<tbody id="categories-table" class="list categories">
		<?php 
    $columns = get_column_headers($this->screen);
    $hidden = get_hidden_columns($this->screen);
    $even = false;
    foreach ($CategoryProducts as $Product) {
        ?>
		<tr<?php 
        if (!$even) {
예제 #23
0
파일: taxes.php 프로젝트: forthrobot/inuvik
<tr class="inline-edit-row ${classnames}" id="${id}">
	<td colspan="3"><input type="hidden" name="id" value="${id}" /><input type="hidden" name="editing" value="true" />
	<table id="taxrate-editor">
		<tr>
		<td scope="row" valign="top" class="rate"><input type="text" name="settings[taxrates][${id}][rate]" id="tax-rate" value="${rate}" size="7" class="selectall" tabindex="1" /><br /><label for="tax-rate"><?php 
_e('Tax Rate', 'Shopp');
?>
</label><br />
		<input type="hidden" name="settings[taxrates][${id}][compound]" value="off" /><label><input type="checkbox" id="tax-compound" name="settings[taxrates][${id}][compound]" value="on" ${compounded} tabindex="4" />&nbsp;<?php 
Shopp::_e('Compound');
?>
</label></td>
		<td scope="row" class="conditions">
		<select name="settings[taxrates][${id}][country]" class="country" tabindex="2">${countries}</select><select name="settings[taxrates][${id}][zone]" class="zone no-zones" tabindex="3">${zones}</select>
		<?php 
echo ShoppUI::button('add', 'addrule');
?>
		<?php 
$options = array('any' => Shopp::__('any'), 'all' => strtolower(Shopp::__('All')));
$menu = '<select name="settings[taxrates][${id}][logic]" class="logic">' . menuoptions($options, false, true) . '</select>';
?>
			<div class="conditionals no-conditions">
				<p><label><?php 
printf(__('Apply tax rate when %s of the following conditions match', 'Shopp'), $menu);
?>
:</label></p>
				<ul>
				${conditions}
				</ul>
			</div>
		</td>
예제 #24
0
 /**
  * Registers the column headers for the product list manager
  *
  * @author Jonathan Davis
  * @return void
  **/
 public function columns()
 {
     $headings = array('default' => array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'category' => __('Category', 'Shopp'), 'price' => __('Price', 'Shopp'), 'inventory' => __('Inventory', 'Shopp'), 'featured' => __('Featured', 'Shopp'), 'date' => __('Date', 'Shopp')), 'inventory' => array('inventory' => __('Inventory', 'Shopp'), 'sku' => __('SKU', 'Shopp'), 'name' => __('Name', 'Shopp')), 'bestselling' => array('cb' => '<input type="checkbox" />', 'name' => __('Name', 'Shopp'), 'sold' => __('Sold', 'Shopp'), 'gross' => __('Sales', 'Shopp'), 'price' => __('Price', 'Shopp'), 'inventory' => __('Inventory', 'Shopp'), 'featured' => __('Featured', 'Shopp'), 'date' => __('Date', 'Shopp')));
     $columns = isset($headings[$this->view]) ? $headings[$this->view] : $headings['default'];
     // Remove inventory column if inventory tracking is disabled
     if (!shopp_setting_enabled('inventory')) {
         unset($columns['inventory']);
     }
     // Remove category column from the "trash" view
     if ('trash' == $this->view) {
         unset($columns['category']);
     }
     ShoppUI::register_column_headers('toplevel_page_shopp-products', apply_filters('shopp_manage_product_columns', $columns));
 }
예제 #25
0
	</span>
	<span>
	<input type="text" name="shipping[postcode]" id="shipping-postcode" value="<?php 
    echo esc_attr($Customer->Shipping->postcode);
    ?>
" size="10" /><br />
	<label for="shipping-postcode"><?php 
    _e('Postal Code', 'Shopp');
    ?>
</label>
	</span>
</p>
<p>
	<span>
		<select name="shipping[country]" id="shipping-country">
			<?php 
    echo menuoptions($Customer->countries, $Customer->Shipping->country, true);
    ?>
		</select>
	<label for="shipping-country"><?php 
    _e('Country', 'Shopp');
    ?>
</label>
	</span>
</p>

<br class="clear" />
<?php 
}
ShoppUI::addmetabox('customer-shipping', __('Shipping Address', 'Shopp') . $Admin->boxhelp('customer-editor-shipping'), 'shipping_meta_box', 'shopp_page_shopp-customers', 'normal', 'core');
예제 #26
0
            echo $cache->id;
            ?>
]" alt="<?php 
            echo $c;
            ?>
" value="<?php 
            echo $cropping;
            ?>
" class="imagecropped" />
				<?php 
        }
    }
    ?>
			</div>
			<?php 
    echo ShoppUI::button('delete', 'deleteImage', array('type' => 'button', 'class' => 'delete', 'value' => $Image->id, 'title' => Shopp::__('Remove image&hellip;')));
    ?>
			</li>
	<?php 
}
?>
	</ul>
	<div class="clear"></div>
	<input type="hidden" name="product" value="<?php 
echo $_GET['id'];
?>
" id="image-product-id" />
	<input type="hidden" name="deleteImages" id="deleteImages" value="" />
	<div id="swf-uploader-button"></div>
	<div id="browser-uploader">
		<button type="button" name="image_upload" id="image-upload" class="button-secondary"><small><?php 
예제 #27
0
 public function screen()
 {
     global $wpdb;
     $defaults = array('page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'paged' => false, 'per_page' => 20, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     if ($page == ShoppAdmin::pagename('customers') && !empty($deleting) && !empty($selected) && is_array($selected) && current_user_can('shopp_delete_customers')) {
         foreach ($selected as $deletion) {
             $Customer = new ShoppCustomer($deletion);
             $Billing = new BillingAddress($Customer->id, 'customer');
             $Billing->delete();
             $Shipping = new ShippingAddress($Customer->id, 'customer');
             $Shipping->delete();
             $Customer->delete();
         }
     }
     $updated = false;
     // if (!empty($_POST['save'])) {
     // 	check_admin_referer('shopp-save-customer');
     // 	$wp_integration = ('wordpress' === shopp_setting( 'account_system' ));
     //
     // 	if ($_POST['id'] !== 'new') {
     // 		$Customer = new ShoppCustomer($_POST['id']);
     // 		$Billing = new BillingAddress($Customer->id, 'customer');
     // 		$Shipping = new ShippingAddress($Customer->id, 'customer');
     // 	} else $Customer = new ShoppCustomer();
     //
     // 	if (!empty($Customer->wpuser)) $user = get_user_by('id',$Customer->wpuser);
     // 	$new_customer = empty( $Customer->id );
     //
     // 	$Customer->updates($_POST);
     //
     // 	// Reassign WordPress login
     // 	if ($wp_integration && isset($_POST['userlogin']) && $_POST['userlogin'] !=  $user->user_login) {
     // 		$newlogin = get_user_by('login', $_POST['userlogin']);
     // 		if ( ! empty($newlogin->ID) ) {
     // 			if (sDB::query("SELECT count(*) AS used FROM $Customer->_table WHERE wpuser=$newlogin->ID",'auto','col','used') == 0) {
     // 				$Customer->wpuser = $newlogin->ID;
     // 				$updated = sprintf(__('Updated customer login to %s.','Shopp'),"<strong>$newlogin->user_login</strong>");
     // 			} else $updated = sprintf(__('Could not update customer login to &quot;%s&quot; because that user is already assigned to another customer.','Shopp'),'<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
     //
     // 		} else $updated = sprintf(__('Could not update customer login to &quot;%s&quot; because the user does not exist in WordPress.','Shopp'),'<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
     // 		if ( empty($_POST['userlogin']) ) $Customer->wpuser = 0;
     // 	}
     //
     // 	if ( ! empty($_POST['new-password']) && !empty($_POST['confirm-password'])
     // 		&& $_POST['new-password'] == $_POST['confirm-password']) {
     // 			$Customer->password = wp_hash_password($_POST['new-password']);
     // 			if (!empty($Customer->wpuser)) wp_set_password($_POST['new-password'], $Customer->wpuser);
     // 		}
     //
     // 	$valid_email = filter_var( $_POST['email'], FILTER_VALIDATE_EMAIL );
     // 	$password = !empty( $_POST['new_password'] );
     //
     // 	if ($wp_integration && $new_customer && $valid_email && $password) {
     // 		$Customer->loginname = $_POST['userlogin'];
     // 		$Customer->email = $_POST['email'];
     // 		$Customer->firstname = $_POST['firstname'];
     // 		$Customer->lastname = $_POST['lastname'];
     //
     // 		$return = $Customer->create_wpuser();
     //
     // 		if ( $return ) {
     // 			$updated = sprintf( __( 'The Shopp and WordPress accounts have been created with the username &quot;%s&quot;.', 'Shopp'), '<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
     // 		} else {
     // 			$updated = sprintf( __( 'Could not create a WordPress account for customer &quot;%s&quot;.','Shopp'), '<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
     // 		}
     // 	}
     // 	elseif ($new_customer && ( !$valid_email || !$password ) ) {
     // 		$updated = __( 'Could not create new user. You must enter a valid email address and a password first.', 'Shopp' );
     // 		$no_save = true;
     // 	}
     //
     // 	if ( !isset( $new_save ) ) {
     // 		$Customer->info = false; // No longer used from DB
     // 		$Customer->save();
     // 	}
     //
     //
     // 	if (isset($_POST['info']) && !empty($_POST['info'])) {
     // 		foreach ((array)$_POST['info'] as $id => $info) {
     // 			$Meta = new ShoppMetaObject($id);
     // 			$Meta->value = $info;
     // 			$Meta->save();
     // 		}
     // 	}
     //
     // 	if (isset($Customer->id)) $Billing->customer = $Customer->id;
     // 	$Billing->updates($_POST['billing']);
     // 	$Billing->save();
     //
     // 	if (isset($Customer->id)) $Shipping->customer = $Customer->id;
     // 	$Shipping->updates($_POST['shipping']);
     // 	$Shipping->save();
     // 	if (!$updated) __('Customer updated.','Shopp');
     // 	$Customer = false;
     //
     // }
     $pagenum = absint($paged);
     if (empty($pagenum)) {
         $pagenum = 1;
     }
     if (!$per_page || $per_page < 0) {
         $per_page = 20;
     }
     $index = $per_page * ($pagenum - 1);
     if (!empty($start)) {
         $startdate = $start;
         list($month, $day, $year) = explode("/", $startdate);
         $starts = mktime(0, 0, 0, $month, $day, $year);
     }
     if (!empty($end)) {
         $enddate = $end;
         list($month, $day, $year) = explode("/", $enddate);
         $ends = mktime(23, 59, 59, $month, $day, $year);
     }
     $customer_table = ShoppDatabaseObject::tablename(Customer::$table);
     $billing_table = ShoppDatabaseObject::tablename(BillingAddress::$table);
     $purchase_table = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
     $users_table = $wpdb->users;
     $where = array();
     if (!empty($s)) {
         $s = stripslashes($s);
         if (preg_match_all('/(\\w+?)\\:(?="(.+?)"|(.+?)\\b)/', $s, $props, PREG_SET_ORDER)) {
             foreach ($props as $search) {
                 $keyword = !empty($search[2]) ? $search[2] : $search[3];
                 switch (strtolower($search[1])) {
                     case "company":
                         $where[] = "c.company LIKE '%{$keyword}%'";
                         break;
                     case "login":
                         $where[] = "u.user_login LIKE '%{$keyword}%'";
                         break;
                     case "address":
                         $where[] = "(b.address LIKE '%{$keyword}%' OR b.xaddress='%{$keyword}%')";
                         break;
                     case "city":
                         $where[] = "b.city LIKE '%{$keyword}%'";
                         break;
                     case "province":
                     case "state":
                         $where[] = "b.state='{$keyword}'";
                         break;
                     case "zip":
                     case "zipcode":
                     case "postcode":
                         $where[] = "b.postcode='{$keyword}'";
                         break;
                     case "country":
                         $where[] = "b.country='{$keyword}'";
                         break;
                 }
             }
         } elseif (strpos($s, '@') !== false) {
             $where[] = "c.email='{$s}'";
         } elseif (is_numeric($s)) {
             $where[] = "c.id='{$s}'";
         } else {
             $where[] = "(CONCAT(c.firstname,' ',c.lastname) LIKE '%{$s}%' OR c.company LIKE '%{$s}%')";
         }
     }
     if (!empty($starts) && !empty($ends)) {
         $where[] = ' (UNIX_TIMESTAMP(c.created) >= ' . $starts . ' AND UNIX_TIMESTAMP(c.created) <= ' . $ends . ')';
     }
     $select = array('columns' => 'SQL_CALC_FOUND_ROWS c.*,city,state,country,user_login', 'table' => "{$customer_table} as c", 'joins' => array($billing_table => "LEFT JOIN {$billing_table} AS b ON b.customer=c.id AND b.type='billing'", $users_table => "LEFT JOIN {$users_table} AS u ON u.ID=c.wpuser AND (c.wpuser IS NULL OR c.wpuser != 0)"), 'where' => $where, 'groupby' => "c.id", 'orderby' => "c.created DESC", 'limit' => "{$index},{$per_page}");
     $query = sDB::select($select);
     $Customers = sDB::query($query, 'array', 'index', 'id');
     $total = sDB::found();
     // Add order data to customer records in this view
     $orders = sDB::query("SELECT customer,SUM(total) AS total,count(id) AS orders FROM {$purchase_table} WHERE customer IN (" . join(',', array_keys($Customers)) . ") GROUP BY customer", 'array', 'index', 'customer');
     foreach ($Customers as &$record) {
         $record->total = 0;
         $record->orders = 0;
         if (!isset($orders[$record->id])) {
             continue;
         }
         $record->total = $orders[$record->id]->total;
         $record->orders = $orders[$record->id]->orders;
     }
     $num_pages = ceil($total / $per_page);
     $ListTable = ShoppUI::table_set_pagination(ShoppAdmin::screen(), $total, $num_pages, $per_page);
     $ranges = array('all' => __('Show New Customers', 'Shopp'), 'today' => __('Today', 'Shopp'), 'week' => __('This Week', 'Shopp'), 'month' => __('This Month', 'Shopp'), 'quarter' => __('This Quarter', 'Shopp'), 'year' => __('This Year', 'Shopp'), 'yesterday' => __('Yesterday', 'Shopp'), 'lastweek' => __('Last Week', 'Shopp'), 'last30' => __('Last 30 Days', 'Shopp'), 'last90' => __('Last 3 Months', 'Shopp'), 'lastmonth' => __('Last Month', 'Shopp'), 'lastquarter' => __('Last Quarter', 'Shopp'), 'lastyear' => __('Last Year', 'Shopp'), 'lastexport' => __('Last Export', 'Shopp'), 'custom' => __('Custom Dates', 'Shopp'));
     $exports = array('tab' => __('Tab-separated.txt', 'Shopp'), 'csv' => __('Comma-separated.csv', 'Shopp'), 'xls' => __('Microsoft&reg; Excel.xls', 'Shopp'));
     $formatPref = shopp_setting('customerexport_format');
     if (!$formatPref) {
         $formatPref = 'tab';
     }
     $columns = array_merge(Customer::exportcolumns(), BillingAddress::exportcolumns(), ShippingAddress::exportcolumns());
     $selected = shopp_setting('customerexport_columns');
     if (empty($selected)) {
         $selected = array_keys($columns);
     }
     $authentication = shopp_setting('account_system');
     $action = add_query_arg(array('page' => ShoppAdmin::pagename('customers')), admin_url('admin.php'));
     include $this->ui('customers.php');
 }
예제 #28
0
		<?php 
$ListTable->pagination('top');
?>
	</div>

	<table class="widefat" cellspacing="0">
		<thead>
		<tr><?php 
ShoppUI::print_column_headers($this->id);
?>
</tr>
		</thead>
		<tfoot>
		<tr><?php 
ShoppUI::print_column_headers($this->id, false);
?>
</tr>
		</tfoot>
	<?php 
if (count($Categories) > 0) {
    ?>
		<tbody id="categories-table" class="list categories">
		<?php 
    $columns = get_column_headers($this->id);
    $hidden = get_hidden_columns($this->id);
    $even = false;
    foreach ($Categories as $Category) {
        ?>
			<tr<?php 
        if (!$even) {
예제 #29
0
<?php

$editaddress = ShoppAdminCustomerBillingAddressBox::editor($Customer, 'shipping');
$address = array('${type}' => 'shipping', '${address}' => $Customer->Shipping->address, '${xaddress}' => $Customer->Shipping->xaddress, '${city}' => $Customer->Shipping->city, '${state}' => $Customer->Shipping->state, '${postcode}' => $Customer->Shipping->postcode, '${country}' => $Customer->Shipping->country, '${statemenu}' => Shopp::menuoptions($Customer->_shipping_states, $Customer->Shipping->state, true), '${countrymenu}' => Shopp::menuoptions($Customer->_countries, $Customer->Shipping->country, true));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($address));
shopp_custom_script('customers', 'address["shipping"] = ' . $js . ';');
?>
<div id="shipping-address-editor" class="editor">
<?php 
echo ShoppUI::template($editaddress, $address);
?>
</div>
예제 #30
0
		<br class="clear" />
	</div>
	</form>
	<div class="clear"></div>

	<form action="" method="post" id="inventory-manager">
	<table class="widefat" cellspacing="0">
		<thead>
		<tr><?php 
ShoppUI::print_column_headers('toplevel_page_shopp-products');
?>
</tr>
		</thead>
		<tfoot>
		<tr><?php 
ShoppUI::print_column_headers('toplevel_page_shopp-products', false);
?>
</tr>
		</tfoot>
	<?php 
if ($Products->size() > 0) {
    ?>
		<tbody id="products" class="list products">
		<?php 
    $hidden = get_hidden_columns('toplevel_page_shopp-products');
    $even = false;
    foreach ($Products as $key => $Product) {
        $editurl = esc_url(esc_attr(add_query_arg(array_merge(stripslashes_deep($_GET), array('page' => 'shopp-products', 'id' => $Product->id, 'f' => null)), admin_url('admin.php'))));
        $ProductName = empty($Product->name) ? '(' . __('no product name', 'Shopp') . ')' : $Product->name;
        ?>
		<tr<?php