Zen Cart Logo
Forums / General Questions / Add time to a product type

Add time to a product type

Views: 536

Results 1 to 2 of 2
27 Jan 2013, 6:15 PM
#1
patski avatar

patski

Zen Follower

Join Date:
Nov 2004
Location:
Deal, Kent, UK
Posts:
325
Plugin Contributions:
0

Add time to a product type

Hi

I'm trying to add a time field to a product type. I've got as far as the field showing up on the input field and displaying H:M:S correctly if I add it to the product in phpmyadmin but when I try and update via the admin input screen then it doesn't work (it justs inserts a single digit in the seconds) so I'm guessing that in includes/modules/product_xxx/update_product.php I don't have the right code. Can anyone point me in the right direction please.

Thanks...

27 Jan 2013, 7:24 PM
#2
patski avatar

patski

Zen Follower

Join Date:
Nov 2004
Location:
Deal, Kent, UK
Posts:
325
Plugin Contributions:
0

Re: Add time to a product type

Sorry - supplied information was a bit sketchy!

New field called products_time is added to products_description table.

In admin/includes/modules/product_xxx/product_update.php I have:

$sql_data_array = array('products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
                              'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
                          [B]'products_time' => zen_db_prepare_input($_POST['products_time'][$language_id]),[/B]
                              'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));

      if ($action == 'insert_product') {
        $insert_sql_data = array('products_id' => $products_id,
                                 'language_id' => $language_id);

        $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

        zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
      } elseif ($action == 'update_product') {
        zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
      }
    }

    // add meta tags

I assume this is incorrect and / or in the wrong place. Help gratefully received!