Skip to main content

Correct way to pass field data to my script?

More
13 years 1 month ago #116797 by eleventy
-- HikaShop version -- : 2.2.0
-- Joomla version -- : 3.1.4
-- PHP version -- : 5.3.27

Hi guys

I am beginning an exciting journey in Hikashop custom plugin development! Yay! B)

I have a basic function like this:
Code:
class plgHikashopkf_insert extends JPlugin { function plgHikashopKashflow(&$subject, $config){ parent::__construct($subject, $config); if(!isset($this->params)){ $plugin =& JPluginHelper::getPlugin('hikashop', 'kf_insert'); jimport('joomla.html.parameter'); $this->params = new JParameter( $plugin->params ); } } function onAfterOrderCreate(&$order,&$send_email){ if(!empty($order->order_id)){ $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $from = "no_replies_please@********.co.uk"; $headers .= "From:".$from; $email_add = '*******.net'; $subject = 'Test'; mysql_connect("localhost", "**********", "************") or die(mysql_error()); mysql_select_db("****************") or die(mysql_error()); $order_id = $order->order_id; $order_user_id = mysql_result(mysql_query("SELECT order_user_id FROM nl7xh_hikashop_order WHERE '".$order_id."' = order_id ;"), 0); $user_email_add = mysql_result(mysql_query("SELECT user_email FROM nl7xh_hikashop_user WHERE '".$order_user_id."' = user_id ;"), 0); $order_shipping_address_id = mysql_result(mysql_query("SELECT user_email FROM nl7xh_hikashop_user WHERE '".$order_user_id."' = user_id ;"), 0); $message = "User ID: $order_user_id Email: $user_email_add;"; //etc mail($email_add, $subject, $message, $headers); } return true; } }

Is using queries a good or bad way to get the field data from multiple tables into my script? Is there an easier way? I guess my main problem is I don't understand how to make use of the $order object properly?

Any help would be marvellous :)

All the best
Eleventy

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago #116812 by eleventy
I am a NOOOOOOB!

I get it now. I load the class for each table.

Sorry to waste your time. We all need to start somewhere :)

Please Log in or Create an account to join the conversation.

More
13 years 1 month ago - 13 years 1 month ago #116829 by Eliot
Gald to see you found the solution!
Enjoy your development and do not hesitate if you have any questions ;)
Last edit: 13 years 1 month ago by Eliot.

Please Log in or Create an account to join the conversation.

Time to create page: 0.191 seconds
Powered by Kunena Forum