osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

change default image directories

This is a discussion on change default image directories within the New osCommerce Contributions forums, part of the osCommerce 2.2 Forums category; this: // copy image only if modified $cid = explode('_', $cPath); foreach($cid as $key => $value){ $cdat = tep_db_query("SELECT categories_name ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > New osCommerce Contributions

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 01-16-2008, 10:13 AM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,329
Thanks: 68
Thanked 322 Times in 305 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Post change default image directories

this:
// copy image only if modified
$cid = explode('_', $cPath);
foreach($cid as $key => $value){
$cdat = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id = '" . $value . "' && language_id = '1'");
$cat = tep_db_fetch_array($cdat);
$categoryfile .= $cat[categories_name] . "/";
$_SESSION['categoryfile'] = $categoryfile;
}

$products_image = new upload('products_image');
$products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile);
if ($products_image->parse() && $products_image->save()) {
$products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename;
} else {
-------------------------------------------------
replace with:

// copy image only if modified
$cid = explode('_', $cPath);
foreach($cid as $key => $value){
$cdat = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id = '" . $value . "' && language_id = '1'");
$cat = tep_db_fetch_array($cdat);if ($cat[categories_name] == !null){
$categoryfile .= $cat[categories_name] . "/";}
if (file_exists(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)==false)
{$str = DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile ;
mk_dir($str);
};
$_SESSION['categoryfile'] = $categoryfile;
}

$products_image = new upload('products_image');
$products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile);
if ($products_image->parse() && $products_image->save()) {
$products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename;
} else {


/////////////////////////////////////////////////////////////
and this:
// check if the catalog image directory exists
if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE , 'error');
} else {
$messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NO T_EXIST, 'error');
unset($_SESSION['categoryfile']);
}
------------------------------------------------
replace with:

if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE , 'error');
} else {
$messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NO T_EXIST, 'error');
}
function mk_dir($str, $mode=0777) {
if(!(is_dir($str) || @mkdir($str, $mode))) {
mk_dir(dirname($str));
mk_dir($str);
}
}
unset($_SESSION['categoryfile']);



////////////////////////////////////////////////////////
make these changes, then the categories directoires will be aoto build in products directories and products pics will be into their categoies directories. that's easy to manager all products pisc !
thanks,
if have any problem, content me with simomchen41@gmail.com

More...
__________________
Michael Sasek
osCMax Developer


  • osCMax Templates - Hundreds of premium quality templates. New designs every month!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host.

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
change default image directories michael_s New osCommerce Contributions 0 06-03-2007 04:02 PM
change default image directories michael_s New osCommerce Contributions 0 06-02-2007 05:15 AM
change default image directories michael_s New osCommerce Contributions 0 05-31-2007 03:21 PM
change default image directories michael_s New osCommerce Contributions 0 05-08-2007 06:10 AM
change default image directories michael_s New osCommerce Contributions 0 05-07-2007 03:11 PM


All times are GMT -8. The time now is 06:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax