Forums / Bug Reports / [Done v1.3.8] Image filename not saved in product table

[Done v1.3.8] Image filename not saved in product table

Locked

Views: 2,152

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
4 Mar 2007, 12:33 AM
#1
georgealter avatar

georgealter

New Zenner

Join Date:
Feb 2007
Posts:
6
Plugin Contributions:
0

[Done v1.3.8] Image filename not saved in product table

Version 1.3.7

This is not necessarily a bug, but an inconvenience -- the image filename (products_image) is not saved in the products table if the string "none" appears anywhere in the filename. So, for example, "none-of_the_above.jpg" would not be saved even though it is shown on the preview page. The user is not alerted.

The code that causes this is in admin/includes/modules/update_product.php on line 57:

if (isset($_POST['products_image']) && zen_not_null($_POST['products_image']) && (!is_numeric(strpos($_POST['products_image'],'none'))) ) {

I have no suggestion for a fix, since I don't know the reasoning for going to this line from the previous, which only checked if the full name was "none".

The test Was: $_POST['products_image'] != 'none'
The test Is: !is_numeric(strpos($_POST['products_image'],'none'))

4 Mar 2007, 1:15 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: [Done v1.3.8] Image filename not saved in product table

fussy ... fussy ... fussy ... :lamo:

Silly me ... I should have just taken out that code when I switched it to the radio button since most browsers now cannot take the text in the field ...

Original code in the files:
/admin/includes/modules/update_product.php
/admin/includes/modules/product_music/update_product.php

locate the code:

    // when set to none remove from database
    // if (isset($_POST['products_image']) && zen_not_null($_POST['products_image']) && ($_POST['products_image'] != 'none')) {
    if (isset($_POST['products_image']) && zen_not_null($_POST['products_image']) && (!is_numeric(strpos($_POST['products_image'],'none'))) ) {
      $sql_data_array['products_image'] = zen_db_prepare_input($_POST['products_image']);
      $new_image= 'true';
    } else {
      $sql_data_array['products_image'] = '';
      $new_image= 'false';
    }

Change the code to:

    // when set to none remove from database
    // is out dated for browsers use radio only
      $sql_data_array['products_image'] = zen_db_prepare_input($_POST['products_image']);
      $new_image= 'true';

    if ($_POST['image_delete'] == 1) {
      $sql_data_array['products_image'] = '';
      $new_image= 'false';
    }

Thanks for the update! :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!