Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Pulling info from a new table?

Pulling info from a new table?

Locked

Views: 1,486

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
25 Jun 2007, 8:20 PM
#1
lismith avatar

lismith

New Zenner

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

Pulling info from a new table?

My products need a listing of manufacturer and OEM numbers on the product page. A product may have none or may have 30 OEM numbers to list.

I created a new table named products_oem with the fields products_id (matches products_id from the products table), manufacturers_id, and oem. This table has a record for each oem number for each product, so some products will have several matching records in this new table.

Now this is where I'm stuck... how can I pull this information into the product listing and make the oem numbers searchable?

2 Jul 2007, 5:00 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Pulling info from a new table?

  1. in your /docs folder you'll find a document explaining product types

  2. use the "product_music" product type as a model to follow. Perhaps compare it with the main "product" product type
    ie: compare (perhaps using WinMerge? ) :
    -/includes/modules/pages/product_info
    vs
    -/includes/modules/pages/product_music_info

and the corresponding template files:
-/includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php
-/includes/templates/YOURTEMPLATE/templates/tpl_product_music_info_display.php

  1. You can do the data-retrieval in this file:
    /includes/modules/pages/YOUR_PRODUCT_TYPE/main_template_vars_product_type.php

In that file (again, using product_music as an example), you can retrieve pertinent info, populate additional variables, etc.

  1. Then in your tpl_YOUR_PRODUCT_TYPE_display.php template file, you can echo the data by referencing the new variables you created to hold the data.