Apr 07 2009

ZEN CART: adding product weight to admin product listing

Classified in: Zencartpaomic at 9:37 am

Hi all! I’ve been away for a while, working on Zen Cart! Now I’m back and I want to share with you some tips and tricks on this software! First of all, Zen Cart is a great open source E-commerce software, written in PHP. This is very good and under development, there are many mods and a support forum full of people willing to help, I strongly suggest you to give it a try! One of its problems is that it is a bit hard to find a way to patch it or modify the appearance or functionality of the software. For example, for ease of use, I wanted to show in the admin product and category listings the weight of the product, to check if I entered it correctly without having to open all the products edit page. There isn’t an option to do this in zen cart, so I had to patch the file category_product_listing.php in admin\includes\modules.

First, around line 77, before: <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CATEGORIES_SORT_ORDER; ?></td>, add this:

<td class="dataTableHeadingContent" align="right">Width</td>

Note that you could replace Width with whatever you want in the column heading, maybe also a constant specified in some file.

At line 171, before this line: <td class="dataTableContent" align="right"><?php echo $categories->fields['sort_order']; ?></td>, add this line

<td class="dataTableContent" align="right">-</td>

 

At line 249 and 269 add at the end of the SQL list of fields to extract

, p.products_weight

(pay attention to the starting comma!). Then at line 347, before this line: <td class="dataTableContent" align="right"><?php echo $products->fields['products_sort_order']; ?></td>, add this line

<td class="dataTableContent" align="right"><?php echo $products->fields['products_weight']; ?></td>

There is no need to say that before appliyng this you should backup everything and that I don’t assume any liability for the use of this patch! Let me know if it works!

Tags: