Here's what I got so far. I added two products with same model number, different price and name for testing.
Here's extra cart action
Code:
if (isset($_GET['action']) && $_GET['action']=='buy_now' && isset($_GET['m']) && isset($_GET['aribrand']) && !isset($_GET['products_id']))
{
$sql= "select products_id from " . TABLE_PRODUCTS . " where products_model = :themodel:";
$sql= "select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = :brand:";
$sql = $db->bindvars($sql, ':themodel:', $_GET['m'], 'string');
$sql = $db->bindvars($sql, ':brand:', $_GET['aribrand'], 'string');
$lookup = $db->Execute($sql);
if ($lookup->RecordCount() == 1)
{
$_GET['products_id'] = $lookup->fields['products_id'];
unset($_GET['aribrand']);
unset($_GET['m']);
zen_redirect(zen_href_link($goto, zen_get_all_get_params('m')));
}
}
?>
if I use this string
Code:
index.php?action=buy_now&m=aaa111sss&aribrand=17
it adds product by its manufacturer and model. But when using other manufacturer it's not adding anything to cart
Code:
index.php?action=buy_now&m=aaa111sss&aribrand=4
Another question I ran in to is, how can I define that manufacturers_id = 17 = EXM?