Re: ozpost shipping module
Hey rod,
I assumed that the files were being overwritten with the new code.
You are correct in saying I can view existing products with dimensions in them. I haven't tried to edit them in case hey get overwritten, but I guess if it was saving the data to the tables, we wouldn't be having this problem. :D
Dangerous goods field DOES exist.
I'm comfortable with the code, I understand it but cant program from scratch. So fire away and I will test for you. I will modify the file with what you have given me and provide a report shortly.
Re: ozpost shipping module
Quote:
Originally Posted by
wakeleymb
You are correct in saying I can view existing products with dimensions in them. I haven't tried to edit them in case hey get overwritten, but I guess if it was saving the data to the tables, we wouldn't be having this problem. :D
I'm guessing that if you did try to edit them it would have no effect. The changes won't be apploed, and the existing data wouldn't be zeroed out.
Quote:
Originally Posted by
wakeleymb
Dangerous goods field DOES exist.
Good news at last. This is suggesting that it is only the one file (update_products.php) that isn't being filly patched.
Quote:
Originally Posted by
wakeleymb
I will modify the file with what you have given me and provide a report shortly.
If you haven't done this already, I suspect that if you uninstall ozpost (via the admin screen) then replace your update_product.php file with a Zencart original and try the installation again then the correct patching/update will take place.
If this is the case, it will confirm my suspicion that this files has been modified by something else at some stage and that is what is causing the failure.
If this suspicion is correct I will somehow need to figure out what those changes were so that I can take them into account with the next update.
Hhhhm... lots of guessing and 'if's" going on here.
I appreciate your help and feedback in this matter.
Cheers
RodG
Re: ozpost shipping module
Hi Rodg
pls remember that we had your add-on installed by some one else I have checked the files as you asked and the following is my findings
/YOURADMIN/includes/modules/product/collect_info.php_ozpRestore this does not exist in fact the folder called product is not there either.
/YOURADMIN/includes/languages/english.php_ozpRestore this one does exist
Does the FOLDER /cache/ozpost/ exist? not there
YOURADMIN/includes/modules/update_product.php no such file
as I said I didn't install it
regards
john
Re: ozpost shipping module
Quote:
Originally Posted by
Catching Angels
pls remember that we had your add-on installed by some one else
I'm an old man. My memory isn't what it used to be <g>
Quote:
Originally Posted by
Catching Angels
I have checked the files as you asked and the following is my findings
/YOURADMIN/includes/modules/product/collect_info.php_ozpRestore this does not exist in fact the folder called product is not there either.
OK, I can understand the ozpRestore file not existing, but how the heck does your store function without the /product/ folder???????
Quote:
Originally Posted by
Catching Angels
YOURADMIN/includes/modules/update_product.php no such file
This can't be right either. Hmm, This could be explained if you are looking specifically for "YOURADMIN" rather than the actual name of your admin folder (which mustn't be revealed).
Either way, since it seems that you probably aren't up to making code changes, and that a definitive solution hasn't been found yet, you can either wait until a solution has been found and a new update made available OR for a more speedy fix please go to
http://shop.vcsweb.com/index.php?mai...roducts_id=219 and fill in the order details. Select Cheque or money order as your payment method, but DO NOT PAY. I will head over to your site and fix the issue for you (and this will also aid me in identifying exactly where things are going wrong so that I can provide a proper fix for the few others that are now reporting the same problem).
Cheers
RodG
Re: ozpost shipping module
Those lines you typed out don't exist. I've cut and pasted the UPDATE_PRODUCT.PHP file for you to have a look at. I'm going to insert the code and see what happens.
<?php
/**
* @package admin
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: update_product.php 15636 2010-03-07 07:00:40Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (isset($_GET['pID'])) $products_id = zen_db_prepare_input($_GET['pID']);
if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) {
$action = 'new_product';
} elseif ($_POST['products_model'] . $_POST['products_url'] . $_POST['products_name'] . $_POST['products_description'] != '') {
$products_date_available = zen_db_prepare_input($_POST['products_date_available']);
$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
// Data-cleaning to prevent MySQL5 data-type mismatch errors:
$tmp_value = zen_db_prepare_input($_POST['products_quantity']);
$products_quantity = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['products_price']);
$products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['products_weight']);
$products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$dangerous_goods = (($_POST['dangerous_goods']) == 1) ? 1:0;
$tmp_value = zen_db_prepare_input($_POST['manufacturers_id']);
$manufacturers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$sql_data_array = array('products_quantity' => $products_quantity,
'products_type' => zen_db_prepare_input($_GET['product_type']),
'products_model' => zen_db_prepare_input($_POST['products_model']),
'products_price' => $products_price,
'products_date_available' => $products_date_available,
'products_weight' => $products_weight,
'products_height' => $products_height,
'products_width' => $products_width,
'products_length' => $products_length,
'dangerous_goods' => $dangerous_goods,
'products_status' => zen_db_prepare_input((int)$_POST['products_status']),
'products_virtual' => zen_db_prepare_input((int)$_POST['products_virtual']),
'products_tax_class_id' => zen_db_prepare_input((int)$_POST['products_tax_class_id']),
'manufacturers_id' => $manufacturers_id,
'products_quantity_order_min' => zen_db_prepare_input($_POST['products_quantity_order_min']),
'products_quantity_order_units' => zen_db_prepare_input($_POST['products_quantity_order_units']),
'products_priced_by_attribute' => zen_db_prepare_input($_POST['products_priced_by_attribute']),
'product_is_free' => zen_db_prepare_input((int)$_POST['product_is_free']),
'product_is_call' => zen_db_prepare_input((int)$_POST['product_is_call']),
'products_quantity_mixed' => zen_db_prepare_input($_POST['products_quantity_mixed']),
'product_is_always_free_shipping' => zen_db_prepare_input((int)$_POST['product_is_always_free_shipping']),
'products_qty_box_status' => zen_db_prepare_input($_POST['products_qty_box_status']),
'products_quantity_order_max' => zen_db_prepare_input($_POST['products_quantity_order_max']),
'products_sort_order' => (int)zen_db_prepare_input($_POST['products_sort_order']),
'products_discount_type' => zen_db_prepare_input($_POST['products_discount_type']),
'products_discount_type_from' => zen_db_prepare_input($_POST['products_discount_type_from']),
'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter'])
);
// 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';
}
if ($_POST['image_delete'] == 1) {
$sql_data_array['products_image'] = '';
$new_image= 'false';
}
if ($action == 'insert_product') {
$insert_sql_data = array( 'products_date_added' => 'now()',
'master_categories_id' => (int)$current_category_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
zen_db_perform(TABLE_PRODUCTS, $sql_data_array);
$products_id = zen_db_insert_id();
// reset products_price_sorter for searches etc.
zen_update_products_price_sorter($products_id);
$db->Execute("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . "
(products_id, categories_id)
values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
//// *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
///////////////////////////////////////////////////////
} elseif ($action == 'update_product') {
$update_sql_data = array( 'products_last_modified' => 'now()',
'master_categories_id' => ($_POST['master_category'] > 0 ? zen_db_prepare_input($_POST['master_category']) : zen_db_prepare_input($_POST['master_categories_id'])));
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
// reset products_price_sorter for searches etc.
zen_update_products_price_sorter((int)$products_id);
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
//// *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
///////////////////////////////////////////////////////
}
$languages = zen_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$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]),
'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
$languages = zen_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));
if ($action == 'insert_product_meta_tags') {
$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_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array);
} elseif ($action == 'update_product_meta_tags') {
zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
}
}
// future image handler code
define('IMAGE_MANAGER_HANDLER', 0);
define('DIR_IMAGEMAGICK', '');
if ($new_image == 'true' and IMAGE_MANAGER_HANDLER >= 1) {
$src= DIR_FS_CATALOG . DIR_WS_IMAGES . zen_get_products_image((int)$products_id);
$filename_small= $src;
preg_match("/.*\/(.*)\.(\w*)$/", $src, $fname);
list($oiwidth, $oiheight, $oitype) = getimagesize($src);
$small_width= SMALL_IMAGE_WIDTH;
$small_height= SMALL_IMAGE_HEIGHT;
$medium_width= MEDIUM_IMAGE_WIDTH;
$medium_height= MEDIUM_IMAGE_HEIGHT;
$large_width= LARGE_IMAGE_WIDTH;
$large_height= LARGE_IMAGE_HEIGHT;
$k = max($oiheight / $small_height, $oiwidth / $small_width); //use smallest size
$small_width = round($oiwidth / $k);
$small_height = round($oiheight / $k);
$k = max($oiheight / $medium_height, $oiwidth / $medium_width); //use smallest size
$medium_width = round($oiwidth / $k);
$medium_height = round($oiheight / $k);
$large_width= $oiwidth;
$large_height= $oiheight;
$products_image = zen_get_products_image((int)$products_id);
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = preg_replace('/'.$products_image_extension.'/', '', $products_image);
$filename_medium = DIR_FS_CATALOG . DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . '.' . $fname[2];
$filename_large = DIR_FS_CATALOG . DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . '.' . $fname[2];
// ImageMagick
if (IMAGE_MANAGER_HANDLER == '1') {
copy($src, $filename_large);
copy($src, $filename_medium);
exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $large_width . " " . $filename_large);
exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $medium_width . " " . $filename_medium);
exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $small_width . " " . $filename_small);
}
}
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
} else {
$messageStack->add_session(ERROR_NO_DATA_TO_SAVE, 'error');
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
}
Re: ozpost shipping module
COLLECT_INFO.PHP does not have those lines either. Will be inserting them now.
Re: ozpost shipping module
I tried to manually enter those lines of code in and when i try to go in and edit an existing product, it just gives me a blank screen. (Collect_Info.PHP). So i removed the code.
Then when I try to complete an edited product, I get a WEBPAGE EXPIRED message in Explorer. So I'm going to redownload the ZenCart and replace the UPDATE_PRODUCT.PHP, remove OzPost and reinstall and see how that goes.
Re: ozpost shipping module
Quote:
Originally Posted by
wakeleymb
Those lines you typed out don't exist. I've cut and pasted the UPDATE_PRODUCT.PHP file for you to have a look at.
Thanks for that. The cut n paste shows that *some* of the needed lines have been added, but not all of them.
These are the ones that are missing. I shall use what you have supplied to try to figure out why it is failing.
$tmp_value = zen_db_prepare_input($_POST['products_height']); $products_height = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; $tmp_value = zen_db_prepare_input($_POST['products_width']); $products_width = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; $tmp_value = zen_db_prepare_input($_POST['products_length']); $products_length = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value; $dangerous_goods = (($_POST['dangerous_goods']) == 1) ? 1:0 ;
Re: ozpost shipping module
Quote:
Originally Posted by
wakeleymb
COLLECT_INFO.PHP does not have those lines either. Will be inserting them now.
Are you *sure* about that? If those lines are missing I don't think it would be able to obtain the dimensions from existing products, which is contrary to your previous report???
Cheers
RodG
Re: ozpost shipping module
Quote:
Originally Posted by
wakeleymb
I tried to manually enter those lines of code in and when i try to go in and edit an existing product, it just gives me a blank screen. (Collect_Info.PHP). So i removed the code.
Based on your previous feedback, the collect_info.php file didn't need any further modification, so if you somehow managed to duplicate what was already there the blank screen results don't come as much of a surprise.
In short, I think (I'm sure) that you've taken a step backwards by doing this. :(
Quote:
Originally Posted by
wakeleymb
Then when I try to complete an edited product, I get a WEBPAGE EXPIRED message in Explorer.
Now you are really confusing me. If the changes you made to the collect_info.php causes a blank screen, then how can you try to 'complete an edited product'?
Quote:
Originally Posted by
wakeleymb
So I'm going to redownload the ZenCart and replace the UPDATE_PRODUCT.PHP, remove OzPost and reinstall and see how that goes.
Alert: Order is important. You must remove/uninstall ozpost via the admin menu BEFORE replacing the update_product.php file. If you do it in reverse order, the ozpost uninstaller will replace the newly copied file with its own backup file so when you re-install ozpost again it will be trying to update the same file that it is already having troubles with (not your newly copied file, which will be simply deleted).
You can negate this behaviour by deleting the ozpRestore files before uninstalling/re-installing ozpost itself. If ozpost can't find its backup files it will leave whatever files that do exist alone, regardless of whether they are ZenCart originals or something that has been modified by another add-on.
I can appreciate that all of this may appear convoluted, because it is, but the purpose of doing it this way is so that the ozpost module can install or remove itself without affecting any changes made by other modules and to avoid the need for any manual merging. Until this latest update the system has worked well.
I could supply you with ozpost modified files to replace your existing ones and the ozpost problem will be solved, but in doing so, if your existing files have already been modified by something else, it will break whatever that 'something else' was.
It is this 'something else' that I need to determine and account for.
Cheers
RodG