Ejemplo n.º 1
0
function wpsc_display_sales_log_index()
{
    global $purchlogitem;
    ?>
   <div class="wrap">
      <h2><?php 
    echo esc_html(__('Sales', 'wpsc'));
    ?>
 </h2>
      <?php 
    //START OF PURCHASE LOG DEFAULT VIEW
    ?>
      <?php 
    if (isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status'])) {
        wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
    }
    if (isset($_POST['purchlogs_searchbox'])) {
        wpsc_search_purchlog_view($_POST['purchlogs_searchbox']);
    }
    if (!isset($_REQUEST['purchaselog_id'])) {
        $columns = array('cb' => '<input type="checkbox" />', 'purchid' => __('Order ID', 'wpsc'), 'date' => __('Date / Time', 'wpsc'), 'name' => '', 'amount' => __('Amount', 'wpsc'), 'details' => __('Details', 'wpsc'), 'status' => __('Status', 'wpsc'), 'delete' => __('Delete', 'wpsc'), 'track' => __('Tracking ID', 'wpsc'));
        register_column_headers('display-sales-list', $columns);
        ///// start of update message section //////
        $fixpage = get_option('siteurl') . '/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
        if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked'])) {
            ?>
         <div id="message" class="updated fade"><p>
         <?php 
            if (isset($_GET['updated']) && (int) $_GET['updated']) {
                printf(_n('%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated'], 'wpsc'), absint($_GET['updated']));
                unset($_GET['updated']);
            }
            if (isset($_GET['skipped']) && (int) $_GET['skipped']) {
                unset($_GET['skipped']);
            }
            if (isset($_GET['locked']) && (int) $_GET['locked']) {
                printf(_n('%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked'], 'wpsc'), absint($_GET['locked']));
                unset($_GET['locked']);
            }
            if (isset($_GET['deleted']) && (int) $_GET['deleted']) {
                printf(_n('%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted'], 'wpsc'), absint($_GET['deleted']));
                unset($_GET['deleted']);
            }
            ?>
         </p></div>
      <?php 
        }
        if (get_option('wpsc_purchaselogs_fixed') == false || wpsc_check_uniquenames()) {
            ?>
            <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php 
            printf(__('When upgrading the WP e-Commerce Plugin from 3.6.* to 3.7 it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">Click Here</a>', 'wpsc'), $fixpage);
            ?>
</span></div>
   <?php 
        }
        ///// end of update message section //////
        ?>
      <div id='dashboard-widgets' style='min-width: 825px;'>
         <?php 
        /* end of sidebar start of main column */
        ?>
         <div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
            <div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>

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

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


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

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

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

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

                  <tfoot>
                  </tfoot>

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

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

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

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


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

            <?php 
        wpsc_custom_checkout_fields();
        ?>

            </div>
            </div>

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

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

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

<br /><br class='small' />&emsp;&ensp;    <a href='<?php 
        echo $page_back;
        ?>
'><?php 
        _e('Go Back', 'wpsc');
        ?>
</a>
<br /><br />
         </div>
         </div>
         <br />
         <?php 
    }
    ?>
   </div>
   <?php 
}
Ejemplo n.º 2
0
function wpsc_purchlog_search_by()
{
    //  exit('<pre>'.print_r($_POST,true).'</pre>');
    wpsc_search_purchlog_view($_POST['purchlogs_searchbox']);
}