Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Subcategories images


stevenrwoolley

Recommended Posts

Posted

I have several categories that have the same type of subcategories.

 

Category = Ford

Sub Cat = Transmission

Sub Cat = Engine

Category = GM

Sub Cat = Transmission

Sub Cat = Engine

 

 

I have been placing images that help my customer identify each subcategory. The problem I have is that I need to go through the admin section and upload each image for every subcategory. I have been trying to look at the database to see where an image is linked to a subcategory so that I can just assign an image for each subcategory. Does anyone know how I might be able to quickly link an image for subcategories with the same name?

 

Thank you,

Steven R. Woolley

Posted
i can only find the image to product link in phpmyadmin and easypopulate. I have searched all over phpmyadmin for any subcategories and do not see them listed.
The subdirectory path becomes part of the image name in the database.

 

So in your case an image name in the db would be Ford/Transmission/transmission1.jpg for example.

 

Which makes your life kind of simple because you only need to deal with one table, products.

 

You can export that and manipulate the image name in any way you like, add paths, whatever and then reimport it.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

Did something wrong... I changed the Categorysection on Myphpadmin to include the images for the subcategories. When I uploaded the file, all my categorys changed. I have been trying to restor from the backup in admin section but the page times out. Any suggestions?

  • 2 weeks later...
Posted
The subdirectory path becomes part of the image name in the database.

 

So in your case an image name in the db would be Ford/Transmission/transmission1.jpg for example.

 

Which makes your life kind of simple because you only need to deal with one table, products.

 

You can export that and manipulate the image name in any way you like, add paths, whatever and then reimport it.

 

Thank you for the reply AlanR

I finally got my site up again after a small phpmyadmin mishap. I do no see the subcategories images in the product section of my database. I found it in the categories and categories_description. I don?t see how the same image for different subcategories with the same name can be manipluated and uploaded. Can you clarify what you mean, I?m having a hard time understanding it.

 

Thank you,

 

Steve

Posted
Thank you for the reply AlanR

I finally got my site up again after a small phpmyadmin mishap. I do no see the subcategories images in the product section of my database. I found it in the categories and categories_description. I don’t see how the same image for different subcategories with the same name can be manipluated and uploaded. Can you clarify what you mean, I’m having a hard time understanding it.

 

Thank you,

 

Steve

It wasn't clear to me which images you wanted to redefine. So if it's the subcategories image you want to redefine and it's in table - categories for example, the easy way to change them (for me) is to export that table via phpMyAdmin via CSV.

 

Then open the csv file in Excel. My version of Excel allows me to search and replace in a single column. So I'd look for the image name you want to to change and do a search and replace with the subdir/imagename.jpg. Then reimport the table via phpMyAdmin.

 

If you click the DROP TABLE IF EXISTS box, then on the import your altered table will replace the table which is currently there.

 

I strongly suggest that you set up another database if possible and copy (import) the current database into it. Then you can experiment and learn to your heart's content with that (test) database till you get your techniques down. Once you get the hang of it you can cut over from one database to the other as you update them by changing the database info in the two configure.php files. That way you can safely update a database till it's what you need then put it into production.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

Thank you for the reply, It is all starting to make more sense now. When I exported the csv file and open it up in excel it in all in one column and looks like

273;;"137";"0";"2006-01-01 12:25:48";"2006-01-01 12:25:48"

. Not a big deal just saved it as CSV for MS Excel data so that I can work on each column separately. I have compared the categories database with the categories description database and have extrapolated the unique id?s that I need to add the image names to. The only problem is saving the file so it looks like the .csv. When I save it as a scv, Im not sure it is putting the , or ? in the file? Any idea, or am I a lost cause?

 

Thank you,

 

Steve

Posted

OK, this is going to be a little more complicated then. First things first.

 

You've actually got a semicolon delimited file there. You can work with that but it's no different than working with a text file in a text editor

 

This is a sample of a comma deliminated file (I cut off the last parts of the lines so as not to get a word wrap here)

 

"1","31","MG200MMS","matrox/mg200mms.gif","299.9900","2004-04-18 15:42:15",

"2","32","MG400-32MB","matrox/mg400-32mb.gif","499.9900","2004-04-18 15:42:15",

"3","2","MSIMPRO","microsoft/msimpro.gif","49.9900","2004-04-18 15:42:15",

 

If you run your own copy of phpMyAdmin (henceforth referred to as PMA) you can do a lot more than you can if you use a shared copy provided by your host.

 

You can, among other things, define which character will be used as the field separator for CSV export.

 

edit: The newer versions of PMA have a direct Excel export option but I've not played with it too much since it creates a real Excel file with formatting and everthing which is actually harder to work with.

 

Here's a screen shot of what that file looks like opened in Excel. (The dates are screwed up, I'll have to fix that, it's a new version of PMA that I've not competely set up yet.)

 

csv_export.png

 

What I did was redefine the delimiter for PMA like so...

 

$cfg['Export']['csv_columns'] = TRUE;

$cfg['Export']['csv_null'] = 'NULL';

$cfg['Export']['csv_separator'] = ',';

$cfg['Export']['csv_enclosed'] = '"';

$cfg['Export']['csv_escaped'] = '\\';

$cfg['Export']['csv_terminated'] = 'AUTO';

 

It would be worth your time to download PMA from http://phpmyadmin.net and install it.

 

I've got the last few versions running and the latest 2.8.0-beta1 which is what I just used.

This version comes with an installer script which makes the basic setup pretty easy but it does not give you options like the ones above. To get the more expert options you need to read through config.default.php which is in the PMA /libraries folder.

 

The way it works is that PMA reads a file named config.inc.pl in its top level directory when it starts up. Anything defined in that smaller file takes precedence over the default settings in config.default.php. So I copied the definitions related to CSV export and pasted them into the config.inc.pl file and changed them.

 

Below is the very same data saved out as CSV from Excel.

 

1,31,MG200MMS,matrox/mg200mms.gif,299.99,4/18/04 15:42,NULL,0000-00-00 00:00:00,

2,32,MG400-32MB,matrox/mg400-32mb.gif,499.99,4/18/04 15:42,NULL,0000-00-00 00:00:00,

3,2,MSIMPRO,microsoft/msimpro.gif,49.99,4/18/04 15:42,NULL,0000-00-00 00:00:00,

 

PMA can quite happily import this back with the default import settings but you can define those as well.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted

Actually, going back and doing another export I see that you can choose the "Fields terminated by" character in a final screen before the Export. I'm not sure which versions of PMA have that option but check in yours.

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Archived

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

×
×
  • Create New...