$quote->column_fields["quotestage"] = $stage_array[$i]; $quote->column_fields["carrier"] = $carrier_array[$i]; $quote->column_fields["validtill"] = $validtill_array[$i]; $quote->column_fields["bill_street"] = $street_address_array[rand(0, $street_address_count - 1)]; $quote->column_fields["bill_city"] = $city_array[rand(0, $city_array_count - 1)]; $quote->column_fields["bill_state"] = "CA"; $quote->column_fields["bill_code"] = rand(10000, 99999); $quote->column_fields["bill_country"] = 'USA'; $quote->column_fields["ship_street"] = $account->column_fields["bill_street"]; $quote->column_fields["ship_city"] = $account->column_fields["bill_city"]; $quote->column_fields["ship_state"] = $account->column_fields["bill_state"]; $quote->column_fields["ship_code"] = $account->column_fields["bill_code"]; $quote->column_fields["ship_country"] = $account->column_fields["bill_country"]; $quote->column_fields["currency_id"] = '1'; $quote->column_fields["conversion_rate"] = '1'; $quote->save("Quotes"); $quote_ids[] = $quote->id; $product_key = array_rand($product_ids); $productid = $product_ids[$product_key]; //set the inventory product details in request then just call the saveInventoryProductDetails function $_REQUEST['totalProductCount'] = 1; $_REQUEST['hdnProductId1'] = $productid; $_REQUEST['qty1'] = $qty = 1; $_REQUEST['listPrice1'] = $listprice = 130; $_REQUEST['comment1'] = "This is test comment for product of Quotes"; $_REQUEST['deleted1'] = 0; $_REQUEST['discount_type1'] = 'amount'; $_REQUEST['discount_amount1'] = $discount_amount = '20'; $_REQUEST['taxtype'] = $taxtype = 'individual'; $_REQUEST['subtotal'] = $subtotal = $qty * $listprice - $discount_amount; $_REQUEST['discount_type_final'] = 'amount';
if (!pb_strcomp($_POST['quote']['product_name'], $_POST['product_name'])) { $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['quote']['product_name'] . "'"); } else { $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['product_name'] . "'"); } } $trend['x'] = PbController::convertTextToArray($_POST['trend_data']['x']); $trend['y'] = PbController::convertTextToArray($_POST['trend_data']['y']); $vals['trend_data'] = serialize($trend); $vals['area_id'] = $vals['area_id3']; if (!empty($vals['content'])) { $vals['content'] = stripcslashes($vals['content']); } if (!empty($id)) { $vals['modified'] = $time_stamp; $result = $marketquotes->save($vals, "update", $id); } else { $vals['created'] = $vals['modified'] = $time_stamp; $result = $marketquotes->save($vals); } if (!$result) { flash(); } else { flash("success"); } } $amount = $marketquotes->findCount(null, $conditions); $page->setPagenav($amount); $joins[] = "LEFT JOIN {$tb_prefix}markets m ON m.id=Quote.market_id"; $fields = "Quote.id,m.name AS marketname,Quote.title AS title,Quote.max_price AS maxprice,Quote.min_price AS minprice"; $result = $marketquotes->findAll($fields, $joins, $conditions, "Quote.id DESC", $page->firstcount, $page->displaypg);