Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

One Product in Multiple Categories


Guest

Recommended Posts

1. Is it possible to put one product in more than one category?

 

2. If I delete a cetegory, will it delete the products in that category?

 

3. Can I have a product without a category?

Link to comment
Share on other sites

1. Is it possible to put one product in more than one category?

yes

 

2. If I delete a cetegory, will it delete the products in that category?

yes

 

3. Can I have a product without a category?

yes

Link to comment
Share on other sites

Is there a quick way to put a product in multiple categories? My products usually need to be in 4-5 categories each.

 

Thanks,

Link to comment
Share on other sites

Hi,

 

The only way I know is to copy the product in the admin to another folder.

 

You might try doing one product like this and then using phpmyadmin look at the product number and where it is in the database. Then, you could possibly add the numbers of the appropriate folders to a product.

Link to comment
Share on other sites

Is there a quick way to put a product in multiple categories? My products usually need to be in 4-5 categories each.  

 

I have found by accident that if you upload a product with Easy Populate and then upload it again with different catagories that it shows up both places. This may work for you if you are using the easy populate contrib.

 

8)

 

HTH, Tony

Link to comment
Share on other sites

I have many products that span categories. Poduct #0149 it's a beagle that is in ANIMALS and DOGS. When i created my orders I just listed all the products that I wanted in multiple categories and added them to a seperate sheet and imported the list to categoreis table.

 

It works great...

Link to comment
Share on other sites

The table you are looking for is products_to_categories. I wrote a MS Access script that created an SQL script to update this table with all the relationships. It's very easy to acheive, as the table only has 2 fields.

 

Hope this helps.

Many Thanks,

 

Steve

Link to comment
Share on other sites

The table you are looking for is products_to_categories. I wrote a MS Access script that created an SQL script to update this table with all the relationships. It's very easy to acheive, as the table only has 2 fields.  

 

Steve,

Is this somethng you could share or is it already a contirb? I got a lot of stuff to cross but haven't yet and that sounds a lot simpler than re-adding through easy populate.

 

 

Tony 8)

Link to comment
Share on other sites

With ref to the Access code mentioned earlier...

 

I have a legacy database, used in my old shop. The code is designed to use this. I have a products table, a categories table and a product/categories relationship table. Briefly:

 

1. Select all product/category records where both product and category exist in their respective tables (my database can handle this, but oSC throws a wobbly)

 

2. Write an SQL line to delete the current records

 

3. Write an SQL statement for every record in your product/categories recordset

 

Here's my code, remember this is written to handle things in my database that oSC doesn't...

 

Function GenProdCat() As String



Dim db As Database

Dim rs As Recordset



Set db = CurrentDb

Set rs = db.OpenRecordset("Select * from qryprodcat where categoryactive = true and exists(select * from products where productid = prodcat!prodid and active = true) order by prodid,categoryNum desc ")



GenProdCat = "Delete from products_to_categories;" & vbCrLf



rs.MoveFirst

Do While Not rs.EOF

       GenProdCat = GenProdCat & "INSERT INTO products_to_categories VALUES (" & CStr(rs!prodid) & "," & CStr(rs!CategoryNum) & ");" & vbCrLf

   rs.MoveNext

Loop





End Function

 

The result is a script that looks like so...

 

# Product Category relationships



Delete from products_to_categories;

INSERT INTO products_to_categories VALUES (6,105);

INSERT INTO products_to_categories VALUES (9,105);

INSERT INTO products_to_categories VALUES (12,110);

.

.

.

 

I paste this into PHPmySqlAdmin, and away it goes.

 

This is part of a much bigger script that regenerates my entire shop. Because I have many products that change frequently, I find it easier to deal with them offline, and upload.

 

Hope this gives you some inspiration!

Many Thanks,

 

Steve

Link to comment
Share on other sites

Forgot to say...I can't access my osc database via ODBC. If you can, you don't need to generate a script, then run it...you can just do it directly to the database!

Many Thanks,

 

Steve

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...