Contributions
Image Subdirectory Support
Modify New Product page to support image directories
------------------------------------------------------------
This is a simple modification to /admin/categories.php It adds a new field to the new product page named:
Image Subdir. (images/...):
just above the
Product Image: field
There is also a very minor change to
/admin/includes/languages/english/categories.php. It adds only one line to define a new field name. This keeps the language defines stucture consistent with osC standards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this field you can add the path to your image location, ie: /pets, pets/dogs, pets/dogs/brown and so on.
Add the path in that field, browse to to the correct image on your pc and the file will be uploaded to the correct directory and the image file name in the database will indicate the correct location, ie: /pets/kitty.jpg.
The operations are identical to using the standard categories.php but with the addition of image paths. Delete a product and the corresponding image is deleted.
The directories must exist on the server, it will not create them and they must be writable. If they can not be found or or not writable the standard osC error checking will give you a warning. You'll have to know/remember the directory names (sticky notes are good).
It's based on the 051113 update version of osC MS2 so it incorporates all current updates.
The changes are fairly simple and most users are using the stock categories.php file so this can just be used in its place.
There is one simple change to admin/includes/languages/categories.php to add the name for the field in keeping with osC language conventions.
I've only tested this on Unix/Linux systems but from my understanding it should be cross platform (it uses forward slashes in php for the subdirectory pointing).
The installation instructions are in the install document.
The support thread is found here:
http://forums.oscommerce.com/index.php?showtopic=186040
Expand All / Collapse All
This adds automated auction process compatibility.
Fixed a small bug.
UPDATE:23Apr7
Change in catalog/admin/auction_listing_admin.php:
// define the subdirectory
$image_subdirectory=tep_image_subdirectory($image_subdirectory);
TO:
// define the subdirectory
$image_subdirectory=tep_image_subdirectory($image_subdirectory,$new_dir);
Change in catalog/admin/includes/functions/general.php:
function tep_image_subdirectory($image_subdirectory){
TO:
function tep_image_subdirectory($image_subdirectory,$new_dir){
make Image Subdirectory work with More_Pics_6. Just a instructions file. NOT A COMPLETE PACKAGE.
Image Subdirectories 2.0 work with MoPics 6
----------------------------------------------
New Screenshort and new Install.txt so you can get it to work with you MoPics
//TheExterminator
This is an enhanced version of the previous categories.php with subdirectory support.
As I was testing the previous version on a Linux server running php5 with the register globals patch I realized that the POST variable for the subdirectory field was not read. The script needed to call a function from the register globals patch. This is now a settable option in this version of the contribution.
My real goal was to enable direct creation of subdirectories from within the new products screen, "on the fly" so to speak, ie: images/pets/cats and so on. It's in this version, it seemed inconsistent to tell a user that they must use a second program to create directories as they were needed them in the new product screen.
Considerations...
Directory creation is a server specific process, operating system (*nix or Windows), version of php, Register Globals enabled or not, permissions...
Some issues
-------------------------------------------------------
1) Register Globals enabled or not
2) php4 does not support recursive mkdir, php5 does
3) ownership of created directories
4) permissions of created directories
5) backslash vs forward slash for the mkdir() function
To avoid creating multiple versions of the contribution I made it configurable, including turning off the option to create directories, the checkbox will not appear.
You'll find this near the very top of the file.
// ---------- Configure Image Path Tool Features Below ---------- //
define('USE_REG_GLOBALS_PATCH', 'true'); // Use the register globals fix
define('USE_PHP5_MKDIR', 'true'); // Use the php5 mkdir function, set to false if you need to
use chmod after creating directories
define('SHOW_DIR_CHECKBOX', 'true'); // Allow users to create new directories
define('USE_UNIX_SLASHES', 'true'); // Use / slashes for php4 mkdir. Set to false for Windows
// ----------------------- End Configure ----------------------- //
You'll find a small composite screen shot in the support thread.
http://forums.oscommerce.com/index.php?showtopic=186040
I had one user state that there was a problem with the length of the file name.
This is the current package with a renamed folder and zip file.
(image_paths.zip)
Otherwise no change.
I realized I did not check for the possibility of a user (mistakenly) using a backwards slash () in the image path. This is now caught and automatically corrected.
The new field name has been slightly changed and a descriptive line added below it.
This is the complete package.
Most users should be able to just replace the existing admin/categories.php and admin/includes/languages/english/categories.php with the existing files. (Replace their current .php extensions with .bak and upload the new files from within this package.)
The install directions include the changes in the code for users who wish to update their existing files in case their existing files have been previously modified with another contribution.
Modify New Product page to support image directories
------------------------------------------------------------
This is a simple modification to /admin/categories.php It adds a new field to the new product page named:
Image Subdir. (images/...):
just above the
Product Image: field
There is also a very minor change to
/admin/includes/languages/english/categories.php. It adds only one line to define a new field name. This keeps the language defines stucture consistent with osC standards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this field you can add the path to your image location, ie: /pets, pets/dogs, pets/dogs/brown and so on.
Add the path in that field, browse to to the correct image on your pc and the file will be uploaded to the correct directory and the image file name in the database will indicate the correct location, ie: /pets/kitty.jpg.
The operations are identical to using the standard categories.php but with the addition of image paths. Delete a product and the corresponding image is deleted.
The directories must exist on the server, it will not create them and they must be writable. If they can not be found or or not writable the standard osC error checking will give you a warning. You'll have to know/remember the directory names (sticky notes are good).
It's based on the 051113 update version of osC MS2 so it incorporates all current updates.
The changes are fairly simple and most users are using the stock categories.php file so this can just be used in its place.
There is one simple change to admin/includes/languages/categories.php to add the name for the field in keeping with osC language conventions.
I've only tested this on Unix/Linux systems but from my understanding it should be cross platform (it uses forward slashes in php for the subdirectory pointing).
The installation instructions are in the install document.
The support thread is found here:
http://forums.oscommerce.com/index.php?showtopic=186040
Note: Contributions are used at own risk.