Post by feedermania » Fri Feb 21, 2020 4:25 pm

Hello. I have a discount line what is in the oc_customer table.
Name: discount
Type: float(16,2)
Value: 33.33
I have an XML Order Export and i want to display that value. I see the DISCOUNT line but the velue not visible.

Code: Select all

$export_items['xml_export_order_items'][] = 'products';

    $sql = "SELECT * FROM `" . DB_PREFIX . "order`";
    
    if(isset($filter_sql)){
      $sql .= " WHERE ".implode(" AND ",$filter_sql);
    }

		$query = $this->db->query($sql);
		if($query->rows){
    foreach($query->rows as $order){
	  $xml .= '<ORDER>'."\n";if($item == 'discount'){$xml .= '<DISCOUNT>'.htmlspecialchars($order['discount']).'</DISCOUNT>'."\n";}

New member

Posts

Joined
Mon Jul 30, 2018 2:48 am

Post by letxobnav » Fri Feb 21, 2020 5:04 pm

Code: Select all

if($item == 'discount')
Don't know where $item comes from.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by letxobnav » Sat Feb 22, 2020 2:31 am

I have a discount line what is in the oc_customer table.
Name: discount
Type: float(16,2)
Value: 33.33
yet you query the oc_order table.
Then you want to add the <DISCOUNT>........</DISCOUNT> XML with the value of the discount field from the order table in there when $item == 'discount'.
yet, the order table does not have a "discount" field and nowhere (at least not in the code you posted) is the variable $item defined.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by feedermania » Sun Feb 23, 2020 3:53 am

okay i see. and how to query the customer table too with the order table? i want only the discount value from customer table :S

New member

Posts

Joined
Mon Jul 30, 2018 2:48 am

Post by straightlight » Sun Feb 23, 2020 7:16 pm

Please stop creating topics about the same requests!

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 10 guests