Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Select Product Image Directory & Instant Update For Products


spooks

Recommended Posts

I have tried using this on osCommerce V2.3.1 but for some reason when ever I try to upload new images even if I select a directory it only uploads the images to the main images box. Did anyone get it working with V2.3.1

 

Cheers

Link to comment
Share on other sites

  • 2 weeks later...

CAN SOME ONE POST BOTH PHP FILES UP PLEASE.

 

Need a fully working version for 2.3.1

 

FROM THE INSTRUCTIONS:

 

Find(366)

 

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()) {

$products_image_name = $products_image->filename;

} else {

$products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

}

break;

 

-------------------------------

 

This doe not appear in my code, so finding and replacing it is not possible.

 

 

ANY HINTS OUT THERE PEEPS- I NEED THIS ADDON BIG TIME!

Link to comment
Share on other sites

  • 4 months later...

Works in my test environment (wamp) but not fully in Apache on my server. The reason is because the script creates the folders with owner 'apache' and mod 500 and as a result the images cannot be uploaded into. Is there any way to create folders with user credentials that work? What needs to be changed?

Link to comment
Share on other sites

  • 2 weeks later...

On the new folder in admin/languages/english/categories.php it says Parse error: syntax error, unexpected T_STRING

The version is 2.0 and it says works on 2.3.1 and are corrected in language, but it gives me the error. Where can be the problem?

Anyway if the developer contact me, I have a GREAT modification that would be useful for ALL people. But I need a little help to fix it, since I'm not a programmer.

 

//BOF Select Product Image Directory

define('TEXT_PRODUCTS_DIRECTORY_DONT_EXIST_1', 'ERROR - The provided \'images\' directory ');

define('TEXT_PRODUCTS_DIRECTORY_DONT_EXIST_2', ' does not exist on the server!!.');

define('TEXT_PRODUCTS_IMAGE_DIRECTORY', 'Image Directory:');

define('TEXT_PRODUCTS_IMAGE_ROOT_DIRECTORY', 'Default Folder);

define('TEXT_PRODUCTS_IMAGE_NEW_FOLDER', 'New Folder: '); HERE IT SAYS THERE'S ERROR.

define('TEXT_PRODUCTS_UPDATE_PRODUCT', 'Update');

define('TEXT_PRODUCTS_INSERT_PRODUCT', 'Insert');

define('TEXT_PRODUCTS_WITHOUT_PREVIEW', ' without preview ');

define('SUCCESS_CREATED_DIRECTORY', 'Folder %s created in %s.', 'success');

//EOF Select Product Image Directory

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

like Dager say's is just one missing character. The right code must be :

IN Admin/includes/languages/english/categories.php

************************************************************************************************

***Before the final '?>': ***

 

***Add:***

//BOF Select Product Image Directory

define('TEXT_PRODUCTS_DIRECTORY_DONT_EXIST_1', 'ERROR ERROR - The provided \'images\' directory ');

define('TEXT_PRODUCTS_DIRECTORY_DONT_EXIST_2', ' does not exist on the server!!.');

define('TEXT_PRODUCTS_IMAGE_DIRECTORY', 'Image Directory:');

define('TEXT_PRODUCTS_IMAGE_ROOT_DIRECTORY', 'Default Folder');

define('TEXT_PRODUCTS_IMAGE_NEW_FOLDER', 'New Folder: ');

define('TEXT_PRODUCTS_UPDATE_PRODUCT', 'Update');

define('TEXT_PRODUCTS_INSERT_PRODUCT', 'Insert');

define('TEXT_PRODUCTS_WITHOUT_PREVIEW', ' without preview ');

define('SUCCESS_CREATED_DIRECTORY', 'Folder %s created in %s.', 'success');

//EOF Select Product Image Directory

Link to comment
Share on other sites

  • 3 months later...
  • 4 months later...

Hi,

 

I had installed this addons, there are two version one is original one and one is modified for 2.3.1

I tried both and both has the same problem.

 

1st problem:

it does show up the drop down menu and a blank filed that you can create new folder name.

the problem is that it doesn't save the value, and the image still save in the main catalog/images

and also if I save the product and it will automatically save it as red light (inactive).

 

2nd problem:

if I turn the red light inactive to green light active, then my front page gone missing. it doesn't show infoboxes, it doesn't show the products list at all. Only show the welcome message.

 

Can someone please help?

 

Many thanks in advance.

 

Lyn

Link to comment
Share on other sites

Hi,

 

I had installed this addons, there are two version one is original one and one is modified for 2.3.1

I tried both and both has the same problem.

 

1st problem:

it does show up the drop down menu and a blank filed that you can create new folder name.

the problem is that it doesn't save the value, and the image still save in the main catalog/images

and also if I save the product and it will automatically save it as red light (inactive).

 

2nd problem:

if I turn the red light inactive to green light active, then my front page gone missing. it doesn't show infoboxes, it doesn't show the products list at all. Only show the welcome message.

 

Can someone please help?

 

Many thanks in advance.

 

Lyn

 

problem solved, thanks!

Link to comment
Share on other sites

  • 4 months later...

I've installed this addon, but when I try to access "Categories/Products" in the admin tool I get a blank page.

 

Could someone please post the admin/categories.php files.. (or mail them to me)

 

LS

LadyShark

Link to comment
Share on other sites

  • 1 year later...

I installed this add-on for osCommerce version 2.3.3.4

 

It worked in that the menu created over at the admin panel showed all the sub-folders in the root of the images folder (except for those listed in the $exclude_folders variable).

 

What I needed was for the sub-folders in the images/products/pens folder to show up instead. This is what I did to achieve that:

 

In the admin/categories.php file, there was a line of code from the install that read $images_dir = DIR_WS_IMAGES;. I changed that line of code from  $images_dir = DIR_WS_IMAGES to $images_dir = DIR_WS_PRODUCTS;

 

Then in the includes/configure.php and in the admin/includes/configure.php, I created this line of code: define('DIR_WS_PRODUCTS', DIR_WS_IMAGES . 'products/pens/');

 

This works just fine in that the menu in the admin panel now shows the subfolders in the images/products/pens folder, and I was able to upload files to the correct manufacturer folder (bargain-corner, conway-stewart, waterman, etcetera)

 

The problem is, when I upload new images, they don’t display on the product listing page or the product details page or in the shopping cart – they are broken image links. In looking at the source code in the browser, the image source for these newly uploaded images point to images/folderName/imageName.jpg when it should be pointing to images/products/pens/folderName/imageName.jpg

 

I'm not sure how to fix this issue. Any advice would be very appreciated!!

Link to comment
Share on other sites

I figured it out. Here's my solution:

 

In the admin/includes/configure.php file, I inputted this: define('DIR_WS_PRODUCTS2', 'products/pens/');

 

Then in the admin/categories.php file, I inputted this: $images_dir2 = DIR_WS_PRODUCTS2;

Then right around line 537 in the categories.php file, there's a line of code that reads... $sql_data_array['products_image'] = $dir . tep_db_prepare_input($products_image->filename); I changed it to: $sql_data_array['products_image'] = $images_dir2 . $dir . tep_db_prepare_input($products_image->filename);

 

I've tested it and so far so good. Hopefully this code is sound and won't cause issues elswhere.

Link to comment
Share on other sites

  • 2 weeks later...

After testing, there is one more line of code that needs to be changed. Right around line 676 there is a line of code that says:

 

$sql_data_array['image'] = $dir . tep_db_prepare_input($t->filename); (there are two of these in the file. Make sure you are changing the one under the SECOND $t = new upload($key);)

 

Change it to: $sql_data_array['image'] = $images_dir2 . $dir . tep_db_prepare_input($t->filename);

Link to comment
Share on other sites

  • 3 months later...

Select Product Image Directory & Instant Update For Products

This simple contribution does three things.

 

  • A drop down is added to the product edit page of sub-folders of the images folder to allow you to select where the product image is to be stored

Hi Spooks:  How to do I make it so inside the dropdown the first choice is a specific folder.  I added subfolders but it defaults to the first one I made.

 

Thanks Bro!

Link to comment
Share on other sites

Here's what I did in the admin/categories.php file:

 

Right after the following td... <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td> I placed a series of if statements that identifies the category selected in the admin panel. In order for this to work, you need to find out the category id of each product category. So do this:

 

Right after the <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>, input the following script:

 

       <?php
            echo "<script type='text/javascript'>alert('$current_category_id');</script>";

         ?>

 

Then go into your admin panel and choose each category one by one. An alert will pop up giving the category id. Write down the category name and the id that pops up in the alert. Once you have all the id's, replace the echo alert above with the following script:

            if($current_category_id==categoryNumber)

                $defaultFolder = 'folderName1';
            }
            elseif($current_category_id==categoryNumber) {

                $defaultFolder = 'folderName2';
            }
            
            elseif($current_category_id==categoryNumber) {

                $defaultFolder = 'folderName3';

            }
           
   
            else {
                //default folder will be chosen
            }
          

Make sure that you input the actual id number in place of the items above that say categoryNumber and the actual folder name where it says folderName.

Edited by ''B''
Link to comment
Share on other sites

  • 9 months later...

if anyone can help with this issue?

http://www.oscommerce.com/forums/topic/408217-234-separate-large-image-folder/

 

 

also i have fixed a typo in the install for this addon

http://addons.oscommerce.com/info/8150

 

 

i did find a possible issue.

when the folder is made or selected is saving in the database like this :/test1/item_1.jpg
all the other stock images where : dvd/lethal_weapon_large.jpg

 

when it loads in the page its: catalog//test1/item_1.jpg

 

 

 

what i dont understand is in the stock cart install/. how did some items save images in separate folders?

Edited by mafiouso
Link to comment
Share on other sites

just wondering, what if the correct way to do this?

If you wish to alter the image directory, or change the exclude list, edit the lines at the start of categories.php.

    $images_dir = DIR_WS_IMAGES; // default catalog images folder;

    $exclude_folders = array("banners","default","icons","mail","infobox","js");

 

 

how do i change it?

    $images_dir = DIR_WS_IMAGES; // default catalog images folder;

    $images_dir = DIR_WS_IMAGES; /images_2/ ???;

 

or is it more complex?

 

 

also is it possible to automatically have all the large images goto a set folder?

what i would like is

 

thumbs /thumbs (default)

large    /large  (large image)

 

thanks

Edited by mafiouso
Link to comment
Share on other sites

  • 5 weeks later...

Hello!

 

I was trying to install the modul, but the docu mentiones a part of the categories.php in admin, that does not exist in mine.

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()) {
          $products_image_name = $products_image->filename;
        } else {
          $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');
        }
        break;
It should be replaced by

// section moved, instant update
The part in my categories.php seems to be:

$products_image = new upload('products_image');
        $products_image->set_destination(DIR_FS_CATALOG_IMAGES);
        if ($products_image->parse() && $products_image->save()) {
          $sql_data_array['products_image'] = tep_db_prepare_input($products_image->filename);
        }
I installed the categories.php nevertheless and the page appears and the input-filed is there to create a new folder, but the folder is not created and the image is uploaded to the default images directroy.

 

Any help in this?

 

Regards

Andreas

Link to comment
Share on other sites

you should explain what version you are on etc.

 

Here's what I did in the admin/categories.php file:

 

Right after the following td... <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td> I placed a series of if statements that identifies the category selected in the admin panel. In order for this to work, you need to find out the category id of each product category. So do this:

 

Right after the <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>, input the following script:

 

       <?php
            echo "<script type='text/javascript'>alert('$current_category_id');</script>";

         ?>

 

Then go into your admin panel and choose each category one by one. An alert will pop up giving the category id. Write down the category name and the id that pops up in the alert. Once you have all the id's, replace the echo alert above with the following script:

            if($current_category_id==categoryNumber)

                $defaultFolder = 'folderName1';
            }
            elseif($current_category_id==categoryNumber) {

                $defaultFolder = 'folderName2';
            }
            
            elseif($current_category_id==categoryNumber) {

                $defaultFolder = 'folderName3';

            }
           
   
            else {
                //default folder will be chosen
            }
          

Make sure that you input the actual id number in place of the items above that say categoryNumber and the actual folder name where it says folderName.

Link to comment
Share on other sites

Tell you what. My troubles installing the module came from the mod

"Select Product Image Directory & Instant Update - Multilanguage V1.15.zip"

 

This evening I found the module

"Install Select Product Image Directory.zip" (Select Product Image Directory 2.2.4)

from Mafiouso previoulsy lildog.

 

Installed it and it works flawless so far. I am very glad I have that thing

running! It works great even with mutliple images in a subfolder!

 

Good work, fine thing!

 

Thank you all!

 

Andreas

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...