Forums / Templates, Stylesheets, Page Layout / Add manufacturer to the product listing in admin

Add manufacturer to the product listing in admin

Locked

Views: 2,115

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
6 Aug 2007, 12:49 AM
#1
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Add manufacturer to the product listing in admin

It would save me a lot of time if the list of products in the admin listing showed manufacturer. It currently has ID, name, model, price/special/sale, quantity, status, sort, and the buttons. I don't really need to see "model" or quantity in this list. Is there a way to customize it?

6 Aug 2007, 1:18 AM
#2
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

I think I'm on the right track. I added p.manufacturers_id to the queries in admin/includes/modules/category_product_listing.php. I have it displaying the manufacturer's id in the list. But I'm not sure how to get the manufacturer's name from the manufacturers table?

6 Aug 2007, 1:44 AM
#3
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

I figured out how to get the name from manufacturers by looking at how it was pulled from products_descriptions and products_to_categories. Then I just replaced the "quantity" column with the manufacturer's name and adjusted the heading accordingly. :D

6 Aug 2007, 5:14 PM
#4
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

Well it's not quite right yet. It's not showing any products without a manufacturer set. Is it a problem with the query? Can anyone help me fix this?

      $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
                                       p.products_image, p.products_price, p.products_date_added,
                                       p.products_last_modified, p.products_date_available,
                                       p.products_status, p2c.categories_id, 
                                       p.products_model, p.manufacturers_id, m.manufacturers_name,
                                       p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                       p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
                                       p.products_quantity_order_max, p.products_sort_order,
                                       p.master_categories_id
                                from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " 
                                       . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
                                where p.products_id = pd.products_id
                                and p.manufacturers_id = m.manufacturers_id 
                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                and (p.products_id = p2c.products_id
                                and p.master_categories_id = p2c.categories_id)
                                and (
                                pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
                                or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
                                or p.products_model like '%" . zen_db_input($_GET['search']) . "%')" .
                                $order_by);
6 Aug 2007, 6:49 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Add manufacturer to the product listing in admin

LEFT JOIN is your friend ...

You want the data when available but not the block when there is not a match ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Aug 2007, 7:05 PM
#6
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

I tried inserting a LEFT JOIN on manufacturers and it gave me an error. I'm afraid I'm just not familiar enough with writing queries. There are so many criteria in this query I don't know how to modify it. :(

This is what I tried, that resulted in SQL syntax error:

      $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
                                       p.products_image, p.products_price, p.products_date_added,
                                       p.products_last_modified, p.products_date_available,
                                       p.products_status, p2c.categories_id, 
                                       p.products_model, p.manufacturers_id, m.manufacturers_id, m.manufacturers_name,
                                       p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                       p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                       p.product_is_always_free_shipping,
                                       p.products_quantity_order_max, p.products_sort_order,
                                       p.master_categories_id
                                from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, LEFT JOIN " .                  
                                TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id)  " .
                                TABLE_PRODUCTS_TO_CATEGORIES . " p2c
                                where p.products_id = pd.products_id 
                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                and (p.products_id = p2c.products_id
                                and p.master_categories_id = p2c.categories_id)
                                and (
                                pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
                                or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
                                or p.products_model like '%" . zen_db_input($_GET['search']) . "%')" .
                                $order_by);
```Thank you so much for your help!!!!
6 Aug 2007, 7:48 PM
#7
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

For now i went back to the original query and only added p.manufacturers_id. I've got it displaying the ID number from the products table and "none' if it's zero. It's better than nothing.

Is there a function to return the manufacturer's name from the manufacturer's ID? I tried zen_get_products_manufacturers_name and got an 'undefined function' error.

6 Aug 2007, 9:04 PM
#8
lismith avatar

lismith

New Zenner

Join Date:
May 2007
Posts:
78
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

i got zen_get_products_manufacturers_name to work by copying the function from functions_lookups.php and pasting into a new file in /admin/includes/functions/extra-functions/. I guess catalog & admin don't share the same functions? I don't know how efficient it is to do it this way but with my limited knowledge it was the only thing I could figure out. :P There won't be any problems caused by these changes will there?

16 Nov 2008, 12:34 PM
#9
cattom avatar

cattom

New Zenner

Join Date:
Apr 2008
Location:
London
Posts:
27
Plugin Contributions:
0

Re: Add manufacturer to the product listing in admin

lismith:

i got zen_get_products_manufacturers_name to work by copying the function from functions_lookups.php and pasting into a new file in /admin/includes/functions/extra-functions/. I guess catalog & admin don't share the same functions? I don't know how efficient it is to do it this way but with my limited knowledge it was the only thing I could figure out. :P There won't be any problems caused by these changes will there?

Hi lismith

I tried your method but do something wrong as I am copy/paste programmer :smile: . May be can you write more detailed instruction how to add manufacturers to admin's category_product_listing

Thank you.