Jump to content

JAM JROX and PrestaShop 1.5


Recommended Posts

i had figured out how to intergrate PS 1.4 with JAM affiliate program

 

But now I am using PS 1.5 and the JAM code no longer works

 

Have the variables in Prestashop been changed in PS 1.5??

 

Does anyone know how to intergrate PS 1.5 with JAM ver 2 ??

 

Please.

 

Thanks

Link to comment
Share on other sites

  • 6 months later...

Hi,

This is what you need to do for 1.5. 

 

You may need to modifly it a bit for your use eg. I send the product margin not the price.

 

Ok, on the index page you will need (before the prestashop code. This is the basics, I have additions on my site):

---------------------------------

preg_match("/^([^\.]+)\./",$_SERVER['HTTP_HOST'],$args);
$sub = $args[1];

if ($sub != 'www'){
    $sdata = array(
                   'access_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
                   'access_id' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
                   'subdomain' => $sub,
                   'program_id' => '1',
                   'ip' => $_SERVER['REMOTE_ADDR'],
                   'user_agent' => $_SERVER['HTTP_USER_AGENT'],
                   );
    
    $fields = "";
    foreach( $sdata as $key => $value ) $fields .= "$key=" . urlencode( $value ) . "&";
        
    $ch = curl_init('http://www.YOURSITE.COM/affiliates/automate/set_tracking_cookie');

    curl_setopt($ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '50');

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
    curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim( $fields, "& " )); // use HTTP POST to send form data
    $resp = curl_exec($ch); //execute post and get results
    curl_close ($ch);
    
    if (!empty($resp))
    {
        $jam_cookie = unserialize(base64_decode($resp));
        
        if (is_array($jam_cookie))
        {
            if (setcookie(
                    $jam_cookie['name'],
                    $jam_cookie['value'],
                    $jam_cookie['expire'] + time(),
                    $jam_cookie['path'],
                    $jam_cookie['domain'],
                    0
                    ))
            {
                //die('cookie set');    
            }
        }
    }
}

----------------------------------

 

 

Place in all theme header templates:

-------------------------------------

<script src="http://www.YOURSITE.COM/affiliates/js/sub/"></script>

-------------------------------------

 

 

In the following

File: /controllers/front/OrderConfirmationController.php

Function: displayOrderConfirmation() after $params['currencyObj'] = $currency;

 

PayPal File (there is spacific code on JROX site you can use for PayPal that uses the POST values but I used the code below for all files): /modules/paypal/controllers/front/submit.php

Function:

displayHook() under the $params['total_to_pay'] = $order->getOrdersTotalPaid();

 

If other payment modules are added, they have to be checked to see if they have to be modified like the PayPal module was.

 

You can modify below to add data such as Life Time Referrer and invoice number etc..

 

------------------------------------------------

//START JAM CODE
                $JAMIntegrate = file_get_contents("http://www.YOURSITE.COM/affiliates/sale/amount/".$params['VALUE-YOU-WANT-TO-USE']."/trans_id/".$this->id_order."/tracking_code/".$_COOKIE['jamcom']);            
                //END JAM CODE

------------------------------------------------ 

 

That is the basics and you can play around with it a bit as I have done.

 

Hope it helps.

Link to comment
Share on other sites

  • 2 months later...

i had figured out how to intergrate PS 1.4 with JAM affiliate program

 

But now I am using PS 1.5 and the JAM code no longer works

 

Have the variables in Prestashop been changed in PS 1.5??

 

Does anyone know how to intergrate PS 1.5 with JAM ver 2 ??

 

Please.

 

Thanks

My shop is v1.4.11 and could you please kindly let me know how do you integrate 1.4 with JAM? I found this info from jam website http://jam.jrox.com/kb/article/integration-with-prestashop-14 but I could not find the place I can place the code to. Thanks

Link to comment
Share on other sites

The code example above is basically what I use for Prestashop 1.5+ and it works fine.

 

I use a couple different parameters than what most would use eg. I use margin not the full price for the amount.

 

Basically when you look at the code in the Order Confirmation Controller, and the PayPal one, you cab see the price variables. The margin however has to be calculated by adding code if you want to go that way.

 

The support at the JROX site should be able to assist as well. You just have to wait sometimes.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...