Jump to content
Sign in to follow this  
lildog

Categories and Products Images Folder Tree V 1.3

Recommended Posts

Ignore the first post, this one solution takes care of both problems...

 

I've got this same problem on RC2a, even after implementing xispita10's mod:

 

1) Add a new product and choose an image.

2) When I click "Preview", the image appears fine.

3) When I click "Insert", then check the Admin page or the Product page, the image is gone.

4) Image is in the proper subfolder.

 

Why aren't the admin and product pages finding the image? Seems the location is not being written to the database. Why?

 

Thanks for your help

 

OK, here's what I've determined:

 

There are 2 issues going on with xispita10's mod:

1) The folders create names from the Category name, but replace spaces with underscores (I assume this was done to accomodate web servers that don't like spaces in filenames).

So, a category name of "Bells and Whistles" becomes a folder name of "bells_and_whistles".

Using $categories_name_array[$language_id] to grab the category name still includes spaces and won't resolve to the proper folder.

 

2) The $language_id is wrong:

Previously in the admin/categories.php, the code loops through $language_id['id'] and sets the values for each language (English, German, Spanish are the 3 defaults). When it ends, it leaves $language_id as the last value (3 in this example, or Spanish). If you're lazy like me and haven't filled in any of the fields other than English, the value will be blank.

So, when it tries to find $categories_name_array[$language_id] (which would be the blank Spanish value), it returns nothing, resulting in a missing directory.

 

 

Solution: Replace xispita10's code:

tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_name_array[$language_id] . "/" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

 

With:

tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_output_generated_category_path_fs($categories_id) . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

 

Any additional thoughts to make this better?

Edited by matta

Share this post


Link to post
Share on other sites

Having problems when I go back and edit a product:

Is this just me, or are others having problems?

 

Works correctly the first time- ie when put in as a new product

eg: image uploaded from my computer goes to correct location:

test_category/testcat_one/skin_1.jpg

 

If I go back and edit that product, say the description, and leave image input box blank

then preview is fine, but 'update' adds the folder names to its beginning (again)

test_category/testcat_one/test_category/testcat_one/skin_1.jpg

 

If I upload the image again from my computer it goes back to correct location

 

If I write 'none' as the image filename everything updates OK

 

There is a test for a null field in the update function, but somehow when the field is passed to the update function, it has something in it..

the test is here:

 case 'updateproduct'
    if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) 

Share this post


Link to post
Share on other sites
are you using xispas fix?

 

 

lildog

 

No, what is it? Where do I find it?

- Just did a search for it, and came up with this post only...

Share this post


Link to post
Share on other sites
are you using xispas fix?

 

 

lildog

Are you refering to the post at top of page 2 by xispita10 ? Sep 17 2008, 09:21 PM

 

I used the latest contribution, so it wasn't needed- the relevant section in my admin/categories.php reads:

        if ($categories_image = new upload('categories_image', $dir_to_make)) {
         $db_image_file_name = tep_output_generated_category_path_fs($categories_id) . $categories_image->filename;
         tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($db_image_file_name) . "' where categories_id = '" . (int)$categories_id . "'");
       }

This appears to be the area of the program where the extra path is being added at the front

Seems to me we need to skip this altogether if nothing to upload?

Share this post


Link to post
Share on other sites
are you using xispas fix?

 

 

lildog

I've discovered the problem!

I misunderstood the instructions in README.txt that say "(Earlier versions than oscommerce-2.2rc2a)"

I thought that meant I didn't need to make those changes on my version..

When I put them in it all worked fine.

Maybe the moderator can remove the earlier (useless) post?

Share this post


Link to post
Share on other sites

Yeah....that is pretty easy to miss and I don't like it but I didn't know how to package it for two versions of osc. Maybe next time I will just make two install docs to make it easier.

 

 

lildog

 

 

I've discovered the problem!

I misunderstood the instructions in README.txt that say "(Earlier versions than oscommerce-2.2rc2a)"

I thought that meant I didn't need to make those changes on my version..

When I put them in it all worked fine.

Maybe the moderator can remove the earlier (useless) post?

Share this post


Link to post
Share on other sites

Has anyone got this too work with RCA2, if so can they post there admin/categories.php file and catimagessetup.php files please.

 

Getting no pictures added, warning file location does not exist


Stuart

Share this post


Link to post
Share on other sites
Has anyone got this too work with RCA2, if so can they post there admin/categories.php file and catimagessetup.php files please.

 

Getting no pictures added, warning file location does not exist

 

Probably the same problem that i am getting... lots of warning.. and then the final single warning. Please explain where this could be going wrong?

 

Warning: mkdir() [function.mkdir]: File exists in /home/kod49616/public_html/admin/catimagessetup.php on line 152

 

Warning: Cannot modify header information - headers already sent by (output started at /home/kod49616/public_html/admin/catimagessetup.php:152) in /home/kod49616/public_html/admin/includes/functions/general.php on line 110

Share this post


Link to post
Share on other sites
It says safe mode is on..and its under admin. Does that mean I have to take the ht.password off for a moment? or put it outside of the admin folder?

 

*newbie*

 

I re-did it correctly, making sure I did everything the readme file says, but it still says:

 

Safe mode appears to be enabled. This script will not work. You cannot continue.

 

*is lost*

Edited by victorianwinter

Share this post


Link to post
Share on other sites

hi, i french sorry for my english , i have installed it on my RC2a and make the correction and now it works.

There is still the probleme with catimagessetup.php , somebody found a sulution ??

 

 

I 'd like to know do we have a solution to delete the folder when we delete a categorie ?

 

Thanks best regards.

Share this post


Link to post
Share on other sites
I've got this same problem on RC2a, even after implementing xispita10's mod:

 

1) Add a new product and choose an image.

2) When I click "Preview", the image appears fine.

3) When I click "Insert", then check the Admin page or the Product page, the image is gone.

4) Image is in the proper subfolder.

 

Why aren't the admin and product pages finding the image? Seems the location is not being written to the database. Why?

 

Thanks for your help

 

In 2.2rc2a

- Categories image problem resolved by using fix as above

- Products image problem resolved by using "$sql_data-array['products_image']....... . " patch in original READ_ME file marked as only for earlier versions than 2.2rc2a.

 

All now works as advertised. Thanks to all for original and fixes. :lol: Mike

Share this post


Link to post
Share on other sites
Having problems when I go back and edit a product:

Is this just me, or are others having problems?

 

Works correctly the first time- ie when put in as a new product

eg: image uploaded from my computer goes to correct location:

test_category/testcat_one/skin_1.jpg

 

If I go back and edit that product, say the description, and leave image input box blank

then preview is fine, but 'update' adds the folder names to its beginning (again)

test_category/testcat_one/test_category/testcat_one/skin_1.jpg

 

If I upload the image again from my computer it goes back to correct location

 

If I write 'none' as the image filename everything updates OK

 

There is a test for a null field in the update function, but somehow when the field is passed to the update function, it has something in it..

the test is here:

 case 'updateproduct'
    if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) 

 

 

I am also getting this problem along with the other one of not showing the images but was showing in the admin area when previewed but not again ??

Used the fix still not a thing.

Share this post


Link to post
Share on other sites

hi! i have a probleme. first sorry for my english.

i have ultrapic (http://addons.oscommerce.com/info/1642)

I added categories and product images but only Main Image in folder. other images in catalog/images folder.

How can I do together http://addons.oscommerce.com/info/2409 (categories and product images in folder) and UltraPics 2.08 (http://addons.oscommerce.com/info/1642) .

Share this post


Link to post
Share on other sites

HI

I´m Spanish, sorry for my english

 

Move and Copy products don´t work. Yes move products but not products images paths.

How can I do

 

 

Thanks, thanks, thanks.

Share this post


Link to post
Share on other sites

Hi,

 

I've installed this ad-on. I want to uninstalled it now .. how do I do it? I forgot to backup my database before I installed this ad-on ...

Share this post


Link to post
Share on other sites

OK. I`ve managed to make the photos to apear, but, the first photo is from the product folder, the other ones ar from the images folder-and not from the new product folder (as the first one). :blink:

Share this post


Link to post
Share on other sites

This is a great addon, but, i don`t get it to work with more pics 1.4.3 (the classical version because it has the best design for my online travel shop). If anyone got this to addons working together well - please share a thought. I`m out of ideas.

PS: i don`t understand php - but a recognize it :huh::D

Share this post


Link to post
Share on other sites

This could be a nice add on, but there's a couple of things that need to be fixed.

 

I can't get it to work, it does create the directory and uploads the file, but it doesn't write the image name to the DB, hence the image shows as broken on the catalog (same problem that was mentioned earlier in this topic).

 

If I move a category, when I edit or add a new product, there's an error saying the destination folder doesn't exist. If I recreate the category, folder is created, now problem.

 

Can anybody help fixing these problems?

 

I'm using RC2a by the way.

 

Tks in advance for any help.


Patty

Share this post


Link to post
Share on other sites

Installed v1.3. Everything was created successfully except that now the product images aren't showing up. I see that the links to the image aren't including the new image category folders.

 

To those who have experienced this what did you do to fix it? THANKS!


If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Share this post


Link to post
Share on other sites

Hello

What happens if the category tree is changed. IE the name or where the category is moved. Are the images moved to the new structure?

Share this post


Link to post
Share on other sites

Hello

What happens if the category tree is changed. IE the name or where the category is moved. Are the images moved to the new structure?

 

 

I don`t believe this contrib is supported any more, perhaps your best solution is to try another.

 

Select Product Image Directory & Instant Update For Products allows you to choose the directory for any product image &/or create new directories, the full path is stored in the dbase, so moving a product will not cause any issue. wink.gif


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites

Hi,

 

You write:

***FIND:

case 'new_product_preview':

// copy image only if modified

$products_image = new upload('products_image');

$products_image->set_destination(DIR_FS_CATALOG_IMAGES);

if ($products_image->parse() && $products_image->save()) {

 

***CHANGE TO:

case 'new_product_preview':

// copy image only if modified

$products_image = new upload('products_image');

// EOF Categories and Products Images Folder Tree

$prod_path = $HTTP_GET_VARS['cPath'];

$lchar = strrpos($prod_path, '_');

if ($lchar + 1 == 1) {

$lachar = 0;

} else {

$lachar = $lchar + 1;

}

$prod_path_id = substr($prod_path, $lachar);

$prod_folder = tep_output_generated_category_path_fs($prod_path_id);

$products_image->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);

// EOF Categories and Products Images Folder Tree

if ($products_image->parse() && $products_image->save()) {

 

BUT in my categories.php written:

case 'new_product_preview':

// copy image only if modified

if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {

$products_image = '';

$products_image_name = '';

} else {

$products_image = new upload('products_image');

$products_image->set_destination(DIR_FS_CATALOG_IMAGES);

if ($products_image->parse() && $products_image->save()) {

 

Some text missing in your instruction.

What I must to do??

I use Oscommerce V2.2 RC2.

 

Thanks

(sorry for my english)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×