CartMetrix - Do you know yours?

11/29/2006

ZenCart Orders Total Weight Query

SELECT op.products_quantity * SUM( products_weight )
FROM products p
JOIN orders_products op
WHERE p.products_id
IN (
SELECT products_id
FROM orders_products
WHERE orders_id = 'ORDER_ID'
)
AND op.orders_id = 'ORDER_ID'

Replace ORDER_ID with the orders_id in question.

Requires MySQL 4.1 or better for subselect support

Related Link: Bowflex

Popularity: 15%

ZenCart Inventory Report

Here’s a simple admin report for ZenCart that will generate an inventory report with per product totals and a report total. The report may be paginated or generated over the whole catalog.

The report was created by modifying the ZenCart default Products Viewed report. It was created from the ZenCart v1.2x source but has been installed on v1.3x versions. This is the first release, so any problems please comment below.

In future updates, I would like to allow for CSV export as well as reporting by category.

To install, simply unzip and upload to your main ZenCart install directory.

ZenCart Inventory Report

View all releaseas

Popularity: 33%

11/14/2006

Virtual IPs Under OSX

To add a virtual loopback address:

sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.0.0

Popularity: 23%

11/13/2006

iTerm and Growl

Recent versions of iTerm support Growl notifications. iTerm shows how to initiate Growl events from the command line with:

make; echo $'\e]9;make done\007'

The example shows how to get an alert after a long make. I know I would never remember that command so I wrote a little Bash user defined function to do the same. Add this to your .bashrc file:

growl() { echo -e $'\e]9;'${1}'\007' ; return  ; }

Now the command to initiate a notification would be:

make; growl "make done"

Popularity: 73%

11/9/2006

Chkrootkit Grep

chkrootkit bindshell | grep "INFECTED\|Vulnerable"

Popularity: 14%

ZenCart Reports Search Function

The ZenCart default reports are sufficient for most uses, but with many products pages of results are a pain to look through. Adding a search is pretty simple. The example below adds a search to the products purchased report:

Add the search box and form:
admin/stats_products_purchased.php Line ~#64

BEFORE:

</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

AFTER:

</table></td>
</tr>
<tr>
<form action="stats_products_purchased.php" method="get">
<td align="right">
<b>Search</b>
<input type="text" name="search" value="<?php echo $_GET['search']; ?>"/>
<input type="submit" value="Go" />
</td>
</form>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

Add the processing to the query:
admin/stats_products_purchased.php Line ~#84

BEFORE:

if (isset($_GET['page']) && ($_GET['page'] > 1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS;

// The following OLD query only considers the "products_ordered" value from the products table.
// Thus this older query is somewhat deprecated
  $products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' and p.products_ordered > 0 group by pd.products_id order by p.products_ordered DESC, pd.products_name";

AFTER:

if (isset($_GET['page']) && ($_GET['page'] > 1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS;
 
//11/03/06 21:40  damonp add search
   if($_GET['search'] != '')  {
      $db_search = "AND (pd.products_id = '".$_GET['search']."' OR pd.products_name LIKE '%".$_GET['search']."%')";
   }
// The following OLD query only considers the "products_ordered" value from the products table.
// Thus this older query is somewhat deprecated
  $products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' and p.products_ordered > 0 $db_search group by pd.products_id order by p.products_ordered DESC, pd.products_name";

This simple mod will search the products_id and products_name fields. Adding a search to the other reports is similar. One only needs to adjust the query to match the applicable fields for the report.

Popularity: 19%

Next Page »


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2008 damonparker.org. all rights reserved.

Close
E-mail It