Magento 2 Success.phtml output order values
We're having some issues with Magento 2 where we're unable to output the order values in our checkout code. Here's our code:
<!---- Onefeed Tracking Code ---->
<?php
//-------------------------------------------
// GET MAGENTO ORDER VALUES FOR TRACKING CODE
//-------------------------------------------
$orderId = $block->escapeHtml($block->getOrderId());
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
<script type="text/javascript" language="javascript">
var of_ssid = 'xxxx';
var cs = '<?php echo $total ?>';
var oi = '<?php echo $orderId; ?>';
var it = 1;
</script>
<script type="text/javascript" language="javascript" src="https://tracking.onefeed.co.uk/t.js"></script>
<noscript>
<img border="0" src="https://tracking.onefeed.co.uk/ProcessProductCheckout.ashx?of_ssid=xxxx&cs=<?php echo $total ?>&it=1&oi=<?php echo $orderId; ?>" />
</noscript>
<!---- End Onefeed Tracking Code ---->
Any ideas how we can output the data without having to create a module in Magento 2?
magento magento2.2
add a comment |
We're having some issues with Magento 2 where we're unable to output the order values in our checkout code. Here's our code:
<!---- Onefeed Tracking Code ---->
<?php
//-------------------------------------------
// GET MAGENTO ORDER VALUES FOR TRACKING CODE
//-------------------------------------------
$orderId = $block->escapeHtml($block->getOrderId());
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
<script type="text/javascript" language="javascript">
var of_ssid = 'xxxx';
var cs = '<?php echo $total ?>';
var oi = '<?php echo $orderId; ?>';
var it = 1;
</script>
<script type="text/javascript" language="javascript" src="https://tracking.onefeed.co.uk/t.js"></script>
<noscript>
<img border="0" src="https://tracking.onefeed.co.uk/ProcessProductCheckout.ashx?of_ssid=xxxx&cs=<?php echo $total ?>&it=1&oi=<?php echo $orderId; ?>" />
</noscript>
<!---- End Onefeed Tracking Code ---->
Any ideas how we can output the data without having to create a module in Magento 2?
magento magento2.2
add a comment |
We're having some issues with Magento 2 where we're unable to output the order values in our checkout code. Here's our code:
<!---- Onefeed Tracking Code ---->
<?php
//-------------------------------------------
// GET MAGENTO ORDER VALUES FOR TRACKING CODE
//-------------------------------------------
$orderId = $block->escapeHtml($block->getOrderId());
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
<script type="text/javascript" language="javascript">
var of_ssid = 'xxxx';
var cs = '<?php echo $total ?>';
var oi = '<?php echo $orderId; ?>';
var it = 1;
</script>
<script type="text/javascript" language="javascript" src="https://tracking.onefeed.co.uk/t.js"></script>
<noscript>
<img border="0" src="https://tracking.onefeed.co.uk/ProcessProductCheckout.ashx?of_ssid=xxxx&cs=<?php echo $total ?>&it=1&oi=<?php echo $orderId; ?>" />
</noscript>
<!---- End Onefeed Tracking Code ---->
Any ideas how we can output the data without having to create a module in Magento 2?
magento magento2.2
We're having some issues with Magento 2 where we're unable to output the order values in our checkout code. Here's our code:
<!---- Onefeed Tracking Code ---->
<?php
//-------------------------------------------
// GET MAGENTO ORDER VALUES FOR TRACKING CODE
//-------------------------------------------
$orderId = $block->escapeHtml($block->getOrderId());
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
<script type="text/javascript" language="javascript">
var of_ssid = 'xxxx';
var cs = '<?php echo $total ?>';
var oi = '<?php echo $orderId; ?>';
var it = 1;
</script>
<script type="text/javascript" language="javascript" src="https://tracking.onefeed.co.uk/t.js"></script>
<noscript>
<img border="0" src="https://tracking.onefeed.co.uk/ProcessProductCheckout.ashx?of_ssid=xxxx&cs=<?php echo $total ?>&it=1&oi=<?php echo $orderId; ?>" />
</noscript>
<!---- End Onefeed Tracking Code ---->
Any ideas how we can output the data without having to create a module in Magento 2?
magento magento2.2
magento magento2.2
asked Nov 22 at 16:23
Onefeed
115
115
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This part of your code is definately working (just checked):
<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
...
<?php echo $total ?>
Since I don't know which Block functions you are relying on it's impossible to say for sure, but I'm guessing $orderId = $block->escapeHtml($block->getOrderId());
does not return a valid order id.
I'm not sure if you should use objectManager though. There is quite a discussion about when and how to use it on the stackexchange:
https://magento.stackexchange.com/questions/117098/magento-2-to-use-or-not-to-use-the-objectmanager-directly
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation inmodule-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.
– Tobi
Nov 23 at 12:27
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434959%2fmagento-2-success-phtml-output-order-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This part of your code is definately working (just checked):
<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
...
<?php echo $total ?>
Since I don't know which Block functions you are relying on it's impossible to say for sure, but I'm guessing $orderId = $block->escapeHtml($block->getOrderId());
does not return a valid order id.
I'm not sure if you should use objectManager though. There is quite a discussion about when and how to use it on the stackexchange:
https://magento.stackexchange.com/questions/117098/magento-2-to-use-or-not-to-use-the-objectmanager-directly
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation inmodule-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.
– Tobi
Nov 23 at 12:27
add a comment |
This part of your code is definately working (just checked):
<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
...
<?php echo $total ?>
Since I don't know which Block functions you are relying on it's impossible to say for sure, but I'm guessing $orderId = $block->escapeHtml($block->getOrderId());
does not return a valid order id.
I'm not sure if you should use objectManager though. There is quite a discussion about when and how to use it on the stackexchange:
https://magento.stackexchange.com/questions/117098/magento-2-to-use-or-not-to-use-the-objectmanager-directly
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation inmodule-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.
– Tobi
Nov 23 at 12:27
add a comment |
This part of your code is definately working (just checked):
<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
...
<?php echo $total ?>
Since I don't know which Block functions you are relying on it's impossible to say for sure, but I'm guessing $orderId = $block->escapeHtml($block->getOrderId());
does not return a valid order id.
I'm not sure if you should use objectManager though. There is quite a discussion about when and how to use it on the stackexchange:
https://magento.stackexchange.com/questions/117098/magento-2-to-use-or-not-to-use-the-objectmanager-directly
This part of your code is definately working (just checked):
<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$order = $objectManager->create('MagentoSalesModelOrder')->load($orderId);
$total = $order->getGrandTotal();
?>
...
<?php echo $total ?>
Since I don't know which Block functions you are relying on it's impossible to say for sure, but I'm guessing $orderId = $block->escapeHtml($block->getOrderId());
does not return a valid order id.
I'm not sure if you should use objectManager though. There is quite a discussion about when and how to use it on the stackexchange:
https://magento.stackexchange.com/questions/117098/magento-2-to-use-or-not-to-use-the-objectmanager-directly
answered Nov 23 at 8:02
Tobi
836
836
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation inmodule-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.
– Tobi
Nov 23 at 12:27
add a comment |
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation inmodule-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.
– Tobi
Nov 23 at 12:27
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
We do have a valid Order ID, this is being collected in the checkout call. The order total is null and is not returning any values. I think the site is using the standard Block functions. We have no customized values on this page.
– Onefeed
Nov 23 at 9:39
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation in
module-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.– Tobi
Nov 23 at 12:27
Magento 2 comes with a standard google analytics and adwords module. For conversion tracking they refer to a helper class in the adwords module. You can see the implementation in
module-google-adwords/view/frontend/templates/code.phtml
. Maybe you can compare this to your usecase to find what's causing the problem.– Tobi
Nov 23 at 12:27
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434959%2fmagento-2-success-phtml-output-order-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown