Post by varnco » Mon Jan 18, 2016 3:01 am

I'm wanting to change the name of directory where I have my images.

the current folder name is "product images" (yes, with a space) so the image link looks like this:
http://www.example.com/image/cache/data/product images/taco.jpg

I want to change it to "product-image" (with no space)
http://www.example.com/image/cache/data/product-images/taco.jpg

When I renamed the folder to include the dash, using the built-in tool to upload or select images, the name of the older changes, but the links to my product images do not.

Any thoughts on how I can fix it without having to re-establish all my product image links so they include the "-" now?

I tried clearing out the cache under system/cache but that didn't work.

Thank you.

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm

Post by victorj » Mon Jan 18, 2016 3:08 am

renaming to product images would render the url to looklike this:

product%20images due to the way your server and browser do handle a spave in a url.

you can try it with renaming the seo url of one off your products, replace your hypens with a space and check the url to that product.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by varnco » Mon Jan 18, 2016 3:17 am

I was hoping that there's a fast way I can change the folder name (I never should have made a folder name with a space), so it doesn't have a space any longer, but without me having to "reset" the URL's for the product images.

I assume this is handled somehow in the database

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm

Post by victorj » Mon Jan 18, 2016 3:40 am

No that would be far to easy >:D

Image folders are defined bij absulute path in config.php files and the actual file to the images on your server.

at this moment the path to the images for your products is set in the database, so opencart knows whre to find them.

if you would relocate the image path, youre product would end up without any images, as path in databse is different to actual path on server.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by varnco » Mon Jan 18, 2016 4:02 am

So, my option is to change the folder name, and then go and reselect each product image, so I updates the URL pointing to the product image and corresponding thumbnails?

Thanks.

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm

Post by victorj » Mon Jan 18, 2016 4:06 am

indeed change the folder name.

edit config.php in root and admin folder so it will point to your renamed image folder.

iether edit each product and reasign the corresponding picture to it, or much faster, edit your database and alter all image path in one go

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by varnco » Mon Jan 18, 2016 9:41 am

Here's what I did:

Created new folder
Went into db and changed the path
Only the thumbnail is using the new path. The main image is using the old path

Are these image paths in d different areas of the database?

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm

Post by varnco » Tue Jan 19, 2016 12:51 am

The thumbnail updates but the product images do not.. any thoughts on why changing the path in the database itself to the image does not fix it?

Does "assigning" it withing opencart do something different? If it did, wouldn't it be listed in the database?

Thanks.

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm

Post by victorj » Tue Jan 19, 2016 3:56 am

did you adapt the path to image in both your config files as well ?

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by varnco » Tue Jan 19, 2016 4:47 am

Thanks for the help!

More information:

I found that the image URL's are located in 2 different tables in the database.
gtk_product
gtk_product_image

A question, I'm sure there's a way I can replace
data/product images/imagenamesthatvary.jpg

So it reads (with the dash):
data/product-images/imagenamesthatvary.jpg

Using some sort of command, like this in PHPAdmin?:

Code: Select all

update gtk_product set image = replace(image, 'data/product images/', 'data/product-images/');
I stole the code from a post on updating wordpress, and figure it's probably similar or the same as updating a database for opencart?

Thoughts?

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm

Post by victorj » Tue Jan 19, 2016 5:22 am

indeed you found them.

its possible to update a database field with a sql comand as described, it will update all field at once, saving loads off time.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by varnco » Tue Jan 19, 2016 5:54 am

Well, I made a backup of the 2 tables from my database, and then pulled the trigger.

Worked well, and the image URL's have changed from "data/product images/" to "data/product-images/" using the above referenced coding

Just in case someone needs this in the future... I went to the tables

gtk_product
gtk_product images

And changed the variables in red to match the table, fields that needed to be updated and what needed to be found and replaced with:

update gtk_product set image = replace(image, 'data/product images/', 'data/product-images/');

Thanks victorj for the help!

New member

Posts

Joined
Sun Aug 18, 2013 3:16 pm
Who is online

Users browsing this forum: No registered users and 85 guests