first added a column to table manufacturer called telephone and edit manufacturer model and now i can set number for each manufacturer, then i edited the catalog/checkout/order.php and add the following codes:
Code: Select all
$product_info_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product` WHERE product_id = '" . (int)$product['product_id'] . "'");
$order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
$manufacturer_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "manufacturer` WHERE manufacturer_id = '" . (int)$pp_query->row['manufacturer_id'] . "'");
Code: Select all
$this->load->model('catalog/manufacturer');
$manufacturer = $this->model_catalog_manufacturer->getManufacturer($product['manufacturer_id']);
if (isset($data['manufacturer'])) {
foreach ($data['manufacturer'] as $manufacturer) {
$this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET manufacturer_id = '" . (int)$manufacturer_id . "', name = '" . $this->db->escape($manufacturer['name']) . "', telephone = '" . $this->db->escape($manufacturer['telephone']));}
}
Code: Select all
foreach ($order_product_query->rows as $result) {
$pro_name = $result['name'];
$pro_quantity = $result['quantity'];
}
foreach ($manufacturer_query->rows as $result) {
$manufacturer_name = $result['name'];
$manufacturer_number = $result['telephone'];
}
$pattern_code = "snuvhlo2nl5440q";
$input_data = array(
"name" => $manufacturer_name,
"order_id" => $order_id,
"status" => $manufacturer_number,
);
$username = "";
$password = '';
$from = "";
$to = array($manufacturer_query->row['telephone']);
$url = "https://webservice.com/patterns/pattern?username=" . $username . "&password=" . urlencode($password) . "&from=".$from."&to=" . json_encode($to) . "&input_data=" . urlencode(json_encode($input_data)) . "&pattern_code=$pattern_code";
$handler = curl_init($url);
curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($handler, CURLOPT_POSTFIELDS, $input_data);
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($handler);
echo $response;
}
else {
echo "nothing else";
}
can somebody help me in this?