private function purchase_log_cart_items()
    {
        while (wpsc_have_purchaselog_details()) {
            wpsc_the_purchaselog_item();
            ?>
      <tr>
         <td><?php 
            echo wpsc_purchaselog_details_name();
            ?>
</td> <!-- NAME! -->
         <td><?php 
            echo wpsc_purchaselog_details_SKU();
            ?>
</td> <!-- SKU! -->
         <td><?php 
            echo wpsc_purchaselog_details_quantity();
            ?>
</td> <!-- QUANTITY! -->
         <td>
	    <?php 
            echo wpsc_currency_display(wpsc_purchaselog_details_price());
            do_action('wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id());
            ?>
	 </td> <!-- PRICE! -->
         <td><?php 
            echo wpsc_currency_display(wpsc_purchaselog_details_shipping());
            ?>
</td> <!-- SHIPPING! -->
         <?php 
            if (wpec_display_product_tax()) {
                ?>
            <td><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_tax());
                ?>
</td> <!-- TAX! -->
         <?php 
            }
            ?>
         <!-- <td><?php 
            echo wpsc_currency_display(wpsc_purchaselog_details_discount());
            ?>
</td> --> <!-- DISCOUNT! -->
         <td class="amount"><?php 
            echo wpsc_currency_display(wpsc_purchaselog_details_total());
            ?>
</td> <!-- TOTAL! -->
      </tr>
      <?php 
        }
    }
function wpsc_display_purchlog_details()
{
    while (wpsc_have_purchaselog_details()) {
        wpsc_the_purchaselog_item();
        ?>
 	<tr>
 	<td><?php 
        echo wpsc_purchaselog_details_name();
        ?>
</td> <!-- NAME -->
 	<td><?php 
        echo wpsc_purchaselog_details_SKU();
        ?>
</td> <!-- SKU -->
 	<td><?php 
        echo wpsc_purchaselog_details_quantity();
        ?>
</td> <!-- QUANTITY-->
 	<td><?php 
        echo nzshpcrt_currency_display(wpsc_purchaselog_details_price(), true);
        ?>
</td> <!-- PRICE -->
 	<td><?php 
        echo nzshpcrt_currency_display(wpsc_purchaselog_details_tax(), true);
        ?>
</td> <!-- TAX -->
 	<?php 
        /* <td><?php echo nzshpcrt_currency_display(wpsc_purchaselog_details_discount(),true); ?></td> <!-- DISCOUNT --> */
        ?>
 	<td><?php 
        echo nzshpcrt_currency_display(wpsc_purchaselog_details_total(), true);
        ?>
</td> <!-- TOTAL -->
 	</tr>
 	<?php 
    }
}
Exemple #3
0
function get_packing_slip($purchase_ids, $purchase_id_arr)
{
    global $purchlogitem;
    if (!empty($purchase_ids) && !empty($purchase_id_arr)) {
        ?>
                    <style type="text/css">
                            body {
                                    font-family:"Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
                            }

                            h1 span {
                                    font-size:0.75em;
                            }

                            h2 {
                                    color: #333;
                            }

                            #wrapper {
                                    margin:0 auto;
                                    width:95%;
                                    page-break-after: always;
                            }

                            #header {
                            }

                            #customer {
                                    overflow:hidden;
                            }

                            #customer .shipping, #customer .billing {
                                    float: left;
                                    width: 50%;
                            }

                            table {
                                    border:1px solid #000;
                                    border-collapse:collapse;
                                    margin-top:1em;
                                    width:100%;
                            }

                            th {
                                    background-color:#efefef;
                                    text-align:center;
                            }

                            th, td {
                                    padding:5px;
                            }

                            td {
                                    text-align:center;
                            }

                            #cart-items td.amount {
                                    text-align:right;
                            }

                            td, tbody th {
                                    border-top:1px solid #ccc;
                            }
                            th.column-total {
                                    width:90px;
                            }
                            th.column-shipping {
                                    width:120px;
                            }
                            th.column-price {
                                    width:100px;
                            }
                    </style>
                <?php 
        if (!class_exists('wpsc_purchaselogs_items')) {
            require_once WP_PLUGIN_DIR . '/wp-e-commerce/wpsc-includes/purchaselogs.class.php';
        }
        foreach ($purchase_id_arr as $purchase_id_value) {
            $purchlogitem = new wpsc_purchaselogs_items((int) $purchase_id_value);
            ?>
                        <div id="wrapper">
                              <?php 
            echo smart_manager_print_logo();
            ?>
                            <div id="header" style="margin-top:-0.8em;">
                                    <h1>
                                        
                                            <?php 
            echo get_bloginfo('name');
            ?>
<br />
                                            <span><?php 
            printf(esc_html__('Packing Slip for Order #%s', 'wpsc'), $purchase_id_value);
            ?>
</span>
                                    </h1>
                            </div>
                            <div id="customer">
                                    <div class="shipping">
                                            <h2><?php 
            echo esc_html_x('Ship To:', 'packing slip', 'wpsc');
            ?>
</h2>
                                            <strong><?php 
            echo wpsc_display_purchlog_shipping_name();
            ?>
</strong><br />
                                            <?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 />
                                    </div>
                                    <div class="billing">
                                            <h2><?php 
            echo esc_html_x('Bill To:', 'packing slip', 'wpsc');
            ?>
</h2>
                                            <strong><?php 
            echo wpsc_display_purchlog_buyers_name();
            ?>
</strong><br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_address();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_city();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_state_and_postcode();
            ?>
<br />
                                            <?php 
            echo wpsc_display_purchlog_buyers_country();
            ?>
<br />
                                    </div>
                            </div>
                            <table id="order">
                                    <thead>
                                            <tr>
                                                    <th><?php 
            echo esc_html_x('Order Date', 'packing slip', 'wpsc');
            ?>
</th>
                                                    <th><?php 
            echo esc_html_x('Order ID', 'packing slip', 'wpsc');
            ?>
</th>
                                                    <th><?php 
            echo esc_html_x('Shipping Method', 'packing slip', 'wpsc');
            ?>
</th>
                                                    <th><?php 
            echo esc_html_x('Payment Method', 'packing slip', 'wpsc');
            ?>
</th>
                                            </tr>
                                    </thead>
                                    <tbody>
                                            <tr>
                                                    <td><?php 
            echo wpsc_purchaselog_details_date();
            ?>
</td>
                                                    <td><?php 
            echo wpsc_purchaselog_details_purchnumber();
            ?>
</td>
                                                    <td><?php 
            echo wpsc_display_purchlog_shipping_method();
            ?>
</td>
                                                    <td><?php 
            echo wpsc_display_purchlog_paymentmethod();
            ?>
</td>
                                            </tr>
                                    </tbody>
                            </table>
                            <table id="cart-items" class="widefat" cellspacing="0">
                                    <thead>
                                            <tr>
                                                    <th scope='col' id='title' class='manage-column column-title'  style=""><?php 
            _e('Item Name', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='sku' class='manage-column column-sku'  style=""><?php 
            _e('SKU', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='quantity' class='manage-column column-quantity'  style=""><?php 
            _e('Quantity', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='price' class='manage-column column-price'  style=""><?php 
            _e('Price', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='shipping' class='manage-column column-shipping'  style=""><?php 
            _e('Item Shipping', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='tax' class='manage-column column-tax'  style=""><?php 
            _e('Item Tax', 'wpsc');
            ?>
</th>
                                                    <th scope='col' id='total' class='manage-column column-total'  style=""><?php 
            _e('Item Total', 'wpsc');
            ?>
</th>

                                                    <?php 
            $cols = 5;
            // this is counted as ( count of th - 2 )
            ?>
                                            </tr>
                                    </thead>

                                    <tbody>
                                            <?php 
            while (wpsc_have_purchaselog_details()) {
                wpsc_the_purchaselog_item();
                ?>
                                                  <tr>
                                                     <td><?php 
                echo wpsc_purchaselog_details_name();
                ?>
</td> <!-- NAME! -->
                                                     <td><?php 
                echo wpsc_purchaselog_details_SKU();
                ?>
</td> <!-- SKU! -->
                                                     <td><?php 
                echo wpsc_purchaselog_details_quantity();
                ?>
</td> <!-- QUANTITY! -->
                                                     <td>
                                                        <?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_price());
                do_action('wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id());
                ?>
                                                     </td> <!-- PRICE! -->
                                                     <td><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_shipping());
                ?>
</td> <!-- SHIPPING! -->
                                                     <?php 
                if (wpec_display_product_tax()) {
                    ?>
                                                        <td><?php 
                    echo wpsc_currency_display(wpsc_purchaselog_details_tax());
                    ?>
</td> <!-- TAX! -->
                                                     <?php 
                }
                ?>
                                                     <!-- <td><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_discount());
                ?>
</td> --> <!-- DISCOUNT! -->
                                                     <td class="amount"><?php 
                echo wpsc_currency_display(wpsc_purchaselog_details_total());
                ?>
</td> <!-- TOTAL! -->
                                                  </tr>
                                                  <?php 
            }
            ?>

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

                                            <?php 
            if (!wpec_display_product_tax()) {
                ?>
                                                    <tr>
                                                            <td colspan='<?php 
                echo $cols;
                ?>
'></td>
                                                            <th><?php 
                esc_html_e('Taxes', 'wpsc');
                ?>
 </th>
                                                            <td class="amount"><?php 
                echo wpsc_display_purchlog_taxes();
                ?>
</td>
                                                    </tr>
                                            <?php 
            }
            ?>

                                            <tr>
                                                    <td colspan='<?php 
            echo $cols;
            ?>
'></td>
                                                    <th><?php 
            esc_html_e('Shipping', 'wpsc');
            ?>
 </th>
                                                    <td class="amount"><?php 
            echo wpsc_display_purchlog_shipping();
            ?>
</td>
                                            </tr>
                                            <tr>
                                                    <td colspan='<?php 
            echo $cols;
            ?>
'></td>
                                                    <th><?php 
            esc_html_e('Total', 'wpsc');
            ?>
 </th>
                                                    <td class="amount"><?php 
            echo wpsc_display_purchlog_totalprice();
            ?>
</td>
                                            </tr>
                                    </tbody>
                            </table>
                        </div>

                    <?php 
        }
        exit;
    }
}
function wpsc_display_purchlog_details()
{
    while (wpsc_have_purchaselog_details()) {
        wpsc_the_purchaselog_item();
        ?>
   <tr>
      <td><?php 
        echo wpsc_purchaselog_details_name();
        ?>
</td> <!-- NAME! -->
      <td><?php 
        echo wpsc_purchaselog_details_SKU();
        ?>
</td> <!-- SKU! -->
      <td><?php 
        echo wpsc_purchaselog_details_quantity();
        ?>
</td> <!-- QUANTITY! -->
      <td><?php 
        echo wpsc_currency_display(wpsc_purchaselog_details_price());
        ?>
</td> <!-- PRICE! -->
      <td><?php 
        echo wpsc_currency_display(wpsc_purchaselog_details_shipping());
        ?>
</td> <!-- SHIPPING! -->
      <td><?php 
        if (wpec_display_product_tax()) {
            echo wpsc_currency_display(wpsc_purchaselog_details_tax());
        }
        ?>
</td> <!-- TAX! -->
      <!-- <td><?php 
        echo wpsc_currency_display(wpsc_purchaselog_details_discount());
        ?>
</td> --> <!-- DISCOUNT! -->
      <td><?php 
        echo wpsc_currency_display(wpsc_purchaselog_details_total());
        ?>
</td> <!-- TOTAL! -->
   </tr>
<?php 
    }
}
function cph_wpsc_user_purchases($purchase_ids)
{
    global $wpdb;
    global $purchlogitem;
    $i = 0;
    $col_count = 4;
    //do_action( 'wpsc_pre_purchase_logs' );
    foreach ($purchase_ids as $purchase_id) {
        $alternate = "";
        $alternate_style = "";
        $i++;
        $purchlogitem = new wpsc_purchaselogs_items($purchase_id);
        //cph_purchase_log_cart_items();
        if ($i % 2 != 0) {
            $alternate = 'class="header-row alt"';
        }
        $alternate_style = 'style = "background: lightgray; font-weight: bold;"';
        $purchase_log = new WPSC_Purchase_Log($purchase_id);
        echo "<tr {$alternate} {$alternate_style} >\n\r";
        echo " <td style=\"width:25%;\" class='status processed'>";
        echo '<label>Purchase ID:</label>&nbsp;' . $purchase_id;
        echo " </td>\n\r";
        echo " <td style=\"width:25%;\" class='date'>";
        echo '<label>Date:</label>&nbsp;' . date("jS M Y", $purchase_log->get('date'));
        echo " </td>\n\r";
        echo " <td  style=\"width:25%;\" class='price'>";
        echo '<label>Total:</label>&nbsp;' . wpsc_currency_display($purchase_log->get('totalprice'), array('display_as_html' => false));
        echo " </td>\n\r";
        echo " <td style=\"width:25%;\" class='tracking'>";
        echo $purchase_log->get('track_id');
        echo " </td>\n\r";
        echo "</tr>\n\r";
        echo "<tr>\n\r";
        echo " <td colspan='{$col_count}' class='details'>\n\r";
        echo "  <div>\n\r";
        //cart contents display starts here;
        $cartsql = $wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`= %d", $purchase_id);
        $cart_log = $wpdb->get_results($cartsql, ARRAY_A);
        $j = 0;
        if ($cart_log != null) {
            echo "<table class='logdisplay'>";
            echo "<tr class='toprow2'>";
            echo " <th class='details_name'>";
            _e('Item Name', 'wp-e-commerce');
            echo " </th>";
            echo " <th class='details_quantity'>";
            _e('Quantity', 'wp-e-commerce');
            echo " </th>";
            echo " <th class='details_price'>";
            _e('Price', 'wp-e-commerce');
            echo " </th>";
            echo " <th class='details_total'>";
            _e('Total', 'wp-e-commerce');
            echo " </th>";
            echo "</tr>";
            while (wpsc_have_purchaselog_details()) {
                wpsc_the_purchaselog_item();
                $alternate = "";
                $j++;
                if ($j % 2 != 0) {
                    $alternate = "alt";
                }
                echo "<tr class='{$alternate}'>";
                echo " <td class='details_name'>";
                echo wpsc_purchaselog_details_href();
                echo " </td>";
                echo " <td class='details_quantity'>";
                echo wpsc_purchaselog_details_quantity();
                echo " </td>";
                echo " <td class='details_price'>";
                echo wpsc_currency_display(wpsc_purchaselog_details_price());
                echo " </td>";
                echo " <td class='details_total'>";
                echo wpsc_currency_display(wpsc_purchaselog_details_total());
                echo " </td>";
                echo '</tr>';
                echo '<tr>';
                do_action('wpsc_additional_sales_item_info', $purchase_id);
                echo '</tr>';
            }
            echo "</table>";
            echo "<br />";
        }
        echo "  </div>\n\r";
        echo " </td>\n\r";
        echo "</tr>\n\r";
    }
}