Post by zekin » Thu Oct 17, 2013 2:08 pm

Hi

Wondering if anyone here has successfully installed the advanced sales tracker code of myshopping.com.au (it's very similar to getprice) .

Their code is like this (paste onto your "Thank You" page):

Code: Select all

<!--MyShopping.com.au Code for Purchase Conversion Page -->

<img height=0 width=0  src="https://www.myshopping.com.au/sale.asp?mid=xxxx&amount=1234.56&order=123">
Where xxxx is the merchant id number of myshopping (a fixed value), 1234.56 is the sale amount (need to call from transaction), 123 is the order number (need to call from transaction)

If anyone has done it, please tell me what needs to modify? I am guessing at least need to mod:
catalog/controller/checkout/confirm.php
catalog/controller/checkout/success.php
catalog/view/theme/*/template/common/success.tpl

PS. i use OC 1.5.4.1
Last edited by zekin on Tue Oct 22, 2013 9:17 am, edited 2 times in total.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

User avatar
Guru Member

Posts

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

Post by zekin » Fri Oct 18, 2013 3:52 pm

@MarketInSG
Thanks for the hint, I also read through other threads and then worked my way out with following vqmod, I successfully got the order total, HOWEVER, still couldn't get the order id, I mean, all i got is blank order id.

Following is the vqmod (work in process, order id still doesn't work):

Code: Select all

<modification>
<id>Get order id and total and insert myshopping.com.au sales tracker</id>
<version>1.0 beta</version>
<vqmver>2.3.0</vqmver>
<author>zekin</author>

<!-- based on
http://forum.opencart.com/viewtopic.php?f=128&t=111467
-->

<file name="catalog/controller/checkout/confirm.php">
	<operation>
		<search position="before"><![CDATA[$this->data['payment'] = $this->getChild('payment/' . $this->session->data['payment_method']['code']);]]></search>
		<add><![CDATA[			$ADtotal = 1;
			$this->session->data['ADtotal'] = $total;]]></add>
	</operation>
</file>


<file name="catalog/controller/checkout/success.php">
	<operation>
		<search position="after"><![CDATA[public function index() { ]]></search>
		<add><![CDATA[$this->data['ADtotal'] = $this->session->data['ADtotal'];]]></add>
	</operation>

	<operation>
		<search position="before"><![CDATA[$this->cart->clear();]]></search>
		<add><![CDATA[$this->data['order_id'] = $this->session->data['order_id'];]]></add>
	</operation>
</file>

<file name="catalog/view/theme/*/template/common/success.tpl">
	<operation>
		<search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
		<add><![CDATA[<?php if (isset($ADtotal)) { ?>
<!--MyShopping.com.au Code for Purchase Conversion Page -->

<img height=0 width=0  src="https://www.myshopping.com.au/sale.asp?mid=xxxx&amount=<?php echo $ADtotal; ?>&order=<?php echo $order_id; ?>">
<?php } ?>]]></add>
	</operation>
</file>

</modification>

Any idea how to get the order id?

Thanks in advance.
Last edited by zekin on Fri Oct 18, 2013 10:06 pm, edited 2 times in total.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by MarketInSG » Fri Oct 18, 2013 6:44 pm

The order ID must be gotten from $this->session->data['order_id'], before it is unset. My topic there did write something about it to store it before being unset.


User avatar
Guru Member

Posts

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

Post by zekin » Fri Oct 18, 2013 8:06 pm

MarketInSG wrote:The order ID must be gotten from $this->session->data['order_id'], before it is unset. My topic there did write something about it to store it before being unset.
Yup, i'm aware of that, and I placed

Code: Select all

$this->data['order_id'] = $this->session->data['order_id'];
just before they unset.

But, is <?php echo $order_id; ?> the correct way to call it back to the myshopping code at success.tpl ?

For some reason, I am getting php error: Undefined variable: order_id in success.tpl

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by zekin » Fri Oct 18, 2013 9:59 pm

Tried a lot of times and still couldn't get order id, so I tried a different approach and it worked.

Tested oc 1.5.4.1

Code: Select all

<modification>
<id>Get order id and total and insert into myshopping.com.au sales tracker, tested oc 1.5.4.1</id>
<version>1.0.1</version>
<vqmver>2.3.0</vqmver>
<author>zekin</author>

<file name="catalog/controller/checkout/confirm.php">
	<operation>
		<search position="before"><![CDATA[$this->data['payment'] = $this->getChild('payment/' . $this->session->data['payment_method']['code']);]]></search>
		<add><![CDATA[			$ADtotal = 1;
			$this->session->data['ADtotal'] = $total;]]></add>
	</operation>
</file>

<file name="catalog/controller/checkout/success.php">
	<operation>
		<search position="after"><![CDATA[public function index() { ]]></search>
		<add><![CDATA[$this->data['ADtotal'] = $this->session->data['ADtotal'];]]></add>
	</operation>

	<operation>
		<search position="before"><![CDATA[$this->data['button_continue'] = $this->language->get('button_continue');]]></search>
		<add><![CDATA[$this->data['text_order_id'] = $this->session->data['last_order_id'];]]></add>
	</operation>

</file>

<file name="catalog/view/theme/*/template/common/success.tpl">
	<operation>
		<search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
		<add><![CDATA[<?php if (isset($ADtotal)) { ?>
<!--MyShopping.com.au Code for Purchase Conversion Page -->

<!--change xxxx to your own mid -->
<img height=0 width=0  src="https://www.myshopping.com.au/sale.asp?mid=xxxx&amount=<?php echo $ADtotal; ?>&order=<?php echo $text_order_id; ?>">
<?php } ?>]]></add>
	</operation>
</file>

</modification>
The above successfully captures the order total and order id, and inserts into the tracker code. This method will work for other similar tracker code.

Feedback is appreciated.


EDIT: sprintf removed

Attachments

Last edited by zekin on Tue Oct 22, 2013 9:16 am, edited 1 time in total.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by MarketInSG » Fri Oct 18, 2013 10:18 pm

not sure why, but why did text_order_id needed sprintf? I don't you think will need that


User avatar
Guru Member

Posts

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

Post by zekin » Fri Oct 18, 2013 10:32 pm

MarketInSG wrote:not sure why, but why did text_order_id needed sprintf? I don't you think will need that
oh yeh thanks, without it also works. I just referred to the code from what oc normally did with the text_message without checking what sprintf really does, luckily that worked too.

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm
Who is online

Users browsing this forum: No registered users and 56 guests