function xtc_get_products($session) { if (!is_array($session)) { return false; } $products_array = array(); reset($session); //BOF - Dokuman - 2009-11-30 - check for array in cart if (is_array($session['cart']->contents)) { //EOF - Dokuman - 2009-11-30 - check for array in cart while (list($products_id, ) = each($session['cart']->contents)) { $products_query = xtc_db_query("select p.products_id, pd.products_name,p.products_image, p.products_model, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . xtc_db_input((int) xtc_get_prid($products_id)) . "' and pd.products_id = p.products_id and pd.language_id = '" . xtc_db_input((int) $_SESSION['languages_id']) . "'"); if ($products = xtc_db_fetch_array($products_query)) { $prid = $products['products_id']; // dirty workaround $xtPrice = new xtcPrice($session['currency'], $session['customers_status']['customers_status_id']); $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, $session['cart']->contents[$products_id]['qty'], $products['products_tax_class_id'], $products['products_price']); $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price + attributes_price($products_id, $session), 'quantity' => $session['cart']->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + attributes_price($products_id, $session), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $session['contents'][$products_id]['attributes']); } } return $products_array; } return false; //Dokuman - 2009-11-30 - check for array in cart }
function vam_get_products($session) { if (!is_array($session)) { return false; } $products_array = array(); reset($session); if (is_array($session['cart']->contents)) { while (list($products_id, ) = each($session['cart']->contents)) { $products_query = vam_db_query("select p.products_id, pd.products_name,p.products_image, p.products_model, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . vam_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "'"); if ($products = vam_db_fetch_array($products_query)) { $prid = $products['products_id']; // dirty workaround $vamPrice = new vamPrice($session['currency'], $session['customers_status']['customers_status_id'], $_SESSION['customer_id'] ? $_SESSION['customer_id'] : ""); $products_price = $vamPrice->GetPrice($products['products_id'], $format = false, $session['cart']->contents[$products_id]['qty'], $products['products_tax_class_id'], $products['products_price']); $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price + attributes_price($products_id, $session), 'quantity' => $session['cart']->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + attributes_price($products_id, $session), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $session['contents'][$products_id]['attributes']); } } return $products_array; } return false; }