Contributions
Multi images extra by nico
There are many contributions to manage several images, but all modify many files, as well as the original database.
I thus decided to write this contribution by basing me on "Three images with admin 1.0" of Jason:
http://www.oscommerce.com/community/contributions, the 3432
Principal functionalities are:
- free from 0 to 9 additional images, management in configuration > images > Number of extra images
- creation of an additional table to manage the images (the original database is not modified)
- automatic redimensioning of the images, increased in popup.
Documentation in english, with many screenshot.
Nico
Expand All / Collapse All
the query return zero records when the products_images table don't have the product_id record
I made a modification in the query to get info even if products_images is empty
replace original query
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
by:
$product_info_query = tep_db_query("SELECT
p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity,
p.products_image,pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added,
p.products_date_available, p.manufacturers_id,
pi.products_image1, pi.products_image2, pi.products_image3, pi.products_image4, pi.products_image5,
pi.products_image6, pi.products_image7, pi.products_image8, pi.products_image9
FROM ".TABLE_PRODUCTS." as p
LEFT JOIN ".TABLE_PRODUCTS_DESCRIPTION." as pd ON (pd.products_id = p.products_id)
LEFT JOIN ".TABLE_PRODUCTS_IMAGES." as pi ON (pi.products_id = p.products_id)
WHERE p.products_status = '1'
AND p.products_id = '".(int)$HTTP_GET_VARS['products_id']."'
AND pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
I wasn't able to delete previously added extra images, while editing the product.
There is a typo, read the attached package for info on how to fix this.
Hope it helps,
regards,
Francesco.
There is a bug in the contribution that shows error when adding items with no extra images.
When adding
==================================
unset($sql_data_array);
for($nb=1; $nb <= NB_IMAGE_EXTRA ; $nb++) {
$var_delete_image = "delete_image".$nb;
$var_products_image = "products_image".$nb;
// possibility to delete extra images, but not the standard image
if ($HTTP_POST_VARS[$var_delete_image] == 'yes') {
unlink(DIR_FS_CATALOG_IMAGES_EXTRA.$HTTP_POST_VARS[$var_products_image]);
$sql_data_array[$var_products_image] = tep_db_prepare_input($HTTP_POST_VARS['none']);
}
//end delete image function
else if (isset($HTTP_POST_VARS[$var_products_image]) && tep_not_null($HTTP_POST_VARS[$var_products_image]) && ($HTTP_POST_VARS[$var_products_image] != 'none')) {
$sql_data_array[$var_products_image] = tep_db_prepare_input($HTTP_POST_VARS[$var_products_image]);
}
}
$insert_sql_data = array('products_id' => $products_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
=========================================
in admin/categories.php as part of the installation, replace the end part:
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
with:
if(isset($sql_data_array)) $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
I hope that helps!
Nick
I read this in the support forum....
"It only shows the product's price, description etc. if there is set an extra image! If I have a product without or with only one image it doesn't show the price, description etc.!"
and i write the bug-fix
I change some row of code in the product_info.php, the old query for image data is not the best!!!
It's not a full package, just the instruction modify... at the (i.) point
PS: sorry for my english!!
WARNING.
In the Documentation, modiifction "i" in product_info.
There's a small mistake that cause a synthax error : a "}" not removed...
Attached a doc to fix this.
COMPLETE FILE
Corrections of bugs, add function to erase pictures.
If you've a problem, please use the specific topic in the forum :
http://forums.oscommerce.com/index.php?showtopic=205129
COMPLETE FILE
Only 2 correction (a bug and a forgotten instruction).
If you've a problem, please use the specific topic in the forum :
http://forums.oscommerce.com/index.php?showtopic=205129
There are many contributions to manage several images, but all modify many files, as well as the original database.
I thus decided to write this contribution by basing me on "Three images with admin 1.0" of Jason:
http://www.oscommerce.com/community/contributions, the 3432
Principal functionalities are:
- free from 0 to 9 additional images, management in configuration > images > Number of extra images
- creation of an additional table to manage the images (the original database is not modified)
- automatic redimensioning of the images, increased in popup.
Documentation in english, with many screenshot.
Nico
Note: Contributions are used at own risk.