Hello wonderful zencart community. I'm kind of trying to figure out how zen-cart works under the hood. I understand php mostly and things I can't work out I can google and understand but there's two things I can't figure out why they are like they are and I'd love it if someone could explain to me.
Qu 1
in header_php.php (and similar elsewhere) there is a SELECT statement which includes the line:
WHERE categories_id = :categoriesID";
I know the :categoriesID is a placeholder and that a couple of lines later there is:
$categories_products_query = $db->bindVars($categories_products_query, ':categoriesID', $current_category_id, 'integer');
My question is how come the SELECT doesn't just use:
WHERE categories_id =" . $current_category_id "; (or something like that) Surely it's exactly the same thing? Whats the reason?
Qu2
in main_template_vars.php $define_list is created like:
Code:
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
then an array loops through and does:
Code:
$column_list = array(); foreach ($define_list as $key => $value)
{
if ($value > 0) $column_list[] = $key;
}
How $column_list needs to be created this way? Could it not just be written out like the define_list in the first place?
I guess these are really stupid questions but I'm a learner driver and I just don't understand.
Thanks for any tips :)
Bookmarks