glenskie16 Posted March 20, 2014 Share Posted March 20, 2014 (edited) I have this query that runs and i have tested it and i seems to work untill it is set to a variable ? or maybe it's just prestashop rejecting it ? but here is my query on mail.php and it is supposed to be set to the variables and passed on but idk what is wrong with it ? /* don't attach the logo as */if (isset($logo)) // setting the order id to a variable $order_id = $template_vars['{order_name}']; // Query to find the product id for the current order and then set it to a variable $query="SELECT product_id FROM ps_order_detail WHERE id_order = $order_id"; $result = mysql_query($query); $row = mysql_fetch_row($result); $Product_id = $row['0']; // get all the custom part numbers and set them to the variables $customnumbers ="SELECT API, SWAIM, JOHN_CRANE, SNOW_WELL, MIDAS, QUINN, WILSON, WEATHERFORD, HF, BLACK_GOLD, EDI, SO_CAL_PUMPS, WEST_RIVER FROM ps_product_part_number WHERE Product_ID = $Product_id"; $secondresult = mysql_query($customnumbers); $secondrow = mysql_fetch_row($secondresult); $API = $secondrow['0']; $SWAIM = $secondrow['1']; $JOHN_CRANE = $secondrow['2']; $SNOW_WELL = $secondrow['3']; $MIDAS = $secondrow['4']; $QUINN = $secondrow['5']; $WILSON = $secondrow['6']; $WEATHERFORD = $secondrow['7']; $HF = $secondrow['8']; $BLACK_GOLD = $secondrow['9']; $EDI = $secondrow['10']; $SO_CAL_PUMPS = $secondrow['11']; $WEST_RIVER = $secondrow['12']; $template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo))); $template_vars['{API}'] = $API; $template_vars['{test}'] = $order_id; $template_vars['{SWAIM}'] = $SWAIM; for some reason $template_vars['{test'}] = $order_id works ? but $API and $SWAIM doesnt ? Edited March 20, 2014 by glenskie16 (see edit history) Link to comment Share on other sites More sharing options...
glenskie16 Posted March 20, 2014 Author Share Posted March 20, 2014 no one ? Link to comment Share on other sites More sharing options...
glenskie16 Posted March 20, 2014 Author Share Posted March 20, 2014 i tried this on th order history .php and nothing still if (isset($result['template']) && Validate::isEmail($result['email'])) { $order_id = '1'; // Query to find the product id for the current order and then set it to a variable $query="SELECT product_id FROM ps_order_detail WHERE id_order = $order_id"; $result1 = mysql_query($query); $row = mysql_fetch_row($result1); $Product_id = $row['0']; // get all the custom part numbers and set them to the variables $customnumbers ="SELECT API, SWAIM, JOHN_CRANE, SNOW_WELL, MIDAS, QUINN, WILSON, WEATHERFORD, HF, BLACK_GOLD, EDI, SO_CAL_PUMPS, WEST_RIVER FROM ps_product_part_number WHERE Product_ID = $Product_id"; $secondresult = mysql_query($customnumbers); $secondrow = mysql_fetch_row($secondresult); $API = $secondrow['0']; $SWAIM = $secondrow['1']; $JOHN_CRANE = $secondrow['2']; $SNOW_WELL = $secondrow['3']; $MIDAS = $secondrow['4']; $QUINN = $secondrow['5']; $WILSON = $secondrow['6']; $WEATHERFORD = $secondrow['7']; $HF = $secondrow['8']; $BLACK_GOLD = $secondrow['9']; $EDI = $secondrow['10']; $SO_CAL_PUMPS = $secondrow['11']; $WEST_RIVER = $secondrow['12']; $topic = $result['osname']; $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{api}' => $API, '{order_name}' => $order->getUniqReference() ); Link to comment Share on other sites More sharing options...
Recommended Posts