Post by drbyte » Sat Oct 12, 2013 10:59 am

Hi esmond,

Sorry running to little issue here with the totals,

Coupon total. The code works with total amounts but it does not apply the coupon discount. If you can help with this will be much appreciated.

Thank you

Sam

New member

Posts

Joined
Sun Jan 01, 2012 7:20 pm

Post by MarketInSG » Sat Oct 12, 2013 11:07 am

Try opening another topic in the future so it is much easier for other users to follow.

If you're looking at coupon, you must ensure you have enabled the order total module in extensions > order total.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by drbyte » Sat Oct 12, 2013 11:21 am

Thanks, It's on

It's the same pepperjam code that we are trying to implement. Sorry I was not clear

Code: Select all

$output .= '&AMOUNT' . $count . '=' . $result['total'];
I think this is what they are looking for

Code: Select all

echo $order['order_total']; 
The above is the total of each item before the discount, but when the coupon is applied, it does not deduct for that item total.

Would that be another db->query?

Do you want me to open another topic or continue with this?

Thanks

New member

Posts

Joined
Sun Jan 01, 2012 7:20 pm

Post by MarketInSG » Sat Oct 12, 2013 11:28 am

you will probably have to fetch the total from the order_total table to get the total after discount. You can fetch with

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_total WHERE code = 'total' AND order_id = '" . (int)$order_id . "'");
$amount = $query->row['value'];


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by drbyte » Sat Oct 12, 2013 12:25 pm

Thank you for being so patent with us..

Is there away to get the price of each item after the discount.

Code: Select all

   $output .= '&AMOUNT' . $count . '=' . $result['total'];
here's the output

Code: Select all

<iframe src="https://t.pepperjamnetwork.com/track?PID=6935&INT=ITEMIZED&ITEM1=492&QTY1=1&AMOUNT1=200.0000&ITEM2=455&QTY2=2&AMOUNT2=124.0000&OID=497" width="1" height="1" frameborder="0"></iframe>
AMOUNT1=200.0000 and AMOUNT2=124.0000 are the original values of each item before the discount.

What I think they are trying to get is the items above amount after the discount if any

Thank you, I really appreciate the help

Sam

New member

Posts

Joined
Sun Jan 01, 2012 7:20 pm

Post by drbyte » Sat Oct 12, 2013 2:15 pm

OK, not sure if this is correct but it seems to be working:

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

$output = '<iframe src="https://t.pepperjamnetwork.com/track?';
$output .="PID=6935";
$output .="&INT=ITEMIZED";

$count = 1;

foreach ($query->rows as $result) {
   $output .= '&ITEM' . $count . '=' . $result['product_id'];
   $output .= '&QTY' . $count . '=' . $result['quantity'];
   $output .= '&AMOUNT' . $count . '=' . $result['total'];
   $count++;
}
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_total WHERE code = 'total' AND order_id = '" . (int)$order_id . "'");
$amount = $query->row['value'];
foreach ($query->rows as $result) {
  
   $output .= '&PROMOCODE' . '=' . $result['value'];
   
   $count++;
}
$output .='&OID=' . $order_id . '" width="1" height="1" frameborder="0"></iframe>';

New member

Posts

Joined
Sun Jan 01, 2012 7:20 pm

Post by MarketInSG » Sat Oct 12, 2013 4:57 pm

I can't remember the discounted price being stored, because the coupon is offset at the total calculation. I'm sure the codes you have isn't really correct this way.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by drbyte » Sun Oct 13, 2013 8:49 am

Thanks,

So, from what I understood, OpenCart does not give you the discounted price per item after applying the promocode. Just the total discount at the total check out price?

If that's the case, then I think we are going to eliminate the Promocoode for now. We will Just using the individual sale on items for now!

Also, It seems like more than just above code, I suppose there are some IF statements.

Again, thanks for your help

Sam

New member

Posts

Joined
Sun Jan 01, 2012 7:20 pm

Post by giproc » Wed Feb 03, 2016 6:37 am

I realize this is an old thread, but does anybody know how to provide the code in OC 2.0.3.1 for Pepperjam (EAAN) integration? This is far beyond my pay grade but we've already subscribed and I need to find someone who can provide the code to make this work.

I have the details if required. Please PM me if necessary.

Cheers
JP

New member

Posts

Joined
Sat Aug 29, 2015 9:24 pm
Who is online

Users browsing this forum: No registered users and 28 guests