Jump to content

Comission on subtotal not total


Recommended Posts

Hello. I am trying the affiliate program on opencart 3.0x . I just noticed, that the comission is being given to the entire order_total, and that includes shipping. Is there way to give comission to the subtotal instead, or to resctict shipping from it somehow?

Thank you.

Link to post
Share on other sites
this:	               
//START AFFILIATE INTEGRATION			
			$jrox = mysqli_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
			$sql = 'SELECT * FROM  `' . DB_PREFIX . 'order` WHERE order_id = ' . (int)$this->session->data['order_id'];
			$jrox2 = mysqli_query($jrox, $sql);
			$aff_data = mysqli_fetch_assoc($jrox2);	
			$aff_integrate = file_get_contents('https://www.somewebsite.com/affiliates/sale/amount/' . $aff_data['total'] . '/trans_id/' . $this->session->data['order_id'] . '/tracking_code/' . $_COOKIE['jamcom']);
			//END AFFILIATE INTEGRATION
Link to post
Share on other sites

this is the answer i got from opencart community. "All line items on the order are stored in the "order_total" table. You can find the relevant lines using the "order_id" column, then loop through the rows you find, and pick the one with code "shipping". The cost of the shipping will be stored in the "value" column.

How do i subtract this from the commission % ?

Link to post
Share on other sites

try:

 

//START AFFILIATE INTEGRATION
$jrox = mysqli_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
$sql = 'SELECT * FROM ' . DB_PREFIX . 'order_total WHERE order_id = ' . (int)$this->session->data['order_id'] . ' AND code = \'sub_total\'';
$jrox2 = mysqli_query($jrox, $sql);
$sub_total = mysqli_fetch_assoc($jrox2);

$aff_integrate = file_get_contents('http://www.yourdomain.com/affiliates/sale/amount/' . $sub_total['value'] . '/trans_id/' . $this->session->data['order_id'] . '/tracking_code/' . $_COOKIE['jamcom']);
//END AFFILIATE INTEGRATION

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...