Jump to content

Prestashop - variable for order number


Guest

Recommended Posts

What the variable to use on the order number (I need put order number into my affiliate program). I can not find anywhere, could someone help with this.

I tried it and search in google and technical documentation but nowhere have I not found.

 

Thank you in advance to everyone who can use some advice, thanks.

Edited by PepeCZ (see edit history)
Link to comment
Share on other sites

Hi PepeCZ,

 

$id_order or $order->id_order is the order number.

It is completed with '0' for display.

 

But where and when your code is processed ?

 

Regards

 

hi, thanks for your reply.

 

I add affiliate php code (Lyoness) into order-configuration.php

and in this php code for affiliate program lyoness are two field for order number and order price (value).

 

And I did not know how to get these numbers. I found that I had to use a variable.

I needed to find a variable to the order number and order price (value).

 

so I wrote into additionally added php code in order-configuration.php this:

......

$orderValue = "$order->total_products"; <----here is this for total price

$orderNumber = "$order->id"; <----here is this for order number

......

IT IS GOOD?

Edited by PepeCZ (see edit history)
Link to comment
Share on other sites

PepeCz

 

No, if you made modification in 'order-confirmation.php' it is not the right place.

 

I do not know Lyoness, I will try to understand what it is to tell you what you have to do. If you need an override or a module for example.

Coming back soon

 

Affiliate program Lyoness contains two things:

1. redirect.php (PHP Code Redirect)

I have redirect.php in root my eshop, and Lyoness checked me this redirect.php and works on 100% good.

2. tracking (PHP Code Tracking)

this seems good too I just needed to find a variable for "order price(value)" and "order number"

 

But I did not know where I was write (this tracking code), so I test it and write this tracking code into order-configuration.php

So I tried to write into order-configuration.php

and Lyoness wrote me that everything is okay

only not sees right price number and order number.

(that's why I was asking these two variables)

And it is wrong? I got it write into another?

 

PHP Code Redirect - this is redirect.php in root, this works on 100% (lyoness this testing)

<?php
// Default landing page
//
$defaultUrl = "http://www.example.com/"; <--here i wrote my eshop adress, it is okay
// The domain under which this script is installed
//
$domain = "example.com"; <--here i wrote my eshop adress, it is okay
if (!empty($_GET["tduid"]))
{
$cookieDomain = "." . $domain;
setcookie("TRADEDOUBLER", $_GET["tduid"],
(time() + 3600 * 24 * 365), "/", $cookieDomain);
// If you do not use the built-in session functionality in PHP, modify
// the following expression to work with your session handling routines.
//
$_SESSION["TRADEDOUBLER"] = $_GET["tduid"];
}
if (empty($_GET["url"]))
$url = $defaultUrl;
else
$url = urldecode(substr(strstr($_SERVER["QUERY_STRING"], "url"), 4));
header("Location: " . $url);
?>

 

PHP Code Tracking - this I write into order-configuration.php, lyoness testing and wrote me that ok only order number and value but I did not have those variables the two fields were empty.

Now I've write those that are written here, this two variables I found on this forum (variable for order price: $order->total_products and this variable is for order number: $order->id IT IS GOOD THIS OR NOT?)

<?php
// Your organization ID
//
$organization = "xxxxxx"; <--this is my unique key, its okey
// Your checksum code
//
$checksumCode = "xxxxxx"; <--this is my unique key, its okey
// Value of the sale.
// Leave as "0.00" if not applicable.
//
$orderValue = "0.00"; <--this is order price,for this i use: $orderValue = "$order->total_products";
// Currency of the sale. /
/ Leave as "EUR" if not applicable.
//
$currency = "EUR";
// Event ID
//
$event = "xxxxxx"; <--this is my unique key, its okey
// Event type:
// true = Sale
// false = Lead
//
$isSale = true;
// Encrypted connection on this page:
// true = Yes (https)
// false = No (http)
//
$isSecure = false;
// Here you must specify a unique identifier for the transaction.
// For a sale, this is typically the order number.
//
$orderNumber = "xxxxxxxx"; <--this is order number,for this i use: $orderNumber = "$order->id";
// If you do not use the built-in session functionality in PHP, modify
// the following expressions to work with your session handling routines.
//
$tduid = ""; if
(!empty($_SESSION["TRADEDOUBLER"]))
$tduid = $_SESSION["TRADEDOUBLER"];
// OPTIONAL: You may transmit a list of items ordered in the reportInfo
// parameter. See the chapter reportInfo for details.
//
$reportInfo = ""; $reportInfo =
urlencode($reportInfo);

/***** IMPORTANT: *****/
/***** In most cases, you should not edit anything below this line. *****/
/***** Please consult with TradeDoubler before modifying the code. *****/
if (!empty($_COOKIE["TRADEDOUBLER"]))
$tduid = $_COOKIE["TRADEDOUBLER"];
if ($isSale)
{
$domain = "tbs.tradedoubler.com";
$checkNumberName = "orderNumber";
}
else
{
$domain = "tbl.tradedoubler.com";
$checkNumberName = "leadNumber";
$orderValue = "1";
}
$checksum = "v04" . md5($checksumCode . $orderNumber . $orderValue);
if ($isSecure)
$scheme = "https";
else
$scheme = "http";
$trackBackUrl  = $scheme . "://" . $domain . "/report"
. "?organization=" . $organization
. "&event=" . $event
. "&" . $checkNumberName . "=" . $orderNumber
. "&checksum=" . $checksum
. "&tduid=" . $tduid
. "&reportInfo=" . $reportInfo;

if ($isSale)
{
$trackBackUrl
.= "&orderValue=" .$orderValue
.= "&currency=" .$currency;
}
echo "<img src=\"" . $trackBackUrl . "\" alt=\"\" style=\"border: none\" />";
?>

Edited by PepeCZ (see edit history)
Link to comment
Share on other sites

  • 1 year later...

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...