Forums / All Other Contributions/Addons / Few lines code translation from osc to zencart - please help

Few lines code translation from osc to zencart - please help

Locked

Views: 2,846

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
17 Jun 2009, 7:51 PM
#1
backstage avatar

backstage

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
0

Few lines code translation from osc to zencart - please help

Hi

Can you help me "translate" this instruction from osc to zencart.
This is some lines I can add in OSC to use a danish site service at my shop - and I would like to use that in Zencart instead
Seems to be almost the same, so one of you genies can maybe fast edit that :)

Instruction for OSC:

In the file checkout_process.php you will have to add some code after this line
// load the after_process function from the payment modules

Code to add:
$orders_total=$cart->show_total()- $total_tax;
tep_session_register('orders_total');
$orders_id=$insert_id;
tep_session_register('orders_id');


In the file checkout_success.php you will have to add some code after this line

<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>

Code to add:

<?php echo '<img height=1 width=1 border=0 src="http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $orders_total . '&orderid=' . $orders_id . '" />'; tep_session_unregister('orders_total'); tep_session_unregister('orders_id'); ?>

Hope someone can help me "translate" the code from OSC to Zencart. I have tried using it as it is, but that dosent work (found files, and find out where to put it, but the code was the problem)

I use Zencart 1.3.6, but I think it will be the same in 1.3.8 - so I really hope you will help me anyway

Thanks a lot if you will help me :)
That would be a great help

Kind regards
Kim

17 Jun 2009, 8:45 PM
#2
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

Re: Few lines code translation from osc to zencart - please help

Hi

$orders_total=$cart->show_total()- $total_tax; 
tep_session_register('orders_total'); 
$orders_id=$insert_id;
tep_session_register('orders_id');

===>

$_SESSION['orders_total'] = $cart->show_total()- $total_tax; 
$_SESSION['orders_id'] = $insert_id;
<?php
echo '<img height=1 width=1 border=0 src="http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $orders_total . '&orderid=' . $orders_id . '" />';
tep_session_unregister('orders_total'); 
tep_session_unregister('orders_id'); 
?>

===>

<?php
echo '<img height=1 width=1 border=0 src="http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $_SESSION['orders_total'] . '&orderid=' . $_SESSION['orders_id'] . '" />';
unset($_SESSION['orders_total']); 
unset($_SESSION['orders_id']); 
?>

NOTE: We are sorry that Andrew is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

20 Jun 2009, 8:16 PM
#3
backstage avatar

backstage

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
0

Re: Few lines code translation from osc to zencart - please help

Hi

Thanks a lot for using your time helping me :)

I have tried the code but got an error on this sentense:
$_SESSION['orders_total'] = $cart->show_total()- $total_tax;

Fatal error: Call to a member function on a non-object in /var/www/vhosts/hudplejeshoppen.dk/httpdocs/includes/modules/pages/checkout_process/header_php.php on line 20

Do you know why that can be?

21 Jun 2009, 11:00 AM
#4
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

Re: Few lines code translation from osc to zencart - please help

Sorry, my error :lamo:

$orders_total=$cart->show_total()- $total_tax; 
tep_session_register('orders_total'); 
$orders_id=$insert_id;
tep_session_register('orders_id');

Replace by

$_SESSION['order_summary']['total_tax'] = $order->total_tax;

Don't change header.php, use magic Notify system, event 'NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES'.

<?php
echo '<img height=1 width=1 border=0 src="http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $orders_total . '&orderid=' . $orders_id . '" />';
tep_session_unregister('orders_total'); 
tep_session_unregister('orders_id'); 
?>

Replace by

<?php
$total_without_tax = $_SESSION['order_summary']['order_total'] - $_SESSION['order_summary']['total_tax'];
echo '<img height=1 width=1 border=0 src="http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $total_without_tax . '&orderid=' . $_SESSION['order_summary']['order_number'] . '" />';
?>

NOTE: We are sorry that Andrew is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

26 Jun 2009, 8:36 AM
#5
backstage avatar

backstage

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
0

Re: Few lines code translation from osc to zencart - please help

Once more thank you :)

Now it almost work. No errors and the link is recieved.

But still one more problem:

http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $orders_total . '&orderid=' . $orders_id . '" />';
tep_session_unregister('orders_total')

In this line orderamount is equal to 0, and orderid is empty

I really hope you will help me this too. Thanks a lot for alle the help you providing me. Im very thankfull :)

Kind regards
Kim

26 Jun 2009, 9:23 AM
#6
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

Re: Few lines code translation from osc to zencart - please help

Backstage:

http://www.engodsag.dk/affiliate/salestracking.php?shopnetworkid=XXXXX&orderamount=' . $orders_total . '&orderid=' . $orders_id . '" />';
tep_session_unregister('orders_total')

> 
> In this line orderamount is equal to 0, and orderid is empty
Sure. See previous post

NOTE: We are sorry that Andrew is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

29 Jun 2009, 7:57 PM
#7
backstage avatar

backstage

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
0

Re: Few lines code translation from osc to zencart - please help

Hi again

Sry I am not sure I understand what you mean :( :)

This line:
&orderamount=' . $orders_total . '&orderid=' . $orders_id

The variabel $orders_total should have the value of the order and the variabel $orders_id should have the id of the order.

Can you tell me why they dont have that :)

Sry it takes time to understand..... hope you still got time to help me.

Thanks a lot

Kind Regards
Kim :)

3 Jul 2009, 9:42 PM
#8
backstage avatar

backstage

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
0

Re: Few lines code translation from osc to zencart - please help

Are you still there :)

Sorry if I am a newbee :)

But why dosent it have the total and the id in the variables?
... and how can I put the total and id in the variables?

Kindly regards
Kim :)

14 Jul 2009, 12:34 AM
#9
backstage avatar

backstage

Zen Follower

Join Date:
Jan 2006
Posts:
108
Plugin Contributions:
0

Re: Few lines code translation from osc to zencart - please help

Seems like it i because I have 1.3.6 instead of 1.3.8

Can you help me how to do in 1.3.6?

14 Jul 2009, 12:40 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Few lines code translation from osc to zencart - please help

*MODERATOR NOTE: In the future, please don't start duplicate discussions of the same topic in different places, as it usually ends up leaving unfinished discussions and even conflicting answers from time to time.
*
ref: http://www.zen-cart.com/forum/showthread.php?t=131900

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Jul 2009, 7:49 AM
#11
a_berezin avatar

a_berezin

Deceased

Join Date:
Aug 2004
Location:
Saint Petersburg, Russia
Posts:
1,782
Plugin Contributions:
5

Re: Few lines code translation from osc to zencart - please help

Backstage:

Can you help me how to do in 1.3.6?

Of course not.

NOTE: We are sorry that Andrew is no longer with us.
We are grateful for all his contributions to the Zen Cart community.