Can someone PLEASSSSSEEEEEE help me.
I am merging SPPC and Option Type V2 and All is well however, I need to know how to merge these two sections:
Section 1:
************************************************************************
if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
$check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$check_product = tep_db_fetch_array($check_product_query);
if (($check_product !== false) && ($check_product['products_status'] == '1')) {
if ($notify == true) {
************************************************************************
Section 2:
************************************************************************
if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
// BOF SPPC attribute hide check, original query expanded to include attributes
$check_product_query = tep_db_query("select p.products_status, options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'");
while ($_check_product = tep_db_fetch_array($check_product_query)) {
$check_product[] = $_check_product;
} // end while ($_check_product = tep_db_fetch_array($check_product_query))
$no_of_check_product = count($check_product);
if (is_array($attributes)) {
foreach($attributes as $attr_option => $attr_option_value) {
$valid_option = '0';
for ($x = 0; $x < $no_of_check_product ; $x++) {
if ($attr_option == $check_product[$x]['options_id'] && $attr_option_value == $check_product[$x]['options_values_id']) {
$valid_option = '1';
if ($check_product[$x]['hide_attr_status'] == '1') {
// delete hidden attributes from array attributes
unset($attributes[$attr_option]);
}
} // end if ($attr_option == $check_product[$x]['options_id']....
} // end for ($x = 0; $x < $no_of_check_product ; $x++)
if ($valid_option == '0') {
// after having gone through the options for this product and not having found a matching one
// we can conclude that apparently this is not a valid option for this product so remove it
unset($attributes[$attr_option]);
}
} // end foreach($attributes as $attr_option => $attr_option_value)
} // end if (is_array($attributes))
// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
$products_id_string = tep_get_uprid($products_id, $attributes);
if ((isset($check_product) && tep_not_null($check_product)) && ($check_product[0]['products_status'] == '1')) {
// EOF SPPC attribute hide check
if ($notify == true) {
***********************************************************************
If I use Section 1 only the product in the cart adds to the quantity and keeps only one attribute, however if I use Section 2 only the attributes dissapear in cart.
Please HELP!!!!!!!!