WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP e-Commerce] Purchase Log Modifications (10 posts)

  1. Wingless_Angel31
    Member
    Posted 5 years ago #

    A few features I'd like to add to my Purchase Logs, actually:

    1. I want to be able to filter and see all UNACCEPTED transactions.
    2. I want to be able to see the Brand ID in the Purchase Log and in the CSV.

    Is it too difficult for me to edit the files myself? Would really appreciate if someone was able to guide me through it thanks!

  2. Wingless_Angel31
    Member
    Posted 5 years ago #

    I have been able to modify and make my purchase log fulfill my request number 1. Haha.

    ANOTHER PROOF THAT WP E-COMMERCE IS NOT AS USER-UNFRIENDLY AS MANY PEOPLE SAY IT IS. ALL YOU NEED IS HARD WORK AND EFFORT, TO SLOWLY LEARN ABOUT HOW THE THINGS IS CODED.

    I'm still thinking of how to fulfill request number 2 though..

  3. Dan Milward
    Member
    Posted 5 years ago #

    All I can say to that is well done!!! Send Tom an email and we'll have a chat about integrating your #1 feature and we'll have a think about #2 feature...

  4. Dan Milward
    Member
    Posted 5 years ago #

    Hey Mate. Did you check out the latest version (3.6.8 RC1). I believe Tom added these filters.. if not you have my email. Let me know :D

  5. hazmat101
    Member
    Posted 5 years ago #

    Hey mufasa. Are these log modifications included in the latest version????

    Hey Wingless_Angel31. Yeah I found WP e-Commerce friendly and easy to use too. I have used Magneto and OS Commerce and they both took hours to setup unlike WP eCommerce that just took me around an hour to get the hang of :)

  6. pwmuts
    Member
    Posted 5 years ago #

    Yeah I agree OS Commerce is too difficult for a normal user. Also adding plug-ins and any customizing to it is destructive to the file structure, unlike wordpress where everything just goes into plugins or theme folders.

    I like what I see in the examples so I am really considering installing WP e-Commerce but I have some crucial questions.

    • I am not in that much of a hurry so is it worth it to uninstall the current WordPress and install 2.5 so WP e-Commerce works? Or should I wait for a new version that works with the current WordPress?

    • Also This would be for a clothing/apparel store so it would be nice to have drop down menu for each size of the item. The problem is all of the apparel is rare so we will only be able to stock one or two of each size of the items. Can WP e-Commerce keep inventory of an item for each size or will this cause problems with inventory?

  7. Dan Milward
    Member
    Posted 5 years ago #

    1/ WP e-Commerce works with WordPress 2.6, at least it does on this development site: http://www.instinct.co.nz/allendev/

    2/ You have control of variations and stock control for each variation. So long as you don't add more then two variations for each shirt you won't loose control. In other words colour and size...

    Ciao,

    Dan

  8. Wingless_Angel31
    Member
    Posted 5 years ago #

    Hey Dan,
    http://wordpress.org/extend/plugins/wp-e-commerce/
    Wordpress isn't helping you. Haha. It's the RC1 version but it's stated to work up to WP 2.5.1 so probably that's how all your questions come in.

  9. Wingless_Angel31
    Member
    Posted 5 years ago #

    Oh I just updated my plugin. Hm. No, the filter I was talking about isn't included.

    First, I added "define('TXT_WPSC_LOG_TRANSACTIONUNACCEPTEDLOGS', 'Display only unaccepted transactions')" in EN_en.php in the "languages" folder.
    Second, I changed the display-log.php file because the current system couldn't deliver what I wanted. Nothing much, just that I used different values for the already present variables. I'm attaching the code below (the whole file, I forgot what I changed already):

    <?php
    /*
     * this updates the processing status of an item
     */
    if(is_numeric($_GET['id']) && is_numeric($_GET['value']))
      {
      $max_stage = $wpdb->get_var("SELECT MAX(*) AS <code>max</code> FROM <code>&quot;.$wpdb->prefix.&quot;purchase_statuses</code> WHERE <code>active</code>='1'");
      if(is_numeric($_GET['value']) && ($_GET['value'] <= $max_stage))
        {
        $newvalue = $_GET['value'];
        }
        else
          {
          $newvalue = 1;
          }
      $log_data = $wpdb->get_row("SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>id</code> = '".$_GET['id']."' LIMIT 1");
      $update_sql = "UPDATE <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> SET <code>processed</code> = '".$newvalue."' WHERE <code>id</code> = '".$_GET['id']."' LIMIT 1";
      $wpdb->query($update_sql);
      if(($newvalue > $log_data['processed']) && ($log_data['processed'] <=1))
        {
        transaction_results($log_data['sessionid'], false);
        }
      }
    
    if(is_numeric($_GET['deleteid']))
      {
      $delete_id = $_GET['deleteid'];
      $delete_log_form_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;cart_contents</code> WHERE <code>purchaseid</code>='$delete_id'";
      $cart_content = $wpdb->get_results($delete_log_form_sql,ARRAY_A);
      foreach((array)$cart_content as $cart_item)
        {
        $cart_item_variations = $wpdb->query("DELETE FROM <code>&quot;.$wpdb->prefix.&quot;cart_item_variations</code> WHERE <code>cart_id</code> = '".$cart_item['id']."'", ARRAY_A);
        }
      $wpdb->query("DELETE FROM <code>&quot;.$wpdb->prefix.&quot;cart_contents</code> WHERE <code>purchaseid</code>='$delete_id'");
      $wpdb->query("DELETE FROM <code>&quot;.$wpdb->prefix.&quot;submited_form_data</code> WHERE <code>log_id</code> IN ('$delete_id')");
      $wpdb->query("DELETE FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>id</code>='$delete_id' LIMIT 1");
      echo '<div id="message" class="updated fade"><p>'.TXT_WPSC_THANKS_DELETED.'</p></div>';
      }
    
    if(isset($_GET['clear_locks']) && ($_GET['clear_locks'] == 'true') && is_numeric($_GET['purchaseid'])) {
      $purchase_id = (int)$_GET['purchaseid'];
      $downloadable_items = $wpdb->get_results("SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;download_status</code> WHERE <code>purchid</code> IN ('$purchase_id')", ARRAY_A);
    
      $clear_locks_sql = "UPDATE<code>&quot;.$wpdb->prefix.&quot;download_status</code> SET <code>ip_number</code> = '' WHERE <code>purchid</code> IN ('$purchase_id')";
      $wpdb->query($clear_locks_sql);
    
    	$email_form_field = $wpdb->get_var("SELECT <code>id</code> FROM <code>&quot;.$wpdb->prefix.&quot;collect_data_forms</code> WHERE <code>type</code> IN ('email') AND <code>active</code> = '1' ORDER BY <code>order</code> ASC LIMIT 1");
    	$email_address = $wpdb->get_var("SELECT <code>value</code> FROM <code>&quot;.$wpdb->prefix.&quot;submited_form_data</code> WHERE <code>log_id</code>='{$purchase_id}' AND <code>form_id</code> = '{$email_form_field}' LIMIT 1");
    
    	foreach($downloadable_items as $downloadable_item) {
    	  $download_links .= $siteurl."?downloadid=".$downloadable_item['uniqueid']. "\n";
    	}
    
    	mail($email_address, TXT_WPSC_USER_UNLOCKED_EMAIL, str_replace("[download_links]", $download_links, TXT_WPSC_USER_UNLOCKED_EMAIL_MESSAGE), "From: ".get_option('return_email')."");
    
      echo '<div id="message" class="updated fade"><p>'.TXT_WPSC_THANKS_UNLOCKED.'</p></div>';
    }
    
    //echo("<pre>".print_r($cart_item,true)."</pre>");
    /*
     * this finds the earliest time in the shopping cart and sorts out the timestamp system for the month by month display
     */  
    
    $earliest_record_sql = "SELECT MIN(<code>date</code>) AS <code>date</code> FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>date</code>!=''";
    $earliest_record = $wpdb->get_results($earliest_record_sql,ARRAY_A) ;
    
    $current_timestamp = time();
    $earliest_timestamp = $earliest_record[0]['date'];
    
    $current_year = date("Y");
    $earliest_year = date("Y",$earliest_timestamp);
    
    $j = 0;
    for($year = $current_year; $year >= $earliest_year; $year--)
      {
      for($month = 12; $month >= 1; $month--)
        {
        $start_timestamp = mktime(0, 0, 0, $month, 1, $year);
        $end_timestamp = mktime(0, 0, 0, ($month+1), 1, $year);
        if(($end_timestamp >= $earliest_timestamp) && ($start_timestamp <= $current_timestamp))
          {
          $date_list[$j]['start'] = $start_timestamp;
          $date_list[$j]['end'] = $end_timestamp;
          $j++;
          }
        }
      }
    
    if($_GET['filter'] !== 'true')
      {
      if(is_numeric($_GET['filter'])) {
        $max_number = $_GET['filter'];
    	} else {
    		if ($_GET['filter']=='paid') {
    			$paidlog=paid;
    		}			else if ($_GET['filter']=='unpaid') {
    			$paidlog=unpaid;
    		}
    
    		$max_number = 3;
    	}
    
      $date_list = array_slice($date_list, 0, $max_number);
      }
    
    ?>
    <div class="wrap" style=''>
      <h2><?php echo TXT_WPSC_DISPLAYPURCHASES;?></h2><br />
      <table style='width: 100%;'>
       <tr>
        <td id='product_log_data'>
       <?php
      if(($purchase_log == null) && !is_numeric($_GET['purchaseid'])) {
        if($earliest_record[0]['date'] != null) {
          $form_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;collect_data_forms</code> WHERE <code>active</code> = '1' AND <code>display_log</code> = '1';";
          $form_data = $wpdb->get_results($form_sql,ARRAY_A);
    
          $col_count = 5 + count($form_data);
    
          $i = 0;
          echo "<table class='logdisplay'>";
    
          //exit("<pre>".print_r($date_list,true)."</pre>");
          foreach($date_list as $date_pair){
            if(($date_pair['end'] >= $earliest_timestamp) && ($date_pair['start'] <= $current_timestamp)) {
              $sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>date</code> BETWEEN '".$date_pair['start']."' AND '".$date_pair['end']."' ORDER BY <code>date</code> DESC";
    					if ($paidlog==paid) {
    						$sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>date</code> BETWEEN '".$date_pair['start']."' AND '".$date_pair['end']."' AND <code>processed</code> >= '2' ORDER BY <code>date</code> DESC";
    					}	else if ($paidlog==unpaid) {
    						$sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>date</code> BETWEEN '".$date_pair['start']."' AND '".$date_pair['end']."' AND <code>processed</code> = '1' ORDER BY <code>date</code> DESC";
    					}	else if($_GET['filteremail']) {
    						$sql = "SELECT DISTINCT <code>{$wpdb->prefix}purchase_logs</code> . * FROM <code>{$wpdb->prefix}submited_form_data</code> LEFT JOIN <code>{$wpdb->prefix}purchase_logs</code> ON <code>{$wpdb->prefix}submited_form_data</code>.<code>log_id</code> = <code>{$wpdb->prefix}purchase_logs</code>.<code>id</code> WHERE <code>{$wpdb->prefix}submited_form_data</code>.<code>value</code> IN ( '".$wpdb->escape($_GET['filteremail'])."' ) AND <code>{$wpdb->prefix}purchase_logs</code>.<code>date</code> BETWEEN '".$date_pair['start']."' AND '".$date_pair['end']."' ORDER BY <code>{$wpdb->prefix}purchase_logs</code>.<code>date</code> DESC;";
    					}
    
              $purchase_log = $wpdb->get_results($sql,ARRAY_A) ;
              $i = 0;
              $subtotal = 0;
              echo "<tr>";
              echo " <td colspan='$col_count'>";
              echo "<h3 class='log_headers'>".date("M Y", $date_pair['start']) ."</h3>";
              echo " </td>";
              echo "</tr>";
              if($purchase_log != null)
                {
                echo "<tr class='toprow'>";
    
                 echo " <td>";
                 echo TXT_WPSC_PURCHASE_NUMBER;
                 echo " </td>";
    
                echo " <td style='text-align: left;'>";
                echo TXT_WPSC_STATUS;
                echo " </td>";
    
                echo " <td>";
                echo TXT_WPSC_DATE;
                echo " </td>";
    
                foreach($form_data as $form_field)
                  {
                  echo " <td>";
                  echo $form_field['name'];
                  echo " </td>";
                  }
    
                echo " <td>";
                echo TXT_WPSC_PRICE;
                echo " </td>";  
    
                if(get_option('payment_method') == 2)
                  {
                  echo " <td>";
                  echo TXT_WPSC_PAYMENT_METHOD;
                  echo " </td>";
                  }
    
                echo " <td>";
                echo TXT_WPSC_VIEWDETAILS;
                echo " </td>";
    
    						//echo "<td width='1%'>";
    						//echo TXT_WPSC_STORENAME;
    						//echo "<td>";
    
                echo "</tr>";
    
                foreach($purchase_log as $purchase)
                  {
                  $status_state = "expand";
                  $status_style = "";
                  $alternate = "";
                    $i++;
                    if(($i % 2) != 0)
                      {
                      $alternate = "class='alt'";
                      }
                  echo "<tr $alternate>\n\r";
                   echo " <td>";
                   echo $purchase['id'];
                   echo " </td>";
    
                  echo " <td class='processed'>";
                  if($purchase['processed'] < 1)
                    {
                    $purchase['processed'] = 1;
                    }
                  $stage_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_statuses</code> WHERE <code>id</code>='".$purchase['processed']."' AND <code>active</code>='1' LIMIT 1";
                  $stage_data = $wpdb->get_row($stage_sql,ARRAY_A);
    
                  echo "<a href='#' onclick='return show_status_box(\"status_box_".$purchase['id']."\",\"log_expander_icon_".$purchase['id']."\");'>";
                  if($_GET['id'] == $purchase['id'])
                    {
                    $status_state = "collapse";
                    $status_style = "style='display: block;'";
                    }
                  echo "<img class='log_expander_icon' id='log_expander_icon_".$purchase['id']."' src='".WPSC_URL."/images/icon_window_$status_state.gif' alt='' title='' />";
                  if($stage_data['colour'] != '')
                    {
                    $colour = "style='color: #".$stage_data['colour'].";'";
                    }
                  echo "<span $colour  id='form_group_".$purchase['id']."_text'>".$stage_data['name']."</span>";
                  echo "</a>";
                  echo " </td>\n\r";
    
                  echo " <td>";
                  echo date("jS M Y",$purchase['date']);
                  echo " </td>\n\r";
    
                  foreach($form_data as $form_field) {
                    $collected_data_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;submited_form_data</code> WHERE <code>log_id</code> = '".$purchase['id']."' AND <code>form_id</code> = '".$form_field['id']."' LIMIT 1";
                    $collected_data = $wpdb->get_results($collected_data_sql,ARRAY_A);
                    $collected_data = $collected_data[0];
                    switch($form_field['type']) {
                      case 'country':
                      echo " <td>";
                      echo get_country($purchase['billing_country']);
                      echo " </td>\n\r";
                      break;
    
                      case 'delivery_country':
                      echo " <td>";
                      echo get_country($purchase['shipping_country']);
                      echo " </td>\n\r";
                      break;
    
                      default:
                      echo " <td>";
                      echo $collected_data['value'];
                      echo " </td>\n\r";
                      break;
    								}
    							}
    
                  echo " <td>";
    
                  if($purchase['shipping_country'] != '') {
                    $billing_country = $purchase['billing_country'];
                    $shipping_country = $purchase['shipping_country'];
    							} else {
    								$country_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;submited_form_data</code> WHERE <code>log_id</code> = '".$purchase['id']."' AND <code>form_id</code> = '".get_option('country_form_field')."' LIMIT 1";
    								$country_data = $wpdb->get_results($country_sql,ARRAY_A);
    								$billing_country = $country_data[0]['value'];
    								$shipping_country = $country_data[0]['value'];
    							}
                  //echo $country;
                  echo nzshpcrt_currency_display(nzshpcrt_find_total_price($purchase['id'],$shipping_country),1);
                  $subtotal += nzshpcrt_find_total_price($purchase['id'],$shipping_country);
                  echo " </td>\n\r";
    
                  if(get_option('payment_method') == 2) {
                    echo " <td>";
                    $gateway_name = '';
                    foreach($GLOBALS['nzshpcrt_gateways'] as $gateway) {
                      if($purchase['gateway'] != 'testmode') {
                        if($gateway['internalname'] == $purchase['gateway'] ) {
                          $gateway_name = $gateway['name'];
    										}
    									} else {
    										$gateway_name = "Manual Payment";
    									}
    								}
                    echo $gateway_name;
                    echo " </td>\n\r";
    							}
                  echo " <td>";
                  echo "<a href='admin.php?page=".WPSC_DIR_NAME."/display-log.php&amp;purchaseid=".$purchase['id']."'>".TXT_WPSC_VIEWDETAILS."</a>";
                  echo " </td>\n\r";
    
    							//echo " <td>";
    							//echo $purchase['closest_store'];
    							//echo " </td>\n\r";
    
                  echo "</tr>\n\r";
    
                  $stage_list_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_statuses</code> ORDER BY <code>id</code> ASC";
                  $stage_list_data = $wpdb->get_results($stage_list_sql,ARRAY_A);
    
                  echo "<tr>\n\r";
                  echo " <td colspan='$col_count'>\n\r";
                  echo "  <div id='status_box_".$purchase['id']."' class='order_status' $status_style>\n\r";
                  echo "  <div>\n\r";
                  echo "  <strong class='form_group'>".TXT_WPSC_ORDER_STATUS."</strong>\n\r";
                  echo "  <form onsubmit='log_submitform(this);return false;' id='form_group_".$purchase['id']."' method='GET' action='admin.php?page=".WPSC_DIR_NAME."/display-log.php'>\n\r";
                  echo "  <input type='hidden' name='page' value='".$_GET['page']."' />\n\r";
                  if(isset($_GET['filter']))
                    {
                    echo "  <input type='hidden' name='filter' value='".$_GET['filter']."' />\n\r";
                    }
                  echo "  <input type='hidden' name='id' value='".$purchase['id']."' />\n\r";
                  //echo "  <input type='hidden' name='id' value='".$purchase['id']."' />\n\r";
                  echo "  <ul>\n\r";
                  foreach($stage_list_data as $stage)
                    {
                    $selected = '';
                    if($stage['id'] == $purchase['processed'])
                      {
                      $selected = "checked='true'";
                      }
                    $button_id = "button_".$purchase['id']."_".$stage['id'];
                    echo "    <li><input type='radio' name='value' $selected value='".$stage['id']."' onclick='log_submitform(\"form_group_".$purchase['id']."\");' id='".$button_id."'/><label for='$button_id'>".$stage['name']."</label>\n\r";
    		}
    
                  echo "  </ul>\n\r";
                  //echo "  <input type='submit' name='log_state_submit' value='Save... &raquo;' class='button' /> \n\r";
                  echo "  </form>\n\r";
    							echo "<li style='display:none;' id='track_id'>Tracking ID: <form method='GET'><input type='text' size='20' id='tracking_id_".$purchase['id']."' name='track_id' value=".$purchase['track_id']."><input type = 'button' value='Submit' onclick='save_tracking_id(".$purchase['id'].");'></form></li>";
                  if($purchase['transactid'] != '')
                    {
                    echo "  <span style='float:right; margin-right: 15px; '>".TXT_WPSC_TXN_ID.": ".$purchase['transactid']."</span>";
                    }
                  echo "<a href='admin.php?page=".WPSC_DIR_NAME."/display-log.php&amp;deleteid=".$purchase['id']."'>".TXT_WPSC_REMOVE_LOG."</a>";
                  echo "  </div>\n\r";
                  echo "  </div>\n\r";
                  echo " </td>\n\r";
                  echo "</tr>\n\r";
                  }
    
                echo "<tr>";
                echo " <td colspan='$col_count'>";
                echo "<strong>Total:</strong> ".nzshpcrt_currency_display($subtotal ,1);
                echo "<br /><a class='admin_download' href='index.php?purchase_log_csv=true&rss_key=key&start_timestamp=".$date_pair['start']."&end_timestamp=".$date_pair['end']."' ><img align='absmiddle' src='".WPSC_URL."/images/download.gif' alt='' title='' /><span>".TXT_WPSC_DOWNLOAD_CSV."</span></a>";
                echo " </td>";
                echo "</tr>";
                }
                else
                  {
                  echo "<tr>";
                  echo " <td colspan='$col_count'>";
                  echo "No transactions for this month.";
                  echo " </td>";
                  echo "</tr>";
                  }
              }
            }
          echo " </table>";
    		} else {
    			echo " <table>";
    			echo "<tr>";
    			echo " <td>";
    			echo TXT_WPSC_NO_PURCHASES;
    			echo " </td>";
    			echo "</tr>";
    			echo " </table>";
    		}
    	} else if(is_numeric($_GET['purchaseid'])) {
    
    		$purch_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>id</code>='".$_GET['purchaseid']."'";
    		$purch_data = $wpdb->get_results($purch_sql,ARRAY_A) ;
    
    		$cartsql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;cart_contents</code> WHERE <code>purchaseid</code>=".$_GET['purchaseid']."";
    		$cart_log = $wpdb->get_results($cartsql,ARRAY_A) ;
    		$j = 0;
    		if($cart_log != null) {
    			echo "<table class='logdisplay'>";
    			echo "<tr class='toprow2'>";
    
    			echo " <td>";
    			echo TXT_WPSC_NAME;
    			echo " </td>";
    
    			echo " <td>";
    			echo TXT_WPSC_QUANTITY;
    			echo " </td>";
    
    			echo " <td>";
    			echo TXT_WPSC_PRICE;
    			echo " </td>";
    
    			echo " <td>";
    			echo TXT_WPSC_TAX;
    			echo " </td>";
    
    			echo " <td>";
    			echo TXT_WPSC_SHIPPING;
    			echo " </td>";       
    
    			echo " <td>";
    			echo TXT_WPSC_TOTAL;
    			echo " </td>";
    
    			echo "</tr>";
    			$endtotal = 0;
    			$all_donations = true;
    			$all_no_shipping = true;
    			foreach($cart_log as $cart_row)
    				{
    				$alternate = "";
    				$j++;
    				if(($j % 2) != 0)
    					{
    					$alternate = "class='alt'";
    					}
    				$productsql= "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;product_list</code> WHERE <code>id</code>=".$cart_row['prodid']."";
    				$product_data = $wpdb->get_results($productsql,ARRAY_A); 
    
    				$variation_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;cart_item_variations</code> WHERE <code>cart_id</code>='".$cart_row['id']."'";
    				$variation_data = $wpdb->get_results($variation_sql,ARRAY_A);
    				$variation_count = count($variation_data);
    				if($variation_count > 1)
    					{
    					$variation_list = " (";
    					$i = 0;
    					foreach($variation_data as $variation)
    						{
    						if($i > 0)
    							{
    							$variation_list .= ", ";
    							}
    						$value_id = $variation['value_id'];
    						$value_data = $wpdb->get_results("SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;variation_values</code> WHERE <code>id</code>='".$value_id."' LIMIT 1",ARRAY_A);
    						$variation_list .= $value_data[0]['name'];
    						$i++;
    						}
    					$variation_list .= ")";
    					}
    					else if($variation_count == 1)
    						{
    						$value_id = $variation_data[0]['value_id'];
    						$value_data = $wpdb->get_results("SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;variation_values</code> WHERE <code>id</code>='".$value_id."' LIMIT 1",ARRAY_A);
    						$variation_list = " (".$value_data[0]['name'].")";
    						}
    						else
    							{
    							$variation_list = '';
    							}
    
    				if($purch_data[0]['shipping_country'] != '') {
    					$billing_country = $purch_data[0]['billing_country'];
    					$shipping_country = $purch_data[0]['shipping_country'];
    				} else {
    					$country_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;submited_form_data</code> WHERE <code>log_id</code> = '".$_GET['purchaseid']."' AND <code>form_id</code> = '".get_option('country_form_field')."' LIMIT 1";
    					$country_data = $wpdb->get_results($country_sql,ARRAY_A);
    					$billing_country = $country_data[0]['value'];
    					$shipping_country = $country_data[0]['value'];
    				}
    
    				if($cart_row['donation'] != 1) {
    					$all_donations = false;
    				}
    				if($cart_row['no_shipping'] != 1) {
    					$shipping = $cart_row['pnp'] * $cart_row['quantity'];
    					$total_shipping += $shipping;
    					$all_no_shipping = false;
    				} else {
    					$shipping = 0;
    				}
    				echo "<tr $alternate>";
    
    				echo " <td>";
    				echo $product_data[0]['name'];
    				echo $variation_list;
    				echo " </td>";
    
    				echo " <td>";
    				echo $cart_row['quantity'];
    				echo " </td>";
    
    				echo " <td>";
    
    				$price = $cart_row['price'] * $cart_row['quantity'];
    				$gst = $price - ($price  / (1+($cart_row['gst'] / 100)));
    				echo nzshpcrt_currency_display($price-$gst, 1);
    				echo " </td>";
    
    				echo " <td>";
    
    				echo nzshpcrt_currency_display($gst, 1);
    				echo " </td>";
    
    				echo " <td>";
    				echo nzshpcrt_currency_display($cart_row['pnp'], 1);
    				echo " </td>";
    
    				echo " <td>";
    				$endtotal += $price;
    				echo nzshpcrt_currency_display(($shipping + $price), 1);
    				echo " </td>";
    
    				echo '</tr>';
    				}
    				echo "<tr >";
    
    				echo " <td colspan='4'>";
    				echo " </td>";
    
    				echo " <td>";
    
    				if($purch_data[0]['discount_value'] > 0) {
    					echo "<strong>".TXT_WPSC_DISCOUNT.":</strong><br />";
    				}
    
    				if(($all_donations == false) && ($all_no_shipping == false)) {
    
    					echo "<strong>".TXT_WPSC_BASESHIPPING.":</strong><br />";
    					echo "<strong>".TXT_WPSC_TOTALSHIPPING.":</strong><br />";
    				}
    				echo "<strong>".TXT_WPSC_FINALTOTAL.":</strong>";
    				echo " </td>";
    
    				echo " <td>";
    				if($purch_data[0]['discount_value'] > 0) {
    					echo nzshpcrt_currency_display($purch_data[0]['discount_value'], 1)."<br />";
    				}
    
    				if(($all_donations == false) && ($all_no_shipping == false)) {
    					echo nzshpcrt_currency_display($purch_data[0]['base_shipping'],1)."<br />";
    					$total_shipping += $purch_data[0]['base_shipping'];
    					$endtotal += $total_shipping;
    					echo nzshpcrt_currency_display($total_shipping, 1) . "<br />";
    				}
    				$endtotal -= $purch_data[0]['discount_value'];
    				echo nzshpcrt_currency_display($endtotal,1);
    				echo " </td>";
    
    				echo '</tr>';
    
    			echo "</table>";
    			echo "<br />";
    
    			echo "<strong>".TXT_WPSC_CUSTOMERDETAILS."</strong>";
    			echo "<table>";
    			$form_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;submited_form_data</code> WHERE  <code>log_id</code> = '".$_GET['purchaseid']."'";
    			$input_data = $wpdb->get_results($form_sql,ARRAY_A);
    			//exit("<pre>".print_r($input_data,true)."</pre>");
    			if($input_data != null) {
    				foreach($input_data as $form_field) {
    					$form_sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;collect_data_forms</code> WHERE <code>active</code> = '1' AND <code>id</code> = '".$form_field['form_id']."' LIMIT 1";
    					$form_data = $wpdb->get_results($form_sql,ARRAY_A);
    					if($form_data != null) {
    						$form_data = $form_data[0];
    						switch($form_data['type']) {
    							case 'country':
    							if(is_numeric($purch_data[0]['shipping_region'])) {
    								echo "  <tr><td>".TXT_WPSC_STATE.":</td><td>".get_region($purch_data[0]['shipping_region'])."</td></tr>";
    							}
    							echo "  <tr><td>".$form_data['name'].":</td><td>".get_country($purch_data[0]['billing_country'])."</td></tr>";
    							break;           
    
    							case 'delivery_country':
    							echo "  <tr><td>".$form_data['name'].":</td><td>".get_country($purch_data[0]['shipping_country'])."</td></tr>";
    							break;                
    
    							default:
    							echo "  <tr><td>".$form_data['name'].":</td><td>".$form_field['value']."</td></tr>";
    							break;
    						}
    					}
    				}
    			} else {
    					echo "  <tr><td>".TXT_WPSC_NAME.":</td><td>".$purch_data[0]['firstname']." ".$purch_data[0]['lastname']."</td></tr>";
    					echo "  <tr><td>".TXT_WPSC_ADDRESS.":</td><td>".$purch_data[0]['address']."</td></tr>";
    					echo "  <tr><td>".TXT_WPSC_PHONE.":</td><td>".$purch_data[0]['phone']."</td></tr>";
    					echo "  <tr><td>".TXT_WPSC_EMAIL.":</td><td>".$purch_data[0]['email']."</td></tr>";
    			}
    
    			if(get_option('payment_method') == 2) {
    				$gateway_name = '';
    				foreach($GLOBALS['nzshpcrt_gateways'] as $gateway) {
    					if($purch_data[0]['gateway'] != 'testmode') {
    						if($gateway['internalname'] == $purch_data[0]['gateway'] ) {
    							$gateway_name = $gateway['name'];
    						}
    					} else {
    						$gateway_name = "Manual Payment";
    					}
    				}
    			}
    			echo "  <tr><td>".TXT_WPSC_PAYMENT_METHOD.":</td><td>".$gateway_name."</td></tr>";
    			echo "  <tr><td>".TXT_WPSC_PURCHASE_NUMBER.":</td><td>".$purch_data[0]['id']."</td></tr>";
    			echo "  <tr><td>".TXT_WPSC_HOWCUSTOMERFINDUS.":</td><td>".$purch_data[0]['find_us']."</td></tr>";
    			$engrave_line = explode(",",$purch_data[0]['engravetext']);
    			echo "  <tr><td>".TXT_WPSC_ENGRAVE."</td><td></td></tr>";
    			echo "  <tr><td>Line1:</td><td>".$engrave_line[0]."</td></tr>";
    			echo "  <tr><td>Line2:</td><td>".$engrave_line[1]."</td></tr>";
    			if($purch_data[0]['transactid'] != '') {
    				echo "  <tr><td>".TXT_WPSC_TXN_ID.":</td><td>".$purch_data[0]['transactid']."</td></tr>";
    			}
    			echo "</table>";
    		} else {
    			echo "<br />".TXT_WPSC_USERSCARTWASEMPTY;
    		}
    		echo "<br /><a href='admin.php?page=".WPSC_DIR_NAME."/display-log.php&amp;purchaseid=".$_GET['purchaseid']."&amp;clear_locks=true'>".TXT_WPSC_CLEAR_IP_LOCKS."</a><br />";
    		echo "<br /><a href='admin.php?page=".WPSC_DIR_NAME."/display-log.php&amp;deleteid=".$_GET['purchaseid']."'>".TXT_WPSC_REMOVE_LOG."</a>";
    		echo "<br /><a href='admin.php?page=".WPSC_DIR_NAME."/display-log.php'>".TXT_WPSC_GOBACK."</a>";
    	}
    
    $sql = "SELECT * FROM <code>&quot;.$wpdb->prefix.&quot;purchase_logs</code> WHERE <code>date</code>!=''";
    $purchase_log = $wpdb->get_results($sql,ARRAY_A) ;
      ?>
       </td>
    
        <td id='order_summary_container'>
        <?php
    		require_once (ABSPATH . WPINC . '/rss.php');
    		$rss = fetch_rss('http://www.instinct.co.nz/feed/');
    		if($rss != null) {
    			$rss->items = array_slice((array)$rss->items, 0, 5);
    			$current_hash = sha1(serialize($rss->items));
    			if((string)get_option('wpsc_ecom_news_hash') !== (string)$current_hash ) {
    				?>
    				<div class='wpsc_news'>
    					<strong><?php echo TXT_WPSC_ECOM_NEWS; ?></strong>
    					<ul class='ecom_dashboard'>
    					<?php
    					foreach($rss->items as $items) {
    						echo "<li><a href='".$items['link']."'>".$items['title']."</a></li>";
    					}
    					?>
    					</ul>
    					<a href='admin.php?page=<?php echo WPSC_DIR_NAME;?>/display-log.php&hide_news=true' id='close_news_box'>X</a>
    				</div>
    				<?php
    			}
        }
        ?>
    	<div class='menu'>
    		<div class='order_summary_subsection'>
    			<strong><?php echo TXT_WPSC_MENU; ?></strong>
    			<p>
    			<a href="?page=<?php echo WPSC_DIR_NAME;?>/options.php">Shop Settings</a><br />
    			<a href="?page=<?php echo WPSC_DIR_NAME;?>/gatewayoptions.php">Gateway Settings</a><br />
    			<a href="?page=<?php echo WPSC_DIR_NAME;?>/form_fields.php">Checkout Settings</a><br />
    			<a href="?page=<?php echo WPSC_DIR_NAME;?>/instructions.php">Help</a>
    			</p>
    		</div>
    	</div>
    	<br />
        <strong class='order_summary'><?php echo TXT_WPSC_ORDER_SUMMARY; ?></strong>
        <div class='order_summary'>
          <div class='order_summary_subsection'>
    
          <strong><?php echo TXT_WPSC_FILTER_ORDER; ?></strong>
          <p class='order_filters'>
          <form class='order_filters' method='GET' action='' name='order_filters'>
          <input type='hidden' name='page' value='<?php echo $_GET['page']?>' />
          <?php
    
          switch($_GET['filter'])
            {
            case "true":
            $filter[1] = "checked='true'";
            break;
    
            case 3:
            default:
            $filter[0] = "checked='true'";
            break;
    
            case 1:
            default:
            $filter[2] = "checked='true'";
            break;
            }
    
          ?>
          <input class='order_filters' onclick='document.order_filters.submit();' type='radio' <?php echo $filter[0];?> name='filter' value='1' id='order_filter_1' /> <label class='order_filters' for='order_filter_1'><?php echo TXT_WPSC_LOG_CURRENT_MONTH; ?></label>
          <br />
          <input class='order_filters' onclick='document.order_filters.submit();' type='radio' <?php echo $filter[0];?> name='filter' value='3' id='order_filter_3' /> <label class='order_filters' for='order_filter_3'><?php echo TXT_WPSC_LOG_PAST_THREE_MONTHS; ?></label>
          <br />
    			<input class='order_filters' onclick='document.order_filters.submit();'  type='radio' <?php echo $filter[1];?> name='filter' value='paid' id='order_filter_paid' /> <label class='order_filters' for='order_filter_paid'><?php echo TXT_WPSC_LOG_TRANSACTIONACCEPTEDLOGS; ?></label>
          <br />
    			<input class='order_filters' onclick='document.order_filters.submit();'  type='radio' <?php echo $filter[1];?> name='filter' value='unpaid' id='order_filter_unpaid' /> <label class='order_filters' for='order_filter_unpaid'><?php echo TXT_WPSC_LOG_TRANSACTIONUNACCEPTEDLOGS; ?></label>
          <br />
          <input class='order_filters' onclick='document.order_filters.submit();'  type='radio' <?php echo $filter[1];?> name='filter' value='true' id='order_filter_none' /> <label class='order_filters' for='order_filter_none'><?php echo TXT_WPSC_LOG_ALL; ?></label>
          <br />
          <?=TXT_WPSC_SEARCHEMAIL?>: <input type='text' name='filteremail' >
          </form>
          <br />
          </p>
    
          <strong><?php echo TXT_WPSC_TOTAL_THIS_MONTH; ?></strong>
          <p id='log_total_month'>
          <?php
          $year = date("Y");
          $month = date("m");
          $start_timestamp = mktime(0, 0, 0, $month, 1, $year);
          $end_timestamp = mktime(0, 0, 0, ($month+1), 0, $year);
          echo nzshpcrt_currency_display(admin_display_total_price($start_timestamp, $end_timestamp),1);
          echo " ".TXT_WPSC_ACCEPTED_PAYMENTS;
          ?>
          </p>
          </div>
    
          <div class='order_summary_subsection'>
          <strong><?php echo TXT_WPSC_TOTAL_INCOME; ?></strong>
          <p id='log_total_absolute'>
          <?php
           //$total_income = $wpdb->get_results($sql,ARRAY_A);
           echo nzshpcrt_currency_display(admin_display_total_price(),1);
           ?>
          </p>
          </div>
    
          <div class='order_summary_subsection'>
          <strong><?php echo TXT_WPSC_RSS_FEED_HEADER; ?></strong>
          <p>
            <a class='product_log_rss' href='index.php?rss=true&amp;rss_key=key&amp;action=purchase_log'><img align='absmiddle' src='<?php echo WPSC_URL; ?>/images/rss-icon.jpg' alt='' title='' />&nbsp;<span><?php echo TXT_WPSC_RSS_FEED_LINK; ?></span></a> <?php echo TXT_WPSC_RSS_FEED_TEXT; ?>      </p>
          </div>
             <div class='order_summary_subsection'>
          <strong><?php echo TXT_WPSC_PLUGIN_NEWS_HEADER; ?></strong>
          <p>
          <?php echo TXT_WPSC_PLUGIN_NEWS; ?>
            <br /><br /><?php echo TXT_WPSC_POWERED_BY; ?><a href='http://www.instinct.co.nz'>Instinct</a>
          </p>
          </div>
        </div>
        <?php
        if(get_option('activation_state') != "true")
          {
          ?>
          <div class='gold-cart_pesterer'>
            <div>
            <img src='<?php echo WPSC_URL; ?>/images/gold-cart.png' alt='' title='' /><a href='http://www.instinct.co.nz/blogshop/'>Upgrade to Gold</a> and unleash more functionality into your shop.
            </div>
          </div>
          <?php
          }
        ?>
        </td>
      </tr>
     </table>
    
    </div>
  10. justmoi
    Member
    Posted 5 years ago #

    Thank you for writing this plugin, it is extremely useful!

    Is there any way to set each variation set with a specific price? For example,

    Option A
    - 1 = 5$
    - 2 = 10$
    - 3 = 15$

    Option B
    - 1 = 20$
    - 2 = 30$
    - 3 = 40$

    ... and leave it every time? Or do I need to set the price on the variations for every product? For my purposes, each variation set has a specific value added, and if ever the price changes on all the set, it is extremely time-consuming to have to go in each "edit product" in order to change it.

    I guess to clarify, I would like to know if there is a method to putting a specific price for the variation set permanently (or until the price changes) so that when I pick that variation, it knows the price automatically. I would rather create a few different set of variations than need to write the price on each sub-category every time.

    Is there anyone that can help me? I would appreciate it very much!

Topic Closed

This topic has been closed to new replies.

About this Topic