示例#1
0
function save_meta_box($Customer)
{
    ?>
<div id="misc-publishing-actions">
<?php 
    if ($Customer->id > 0) {
        ?>
<p><strong><a href="<?php 
        echo esc_url(add_query_arg(array('page' => 'shopp-orders', 'customer' => $Customer->id), admin_url('admin.php')));
        ?>
"><?php 
        _e('Orders', 'Shopp');
        ?>
</a>: </strong><?php 
        echo $Customer->orders;
        ?>
 &mdash; <strong><?php 
        echo Shopp::money($Customer->total);
        ?>
</strong></p>
<p><strong><a href="<?php 
        echo esc_url(add_query_arg(array('page' => 'shopp-customers', 'range' => 'custom', 'start' => date('n/j/Y', $Customer->created), 'end' => date('n/j/Y', $Customer->created)), admin_url('admin.php')));
        ?>
"><?php 
        _e('Joined', 'Shopp');
        ?>
</a>: </strong><?php 
        echo date(get_option('date_format'), $Customer->created);
        ?>
</p>
<?php 
    }
    do_action('shopp_customer_editor_info', $Customer);
    ?>
</div>
<div id="major-publishing-actions">
	<input type="submit" class="button-primary" name="save" value="<?php 
    _e('Save Changes', 'Shopp');
    ?>
" />
</div>
<?php 
}
示例#2
0
文件: setup.php 项目: msigley/shopp
echo $statesmenu;
?>
			</select>
			<br />
			<?php 
Shopp::_e('Select your primary business location.');
?>
<br />
			<?php 
if (!empty($operations['country'])) {
    ?>
			<strong><?php 
    Shopp::_e('Currency');
    ?>
: </strong><?php 
    echo Shopp::money(1000.0);
    ?>
			<?php 
    if (shopp_setting_enabled('tax_inclusive')) {
        ?>
<strong>(+<?php 
        echo strtolower(Shopp::__('Tax'));
        ?>
)</strong><?php 
    }
    ?>
			<?php 
}
?>
		</td>
	</tr>
示例#3
0
function manage_meta_box($Purchase)
{
    $Gateway = $Purchase->gateway();
    ?>
<form action="<?php 
    echo ShoppAdminController::url(array('id' => $Purchase->id));
    ?>
" method="post">

<?php 
    if ($Purchase->shippable) {
        ?>
<script id="shipment-ui" type="text/x-jquery-tmpl">
<?php 
        ob_start();
        ?>
<li class="inline-fields">
	<span class="number">${num}.</span>
	<span><input type="text" name="shipment[${id}][tracking]" value="${tracking}" size="30" class="tracking" /><br />
	<label><?php 
        _e('Tracking Number');
        ?>
</label>
	</span>
	<span>
	<select name="shipment[${id}][carrier]">${carriermenu}</select><?php 
        echo ShoppUI::button('delete', 'delete-shipment[${id}]');
        ?>
<br />
	<label><?php 
        _e('Carrier');
        ?>
</label>
	</span>
</li>
<?php 
        $shipmentui = ob_get_contents();
        ob_end_clean();
        echo $shipmentui;
        ?>
</script>

<script id="shipnotice-ui" type="text/x-jquery-tmpl">
<?php 
        ob_start();
        ?>
<div class="shipnotice misc-pub-section">
	<div class="shipment">
		<h4><big><?php 
        _e('Shipments', 'Shopp');
        ?>
</big></h4>
		<p><?php 
        _e('An email will be sent to notify the customer.', 'Shopp');
        ?>
</p>
		<input type="hidden" name="ship-notice" value="active" />
		<ol>
			${shipments}
			<li><span class="number">${shipmentnum}.</span> <input type="submit" id="addship-button" name="add-shipment" value="<?php 
        _e('Add Shipment', 'Shopp');
        ?>
" class="button-secondary" /></li>
		</ol>

		<div class="submit">
			<input type="submit" id="cancel-ship" name="cancel-shipments" value="<?php 
        _e('Cancel', 'Shopp');
        ?>
" class="button-secondary" />
			<div class="alignright">
			<input type="submit" name="submit-shipments" value="<?php 
        _e('Send Shipping Notice', 'Shopp');
        ?>
" class="button-primary" />
			</div>
		</div>
	</div>
</div>
<?php 
        $shipnotice_ui = ob_get_contents();
        ob_end_clean();
        echo $shipnotice_ui;
        ?>
</script>
<?php 
    }
    ?>

<?php 
    if (!$Purchase->isvoid()) {
        ?>
<script id="refund-ui" type="text/x-jquery-tmpl">
<?php 
        ob_start();
        ?>
<div class="refund misc-pub-section">
	<div class="refunding">
		<h4><big>${title}</big></h4>
		An email will be sent to notify the customer.
		<input type="hidden" name="order-action" value="${action}" />

		<div><label for="message"><?php 
        _e('Message to the customer', 'Shopp');
        ?>
</label>
			<textarea name="message" id="message" cols="50" rows="7" ></textarea></div>

		<div class="alignright">
			<div class="inline-fields">
				<span>
				<select name="reason">
					<option>&mdash; Select &mdash;</option>
					<?php 
        echo Shopp::menuoptions(stripslashes_deep(shopp_setting('cancel_reasons')), false, true);
        ?>
				</select><br />
				<label>${reason}</label>
				</span>

				<span><input type="text" name="amount" value="<?php 
        echo Shopp::money($Purchase->total);
        ?>
" ${disable_amount} /><br />
				<label><?php 
        _e('Amount', 'Shopp');
        ?>
</label></span>
			</div>
		</div>
		<div class="clear"></div>
		<div class="submit">
			<input type="submit" id="cancel-refund" name="cancel-refund" value="${cancel}" class="button-secondary" />
			<div class="alignright">
			<span class="mark-status">
				<input type="hidden" name="send" value="off" />
				<label title="<?php 
        printf(__('Enable to process through the payment gateway (%s) and set the Shopp payment status. Disable to update only the Shopp payment status.', 'Shopp'), $Gateway->name);
        ?>
"><input type="checkbox" name="send" value="on" <?php 
        if ($Gateway && $Gateway->refunds) {
            echo ' checked="checked"';
        }
        ?>
/>&nbsp;${send}</label>
			</span>

			<input type="submit" name="process-refund" value="${process}" class="button-primary" />
			</div>
		</div>
	</div>
</div>
<?php 
        $refundui = ob_get_contents();
        ob_end_clean();
        echo $refundui;
        ?>
</script>
<?php 
    }
    ?>

<div class="minor-publishing">

	<div class="minor-publishing-actions headline">
	<div class="misc-pub-section controls">
	<?php 
    $printurl = wp_nonce_url(admin_url('admin-ajax.php') . '?action=shopp_order_receipt&amp;id=' . $Purchase->id, 'wp_ajax_shopp_order_receipt');
    $controls = '<div class="alignright"><a id="print-button" href="' . esc_url($printurl) . '" class="button hide-if-no-js" target="_blank">' . __('Print Order', 'Shopp') . '</a></div>';
    echo apply_filters('shopp_order_management_controls', $controls, $Purchase);
    ?>
	</div>
		<div class="misc-pub-section">
			<div class="status">
			<?php 
    if (isset($Purchase->txnevent)) {
        $UI = OrderEventRenderer::renderer($Purchase->txnevent);
        $event = array('<strong>' . $UI->name() . '</strong>');
        if ('' != $UI->details()) {
            $event[] = $UI->details();
        }
        if ('' != $UI->date()) {
            $event[] = $UI->date();
        }
        echo '<p>' . join(' &mdash; ', $event) . '</p>';
    } else {
        ?>
				<?php 
        if (!empty($Purchase->txnid)) {
            ?>
				<p><strong><?php 
            _e('Processed by', 'Shopp');
            ?>
 </strong><?php 
            echo $Purchase->gateway;
            echo !empty($Purchase->txnid) ? " ({$Purchase->txnid})" : "";
            ?>
</p>
				<?php 
        }
        ?>
				<?php 
        $output = '';
        if (!empty($Purchase->card) && !empty($Purchase->cardtype)) {
            $output = '<p><strong>' . $Purchase->txnstatus . '</strong> ' . __('to', 'Shopp') . ' ' . (!empty($Purchase->cardtype) ? $Purchase->cardtype : '') . (!empty($Purchase->card) ? sprintf(" (&hellip;%d)", $Purchase->card) : '') . '</p>';
        }
        echo apply_filters('shopp_orderui_payment_card', $output, $Purchase);
    }
    if (isset($Purchase->shipevent)) {
        $UI = OrderEventRenderer::renderer($Purchase->shipevent);
        echo '<p><strong>' . $UI->name() . '</strong> ' . $UI->details() . ' &mdash; ' . $UI->date() . '</p>';
    }
    ?>
			</div>
		</div>
		<div class="manager-ui">
		<?php 
    $action = false;
    if (isset($_POST['ship-notice']) && 'active' != $_POST['ship-notice']) {
        $action = 'ship-notice';
    } elseif (isset($_POST['edit-billing-address']) || isset($_POST['edit-shipping-address'])) {
        $action = 'edit-address';
    } elseif (isset($_POST['cancel-order']) || isset($_POST['refund-order'])) {
        $action = 'refund-order';
    }
    if (isset($_POST['cancel-shipments']) && 'ship-notice' == $action) {
        $action = false;
    }
    if (isset($_POST['cancel-refund']) && 'refund-order' == $action) {
        $action = false;
    }
    if ('ship-notice' == $action) {
        unset($_POST['cancel-order'], $_POST['refund-order']);
        $default = array('tracking' => '', 'carrier' => '');
        $shipment = isset($_POST['shipment']) ? $_POST['shipment'] : array($default);
        $shipments = (int) $_POST['shipments'];
        if (isset($_POST['delete-shipment'])) {
            $queue = array_keys($_POST['delete-shipment']);
            foreach ($queue as $index) {
                array_splice($shipment, $index, 1);
            }
        }
        if (isset($_POST['add-shipment'])) {
            $shipment[] = $default;
        }
        global $carriers_menu;
        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);
    }
    if ('edit-address' == $action) {
        if (isset($_POST['edit-billing-address'])) {
            $data = array('${type}' => 'billing', '${title}' => __('Edit Billing Address', 'Shopp'), '${firstname}' => $Purchase->firstname, '${lastname}' => $Purchase->lastname, '${address}' => $Purchase->address, '${xaddress}' => $Purchase->xaddress, '${city}' => $Purchase->city, '${state}' => $Purchase->state, '${postcode}' => $Purchase->postcode);
            $data['${statemenu}'] = Shopp::menuoptions($Purchase->_billing_states, $Purchase->state, true);
            $data['${countrymenu}'] = Shopp::menuoptions($Purchase->_countries, $Purchase->country, true);
        }
        if (isset($_POST['edit-shipping-address'])) {
            $shipname = explode(' ', $Purchase->shipname);
            $shipfirst = array_shift($shipname);
            $shiplast = join(' ', $shipname);
            $data = array('${type}' => 'shipping', '${title}' => __('Edit Shipping Address', 'Shopp'), '${firstname}' => $shipfirst, '${lastname}' => $shiplast, '${address}' => $Purchase->shipaddress, '${xaddress}' => $Purchase->shipxaddress, '${city}' => $Purchase->shipcity, '${state}' => $Purchase->shipstate, '${postcode}' => $Purchase->shippostcode);
            $data['${statemenu}'] = Shopp::menuoptions($Purchase->_shipping_states, $Purchase->shipstate, true);
            $data['${countrymenu}'] = Shopp::menuoptions($Purchase->_countries, $Purchase->shipcountry, true);
        }
        $data['${action}'] = 'update-address';
        echo ShoppUI::template($editaddress, $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) {
                ?>
				<input type="submit" id="cancel-order" name="cancel-order" value="<?php 
                _e('Cancel Order', 'Shopp');
                ?>
" class="button-secondary cancel" />
			<?php 
            }
            ?>
			<?php 
            if (current_user_can('shopp_refund') && ('CHARGED' == $Purchase->txnstatus || $Purchase->authorized && $Purchase->captured && $Purchase->refunded < $Purchase->total)) {
                ?>
				<input type="submit" id="refund-button" name="refund-order" value="<?php 
                _e('Refund', 'Shopp');
                ?>
" class="button-secondary refund" />
			<?php 
            }
            ?>
		</div>
		<?php 
        }
        ?>
		&nbsp;
		<?php 
        if ($Purchase->authorized || 0 == $Purchase->balance) {
            ?>
			<?php 
            if ($Purchase->shippable && 'ship-notice' != $action && is_array(shopp_setting('shipping_carriers'))) {
                ?>
			<input type="submit" id="shipnote-button" name="ship-notice" value="<?php 
                _e('Send Shipment Notice', 'Shopp');
                ?>
" class="button-primary" />
			<?php 
            }
            ?>
			<?php 
            if (current_user_can('shopp_capture') && !$Purchase->captured && $Gateway && $Gateway->captures) {
                ?>
			<input type="submit" name="charge" value="<?php 
                _e('Charge Order', 'Shopp');
                ?>
" class="button-primary" />
			<?php 
            }
            ?>
		<?php 
        }
        ?>
	</div>
<?php 
    }
    ?>
</form>
<?php 
}
示例#4
0
</a></span>
					<?php 
        }
        ?>
				</div>

			</td>
			<td class="discount column-discount<?php 
        echo in_array('discount', $hidden) ? ' hidden' : '';
        ?>
"><?php 
        if ($Promotion->type == "Percentage Off") {
            echo Shopp::percentage((double) $Promotion->discount);
        }
        if ($Promotion->type == "Amount Off") {
            echo Shopp::money((double) $Promotion->discount);
        }
        if ($Promotion->type == "Free Shipping") {
            echo shopp_setting("free_shipping_text");
        }
        if ($Promotion->type == "Buy X Get Y Free") {
            Shopp::esc_html_e('Buy %s Get %s Free', $Promotion->buyqty, $Promotion->getqty);
        }
        ?>
</td>
			<td class="applied column-applied<?php 
        echo in_array('applied', $hidden) ? ' hidden' : '';
        ?>
"><?php 
        echo $Promotion->target;
        ?>
示例#5
0
 /**
  * Provides product addon input markup or properties for the current addon in the loop
  *
  * Used with `shopp('product.addons')` looping.
  *
  * @api `shopp('product.addon')`
  * @since 1.1
  *
  * @param string       $result  The output
  * @param array        $options The options
  * - **separator**: ` ` The separator to use between properties when requesting multiple properties
  * - **units**: `on` (on,off) Include the weight unit when weight is requested as a property
  * - **discounts**: `on` (on,off) When used with the **saleprice** property, shows the discounted price of the addon
  * - **taxes**: `null` (on,off) Include or exclude taxes from prices
  * - **input**: `null` (text,checkbox,radio,hidden) Sets the type of input to create
  * - **money**: `on` (on, off) Format the amount in the current currency format
  * - **number**: `off` (on, off) Provide the unformatted number (floating point)
  * @param ShoppProduct $O       The working object
  * @return string The addon input markup or property value
  **/
 public static function addon($result, $options, $O)
 {
     $defaults = array('separator' => ' ', 'units' => 'on', 'discounts' => 'on', 'taxes' => null, 'input' => null, 'money' => 'on', 'number' => 'off');
     $options = array_merge($defaults, $options);
     extract($options, EXTR_SKIP);
     if (isset($promos)) {
         $discounts = $promos;
     }
     // @deprecated support for deprecated `promos` option
     $types = array('hidden', 'checkbox', 'radio');
     $addon = current($O->prices);
     $taxes = isset($taxes) ? Shopp::str_true($taxes) : null;
     $weightunit = Shopp::str_true($units) ? shopp_setting('weight_unit') : '';
     $_ = array();
     if (array_key_exists('id', $options)) {
         $_[] = $addon->id;
     }
     if (array_key_exists('label', $options)) {
         $_[] = $addon->label;
     }
     if (array_key_exists('type', $options)) {
         $_[] = $addon->type;
     }
     if (array_key_exists('sku', $options)) {
         $_[] = $addon->sku;
     }
     if (array_key_exists('price', $options)) {
         $price = Shopp::roundprice(self::_taxed((double) $addon->price, $O, $addon->tax, $taxes));
         if (Shopp::str_true($money)) {
             $_[] = Shopp::money($price);
         } else {
             $_[] = $price;
         }
     }
     if (array_key_exists('saleprice', $options)) {
         $saleprice = Shopp::str_true($discounts) ? $addon->promoprice : $addon->saleprice;
         $saleprice = Shopp::roundprice(self::_taxed((double) $addon->promoprice, $O, $addon->tax, $taxes));
         if (Shopp::str_true($money)) {
             $_[] = Shopp::money($saleprice);
         } else {
             $_[] = $saleprice;
         }
     }
     if (array_key_exists('stock', $options)) {
         $_[] = $addon->stock;
     }
     if (array_key_exists('weight', $options)) {
         $_[] = round($addon->weight, 3) . (false !== $weightunit ? " {$weightunit}" : false);
     }
     if (array_key_exists('shipfee', $options)) {
         $shipfee = Shopp::roundprice($addon->shipfee);
         if (Shopp::str_true($money)) {
             $_[] = Shopp::money($shipfee);
         } else {
             $_[] = $shipfee;
         }
     }
     if (array_key_exists('sale', $options)) {
         return Shopp::str_true($addon->sale);
     }
     if (array_key_exists('shipping', $options)) {
         return Shopp::str_true($addon->shipping);
     }
     if (array_key_exists('tax', $options)) {
         return Shopp::str_true($addon->tax);
     }
     if (array_key_exists('inventory', $options)) {
         return Shopp::str_true($addon->inventory);
     }
     if (in_array($input, $types)) {
         $_[] = '<input type="' . $input . '" name="products[' . (int) $O->id . '][addons][]" value="' . esc_attr($addon->id) . '"' . inputattrs($options) . ' />';
     }
     return join($separator, $_);
 }
示例#6
0
/**
 * @deprecated Use Shopp::money()
 **/
function money($amount, $format = array())
{
    return Shopp::money($amount, $format);
}
示例#7
0
" class="add-new-h2"><?php 
Shopp::_e('Add New');
?>
</a>
	<?php 
if (current_user_can('shopp_financials')) {
    ?>
		<span class="summary"><strong><?php 
    echo Shopp::money($Table->ordercount->sales);
    ?>
</strong> <span><?php 
    Shopp::_e('Total Sales');
    ?>
</span>&nbsp;&nbsp;&nbsp;
		<strong><?php 
    echo Shopp::money($Table->ordercount->avgsale);
    ?>
</strong> <span><?php 
    Shopp::_e('Average Sale');
    ?>
</span></span>
	<?php 
}
?>
</h2>

	<?php 
do_action('shopp_admin_notices');
?>

	<form action="<?php 
示例#8
0
			<textarea name="message" id="message" cols="50" rows="7" ></textarea></div>

		<div class="alignright">
			<div class="inline-fields">
				<span>
				<select name="reason">
					<option>&mdash; Select &mdash;</option>
					<?php 
    echo Shopp::menuoptions(stripslashes_deep(shopp_setting('cancel_reasons')), false, true);
    ?>
				</select><br />
				<label>${reason}</label>
				</span>

				<span><input type="text" name="amount" value="<?php 
    echo Shopp::money($Purchase->total);
    ?>
" ${disable_amount} /><br />
				<label><?php 
    _e('Amount', 'Shopp');
    ?>
</label></span>
			</div>
		</div>
		<div class="clear"></div>
		<div class="submit">
			<input type="submit" id="cancel-refund" name="cancel-refund" value="${cancel}" class="button-secondary" />
			<div class="alignright">
			<span class="mark-status">
				<input type="hidden" name="send" value="off" />
				<label title="<?php 
示例#9
0
		<li><strong><?php 
    echo $ordercount->total;
    ?>
</strong> <span><?php 
    _e('Orders', 'Shopp');
    ?>
</span></li>
		<li><strong><?php 
    echo Shopp::money($ordercount->sales);
    ?>
</strong> <span><?php 
    _e('Total Sales', 'Shopp');
    ?>
</span></li>
		<li><strong><?php 
    echo Shopp::money($ordercount->avgsale);
    ?>
</strong> <span><?php 
    _e('Average Sale', 'Shopp');
    ?>
</span></li>
	</ul>
	<?php 
}
?>

	<div class="tablenav">
		<div class="alignleft actions">
		<?php 
if (current_user_can('shopp_delete_orders')) {
    ?>
示例#10
0
 /**
  * Filter callback to add standard monetary option behaviors
  *
  * @internal
  * @since 1.2
  *
  * @param string        $result    The output
  * @param array         $options   The options
  * - **money**: `on` (on, off) Format the amount in the current currency format
  * - **number**: `off` (on, off) Provide the unformatted number (floating point)
  * @param string    $property  The tag property name
  * @param ShoppPurchase $O         The working object
  * @return ShoppPurchase The active ShoppPurchase context
  **/
 public static function _money($result, $options, $property, $O)
 {
     // Passthru for non-monetary results
     $monetary = array('freight', 'subtotal', 'discount', 'shipping', 'itemaddon', 'itemtotal', 'itemunitprice', 'tax', 'total');
     if (!in_array($property, $monetary) || !is_numeric($result)) {
         return $result;
     }
     // Special case for purchase.item-addon `unitprice` option
     if ('itemaddon' == $property && !in_array('uniprice', $options)) {
         return $result;
     }
     // @deprecated currency parameter
     if (isset($options['currency'])) {
         $options['money'] = $options['currency'];
     }
     $defaults = array('money' => 'on', 'number' => false);
     $options = array_merge($defaults, $options);
     extract($options);
     if (Shopp::str_true($number)) {
         return $result;
     }
     if (Shopp::str_true($money)) {
         $result = Shopp::money(Shopp::roundprice($result));
     }
     return $result;
 }
示例#11
0
文件: Main.php 项目: TakenCdosG/chefs
 /**
  * Gets the product price in the correct money format per store settings.
  *
  * @param int|object $product
  * @return string
  */
 public function get_price_html($product)
 {
     $product = shopp_product($product);
     if (false === $product) {
         return '';
     }
     return Shopp::money($this->get_single_price($product));
 }
示例#12
0
<div id="misc-publishing-actions">
<?php 
if ($Customer->id > 0) {
    ?>
<p><strong><a href="<?php 
    echo esc_url(add_query_arg(array('page' => 'shopp-orders', 'customer' => $Customer->id), admin_url('admin.php')));
    ?>
"><?php 
    _e('Orders', 'Shopp');
    ?>
</a>: </strong><?php 
    echo $Customer->orders;
    ?>
 &mdash; <strong><?php 
    echo Shopp::money($Customer->total);
    ?>
</strong></p>
<p><strong><a href="<?php 
    echo esc_url(add_query_arg(array('page' => 'shopp-customers', 'range' => 'custom', 'start' => date('n/j/Y', $Customer->created), 'end' => date('n/j/Y', $Customer->created)), admin_url('admin.php')));
    ?>
"><?php 
    _e('Joined', 'Shopp');
    ?>
</a>: </strong><?php 
    echo date(get_option('date_format'), $Customer->created);
    ?>
</p>
<?php 
}
do_action('shopp_customer_editor_info', $Customer);
?>