Jump to content


Corporate Sponsors


Latest News: (loading..)

jrvs

Member Since 08 May 2006
Offline Last Active Oct 29 2011, 06:55
-----

Posts I've Made

In Topic: Master Products - MS2

29 October 2011, 06:51

Thank you so much for your reply.

$Id: advanced_search_result.php,v 1.72 2003/06/23

Advanced_search_results.php is such an odd document. The $select, $from and $where_str statements are separated in portions. I know that the issue lies solely in:

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

The above displays all slaves – which sometimes are over 20 slaves per master. See Scientiis.com

$where_str = " where p.products_status = '1' and p.products_master = '0' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

The above displays the master, but does not search the slaves. Searching for a slave model gives " There is no product that matches the search criteria."

Maybe if I could adapt somehow the following:

// Master Products
$master_prod = tep_db_query("select products_master, products_master_status
from " . TABLE_PRODUCTS . "
where products_id = '" . $products_master['products_id'] . "'");
$master_prod_values = tep_db_fetch_array($master_prod);

if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) {
$str_selected_values = $master_prod_values['products_master'];
} else {
$str_selected_values = $products_master['products_id'];
}

Tried adapting the following, but received errors

if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
}

There is also this function in /includes/functions/general.php

// Master Products
function tep_get_products_master_status($product_id) {

$product_query = tep_db_query("select products_master_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
$product = tep_db_fetch_array($product_query);

return $product['products_master_status'];
}
// Master Products EOF

By the way, I'm not a programmer.

Thank you again.

In Topic: Master Products - MS2

28 October 2011, 11:08

Posted 17 February 2004, 17:38

In catalog/advanced_search_result.php change:

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

to:

$where_str = " where p.products_status = '1' and p.products_master = '0' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

This only works if the Master has the search term - a better solution is to have the result return the Master if the search term is found within the Slave - something I shall get around to I am sure.

Matti Ressler
-----


I need to modify the $where_str code so that so that it searches all the slaves products_id and displays the master. Currently is either all slaves or only the masters (p.products_master = 0). Perhaps:

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

if (isset($HTTP_GET_VARS['products_master_status'] == 0) && (isset($HTTP_GET_VARS ['products_master'] != 0))) {
$where_str .= " or p.products_master = '" . (int)$HTTP_GET_VARS['products_id'] . "'";
}

Parse error: syntax error, unexpected T_IS_EQUAL, expecting ',' or ')'

I would greatly appreciate your assistance – struggling for a couple of years with this issue.