Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search the Community

Showing results for tags 'product images directory'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Announcements
    • News and Announcements
  • osCommerce v4.x
    • General Support
    • Migration from old osCommerce
    • Design and Templates
    • Apps / Add-ons
    • Translations
    • API and import/export
    • Marketplace integration
    • Manuals and How-to
    • Blog's discussion
  • osCommerce Online Merchant v2.x
    • General Support
    • osCommerce Online Merchant Community Bootstrap Edition
    • Add-Ons
  • Development
  • General
    • General Discussions
    • Live Shop Reviews
    • Security
    • Commercial Support Inquiries
    • Developer Feedback

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Real Name


Location


Interests


Website

Found 1 result

  1. Hi, I am working on a new contribution for default product images directory. That is set the directory as the manufacturers name. So far I have this piece, which isn't enough: <?php /* //Replaced // 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($_POST['products_previous_image']) ? $_POST['products_previous_image'] : ''); } break; } } */ //With: //Store product images in a directory = "manufacturers_name": if ( isset($_POST['manufacturers_id']) ) { $products_image_dir = null; //Get the manufacturers name: $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $_POST['manufacturers_id'] . "'"); $manufacturers = tep_db_fetch_array($manufacturers_query); //Now we have the dir as: $products_image_dir = DIR_FS_CATALOG_IMAGES . $manufacturers['manufacturers_name']; //Check if that directory exists, if not create it: if (is_dir($products_image_dir) || mkdir($products_image_dir,0755)) { $products_image_dir = $products_image_dir.'/'; clearstatcache(); //The results of is_dir is cached, thus clear the cache } } //For debugging echo 'image dir = '.$products_image_dir;//Output: Ok. // $products_image = new upload('products_image'); $products_image->set_destination($products_image_dir); if ($products_image->parse() && $products_image->save()) {//Doesn't seem to work $products_image_name = $products_image_dir . $products_image->filename; //For debugging echo '<br>products_image_name = '.$products_image_name;//Output: Nothing. } else { $products_image_name = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : ''); } break; } } ?> Testing on an existing product, gives that the directory is created, but the image remains in the old directory. Obviously I need to edit more code or plce the snippet elsewhere. Hopefully someone knows how. So, any suggestion would be most welcome. Sara
×
×
  • Create New...