Beispiel #1
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>
Beispiel #2
0
 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);
 }
Beispiel #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);
 }
Beispiel #4
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);
 }
Beispiel #5
0
 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);
 }
Beispiel #6
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 
}
Beispiel #7
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);
Beispiel #8
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) {
Beispiel #9
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">
Beispiel #10
0
 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);
 }