Four entries required in SQL, not two, and I now have a problem with main_template_vars.php:
Code:
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_MAIN_TEMPLATE_VARS_START_PRODUCT_INFO');
$module_show_categories = PRODUCT_INFO_CATEGORIES;
$sql = "select count(*) as total
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
$res = $db->Execute($sql);
if ( $res->fields['total'] < 1 ) {
$tpl_page_body = '/tpl_product_info_noproduct.php';
} else {
$tpl_page_body = '/tpl_product_info_display.php';
$sql = "update " . TABLE_PRODUCTS_DESCRIPTION . "
set products_viewed = products_viewed+1
where products_id = '" . (int)$_GET['products_id'] . "'
and language_id = '" . (int)$_SESSION['languages_id'] . "'";
$res = $db->Execute($sql);
$sql = "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, p.products_quantity,
p.products_weight, p.products_priced_by_attribute, p.product_is_free,
p.products_length, p.products_priced_by_attribute, p.product_is_free,
p.products_qty_box_status,
p.products_quantity_order_max,
p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
$product_info = $db->Execute($sql);
$products_price_sorter = $product_info->fields['products_price_sorter'];
$products_price = $currencies->display_price($product_info->fields['products_price'],
zen_get_tax_rate($product_info->fields['products_tax_class_id']));
$manufacturers_name= zen_get_products_manufacturers_name((int)$_GET['products_id']);
if ($new_price = zen_get_products_special_price($product_info->fields['products_id'])) {
$specials_price = $currencies->display_price($new_price,
zen_get_tax_rate($product_info->fields['products_tax_class_id']));
}
The addition of this line:
Code:
p.products_length, p.products_priced_by_attribute, p.product_is_free,
seems to be behind this problem:
Code:
1054 Unknown column 'p.products_length' in 'field list'
in:
[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, p.products_quantity, p.products_weight, p.products_priced_by_attribute, p.product_is_free, p.products_length, p.products_priced_by_attribute, p.product_is_free, p.products_qty_box_status, p.products_quantity_order_max, p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter from products p, products_description pd where p.products_status = '1' and p.products_id = '5' and pd.products_id = p.products_id and pd.language_id = '1']
...which wouldn't be a problem if I could work out what needs to be fixed/amended/updated in order to fix it...