So I'm setting up a test store with the latest version of Zen. The Whats New sidebox has changed in 1.3.9, and I want to make sure that what I propose to add to the query to make hideCategories work with this sidebox is correct.. Left joins confuse me a tad.. So I am hoping someone could take a peek and "grade my homework" so to speak.. So here's what's going on:
Old What's New query
Code:
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p
where p.products_status = 1 " . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
Current What's New query
Code:
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,
p.master_categories_id
from (" . TABLE_PRODUCTS . " p
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 " . $display_limit;
Old What's New query with hideCategories changes
Code:
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price
from " . TABLE_PRODUCTS . " p, " . TABLE_HIDE_CATEGORIES . " h
where p.products_status = 1
and (p.master_categories_id = h.categories_id and h.visibility_status !=2)
" . $display_limit . "
limit " . MAX_RANDOM_SELECT_NEW;
Proposed What's New query with hideCategories changes
(See highlighted in blue below -- is this the correct syntax??)
Code:
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,
p.master_categories_id
from (" . TABLE_HIDE_CATEGORIES . " h, " . TABLE_PRODUCTS . " p
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and (p.master_categories_id = h.categories_id and h.visibility_status !=2)
and p.products_status = 1 " . $display_limit;
Bookmarks