Magento - Show custom data on Order Information page (Customer Account) Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Account Information custom field on Order DetailsRecently product view not workingMagento custom adminhtml template gets overwritten by default templateOrder shows no line items for Bundled ProductMagento: Display custom product attribute in admin Items ordered blockMagento 2 : Problem while adding custom button order view page?Adding QTY+Location to order view page, Demac Magento-Multi-Location-Inventory ExtensionAdd own custom option and display on sales order in magentoOrder: To get comment field details from DB in magento 2Bundle product email template
How to make an animal which can only breed for a certain number of generations?
Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?
newbie Q : How to read an output file in one command line
The test team as an enemy of development? And how can this be avoided?
How to evaluate this function?
systemd and copy (/bin/cp): no such file or directory
What is the proper term for etching or digging of wall to hide conduit of cables
Does the transliteration of 'Dravidian' exist in Hindu scripture? Does 'Dravida' refer to a Geographical area or an ethnic group?
Is there a spell that can create a permanent fire?
Is this Kuo-toa homebrew race balanced?
Marquee sign letters
.bashrc alias for a command with fixed second parameter
Find general formula for the terms
Putting class ranking in CV, but against dept guidelines
Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?
What are some likely causes to domain member PC losing contact to domain controller?
My mentor says to set image to Fine instead of RAW — how is this different from JPG?
3D Masyu - A Die
Where and when has Thucydides been studied?
Is there any significance to the prison numbers of the Beagle Boys starting with 176-?
Why do C and C++ allow the expression (int) + 4?
Did pre-Columbian Americans know the spherical shape of the Earth?
"Destructive power" carried by a B-52?
Did John Wesley plagiarize Matthew Henry...?
Magento - Show custom data on Order Information page (Customer Account)
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Account Information custom field on Order DetailsRecently product view not workingMagento custom adminhtml template gets overwritten by default templateOrder shows no line items for Bundled ProductMagento: Display custom product attribute in admin Items ordered blockMagento 2 : Problem while adding custom button order view page?Adding QTY+Location to order view page, Demac Magento-Multi-Location-Inventory ExtensionAdd own custom option and display on sales order in magentoOrder: To get comment field details from DB in magento 2Bundle product email template
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to display points earned by customer on Order Information page under customer account.
module.xml
<sales_order_view>
<reference name="order_items">
<action method="addItemRender" ifconfig="mymodule/general/active"><type>default</type>
<block>sales/order_item_renderer_default</block>
<template>namespace/mymodule/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
Copied file from core - sales/order/items/renderer/default.phtml to namespace/mymodule/sales/order/items/renderer/default.phtml and along with default code, I added mine
<!--show points earned on each product-->
<?php $finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQtyOrdered()); ?>
<div class="product-cart-sku">
<span style="color: #d4af37; font-weight: bold;"><?php echo $this->__('Points Earned:'); ?>
<?php echo $finalPointsEarned ?>
</span>
</div>
<!--show points earned on each product-->
As shown in below image, this is how points earned are shown

- Is this the correct approach/method to show custom data on Order
Information page ? - If not, how do I override
Sales/Order/Item/Rendered/Defaultblock to show the same without copying core file
in my extension and then adding my code ?
Will it be same for below mentioned files too ?
sales/order/invoice/items/renderer/
sales/order/shipment/items/renderer/
sales/order/creditmemo/items/renderer/
Also, I am showing the same information in admin section by copying files in my extension
adminhtmldefaultdefaulttemplatenamespacemodulenamesalesordertotal.phtml
P.S. The files belongs to community extension
EDIT AS PER CUSTOM BLOCK CREATION
config.xml
<global>
<blocks>
<productpoint>
<class>Namespace_Modulename_Block</class>
</productpoint>
<sales>
<rewrite>
<order_item_renderer_default>Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default</order_item_renderer_default>
</rewrite>
</sales>
</blocks>
</global>
points.xml
<sales_order_invoice>
<reference name="invoice_items">
<block type="core/text_list" name="invoice.productpoints.info" translate="label">
<label>Additional Points Info</label>
</block>
</reference>
</sales_order_invoice>
Sales/Order/Item/Renderer/Default.php
<?php
class Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
public function getInvoiceProductPoints()
parent::getItem();
$_item = $this->getItem();
$finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQty());
return $finalPointsEarned;
sales/order/items/renderer/default.phtml
<?php $addInfoBlock = $this->getInvoiceProductPoints(); ?>
<?php if ($addInfoBlock): ?>
<?php echo $addInfoBlock ?>
<?php endif;?>
magento-1.9 orders sales-order customer-account
add a comment |
I need to display points earned by customer on Order Information page under customer account.
module.xml
<sales_order_view>
<reference name="order_items">
<action method="addItemRender" ifconfig="mymodule/general/active"><type>default</type>
<block>sales/order_item_renderer_default</block>
<template>namespace/mymodule/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
Copied file from core - sales/order/items/renderer/default.phtml to namespace/mymodule/sales/order/items/renderer/default.phtml and along with default code, I added mine
<!--show points earned on each product-->
<?php $finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQtyOrdered()); ?>
<div class="product-cart-sku">
<span style="color: #d4af37; font-weight: bold;"><?php echo $this->__('Points Earned:'); ?>
<?php echo $finalPointsEarned ?>
</span>
</div>
<!--show points earned on each product-->
As shown in below image, this is how points earned are shown

- Is this the correct approach/method to show custom data on Order
Information page ? - If not, how do I override
Sales/Order/Item/Rendered/Defaultblock to show the same without copying core file
in my extension and then adding my code ?
Will it be same for below mentioned files too ?
sales/order/invoice/items/renderer/
sales/order/shipment/items/renderer/
sales/order/creditmemo/items/renderer/
Also, I am showing the same information in admin section by copying files in my extension
adminhtmldefaultdefaulttemplatenamespacemodulenamesalesordertotal.phtml
P.S. The files belongs to community extension
EDIT AS PER CUSTOM BLOCK CREATION
config.xml
<global>
<blocks>
<productpoint>
<class>Namespace_Modulename_Block</class>
</productpoint>
<sales>
<rewrite>
<order_item_renderer_default>Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default</order_item_renderer_default>
</rewrite>
</sales>
</blocks>
</global>
points.xml
<sales_order_invoice>
<reference name="invoice_items">
<block type="core/text_list" name="invoice.productpoints.info" translate="label">
<label>Additional Points Info</label>
</block>
</reference>
</sales_order_invoice>
Sales/Order/Item/Renderer/Default.php
<?php
class Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
public function getInvoiceProductPoints()
parent::getItem();
$_item = $this->getItem();
$finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQty());
return $finalPointsEarned;
sales/order/items/renderer/default.phtml
<?php $addInfoBlock = $this->getInvoiceProductPoints(); ?>
<?php if ($addInfoBlock): ?>
<?php echo $addInfoBlock ?>
<?php endif;?>
magento-1.9 orders sales-order customer-account
add a comment |
I need to display points earned by customer on Order Information page under customer account.
module.xml
<sales_order_view>
<reference name="order_items">
<action method="addItemRender" ifconfig="mymodule/general/active"><type>default</type>
<block>sales/order_item_renderer_default</block>
<template>namespace/mymodule/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
Copied file from core - sales/order/items/renderer/default.phtml to namespace/mymodule/sales/order/items/renderer/default.phtml and along with default code, I added mine
<!--show points earned on each product-->
<?php $finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQtyOrdered()); ?>
<div class="product-cart-sku">
<span style="color: #d4af37; font-weight: bold;"><?php echo $this->__('Points Earned:'); ?>
<?php echo $finalPointsEarned ?>
</span>
</div>
<!--show points earned on each product-->
As shown in below image, this is how points earned are shown

- Is this the correct approach/method to show custom data on Order
Information page ? - If not, how do I override
Sales/Order/Item/Rendered/Defaultblock to show the same without copying core file
in my extension and then adding my code ?
Will it be same for below mentioned files too ?
sales/order/invoice/items/renderer/
sales/order/shipment/items/renderer/
sales/order/creditmemo/items/renderer/
Also, I am showing the same information in admin section by copying files in my extension
adminhtmldefaultdefaulttemplatenamespacemodulenamesalesordertotal.phtml
P.S. The files belongs to community extension
EDIT AS PER CUSTOM BLOCK CREATION
config.xml
<global>
<blocks>
<productpoint>
<class>Namespace_Modulename_Block</class>
</productpoint>
<sales>
<rewrite>
<order_item_renderer_default>Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default</order_item_renderer_default>
</rewrite>
</sales>
</blocks>
</global>
points.xml
<sales_order_invoice>
<reference name="invoice_items">
<block type="core/text_list" name="invoice.productpoints.info" translate="label">
<label>Additional Points Info</label>
</block>
</reference>
</sales_order_invoice>
Sales/Order/Item/Renderer/Default.php
<?php
class Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
public function getInvoiceProductPoints()
parent::getItem();
$_item = $this->getItem();
$finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQty());
return $finalPointsEarned;
sales/order/items/renderer/default.phtml
<?php $addInfoBlock = $this->getInvoiceProductPoints(); ?>
<?php if ($addInfoBlock): ?>
<?php echo $addInfoBlock ?>
<?php endif;?>
magento-1.9 orders sales-order customer-account
I need to display points earned by customer on Order Information page under customer account.
module.xml
<sales_order_view>
<reference name="order_items">
<action method="addItemRender" ifconfig="mymodule/general/active"><type>default</type>
<block>sales/order_item_renderer_default</block>
<template>namespace/mymodule/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
Copied file from core - sales/order/items/renderer/default.phtml to namespace/mymodule/sales/order/items/renderer/default.phtml and along with default code, I added mine
<!--show points earned on each product-->
<?php $finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQtyOrdered()); ?>
<div class="product-cart-sku">
<span style="color: #d4af37; font-weight: bold;"><?php echo $this->__('Points Earned:'); ?>
<?php echo $finalPointsEarned ?>
</span>
</div>
<!--show points earned on each product-->
As shown in below image, this is how points earned are shown

- Is this the correct approach/method to show custom data on Order
Information page ? - If not, how do I override
Sales/Order/Item/Rendered/Defaultblock to show the same without copying core file
in my extension and then adding my code ?
Will it be same for below mentioned files too ?
sales/order/invoice/items/renderer/
sales/order/shipment/items/renderer/
sales/order/creditmemo/items/renderer/
Also, I am showing the same information in admin section by copying files in my extension
adminhtmldefaultdefaulttemplatenamespacemodulenamesalesordertotal.phtml
P.S. The files belongs to community extension
EDIT AS PER CUSTOM BLOCK CREATION
config.xml
<global>
<blocks>
<productpoint>
<class>Namespace_Modulename_Block</class>
</productpoint>
<sales>
<rewrite>
<order_item_renderer_default>Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default</order_item_renderer_default>
</rewrite>
</sales>
</blocks>
</global>
points.xml
<sales_order_invoice>
<reference name="invoice_items">
<block type="core/text_list" name="invoice.productpoints.info" translate="label">
<label>Additional Points Info</label>
</block>
</reference>
</sales_order_invoice>
Sales/Order/Item/Renderer/Default.php
<?php
class Namespace_Modulename_Block_Sales_Order_Item_Renderer_Default extends Mage_Sales_Block_Order_Item_Renderer_Default
public function getInvoiceProductPoints()
parent::getItem();
$_item = $this->getItem();
$finalPointsEarned = ($_item->getCustomerProductPoints() * $_item->getQty());
return $finalPointsEarned;
sales/order/items/renderer/default.phtml
<?php $addInfoBlock = $this->getInvoiceProductPoints(); ?>
<?php if ($addInfoBlock): ?>
<?php echo $addInfoBlock ?>
<?php endif;?>
magento-1.9 orders sales-order customer-account
magento-1.9 orders sales-order customer-account
edited Jul 3 '17 at 7:20
sv3n
10k62557
10k62557
asked Mar 18 '16 at 8:53
SlimshadddyyySlimshadddyyy
62011547
62011547
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
1.) Correct : Well, it largely depends upon the file/situation you are working in. But lot of core templates allow third party extensions to inject their code in a much decent manner, your condition happens to be one of those.
2.) Instead of copying over the entire core file, take a look at the template and layout files for the same. Inside template, you can see that there is a code block as <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>.
Now, if you search in corresponding block for the same, you'll see, it is calling the handle additional.product.info from layout, and in layout, it is core/text_list type of block. There you have it. You can simply reference your custom code aiming at this handle and Magento will pick up your information for the display and you won't need to copy over the entire template file to your extension.
Try this approach and see if you get a cleaner extension.
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2fmagento.stackexchange.com%2fquestions%2f106859%2fmagento-show-custom-data-on-order-information-page-customer-account%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
1.) Correct : Well, it largely depends upon the file/situation you are working in. But lot of core templates allow third party extensions to inject their code in a much decent manner, your condition happens to be one of those.
2.) Instead of copying over the entire core file, take a look at the template and layout files for the same. Inside template, you can see that there is a code block as <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>.
Now, if you search in corresponding block for the same, you'll see, it is calling the handle additional.product.info from layout, and in layout, it is core/text_list type of block. There you have it. You can simply reference your custom code aiming at this handle and Magento will pick up your information for the display and you won't need to copy over the entire template file to your extension.
Try this approach and see if you get a cleaner extension.
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
add a comment |
1.) Correct : Well, it largely depends upon the file/situation you are working in. But lot of core templates allow third party extensions to inject their code in a much decent manner, your condition happens to be one of those.
2.) Instead of copying over the entire core file, take a look at the template and layout files for the same. Inside template, you can see that there is a code block as <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>.
Now, if you search in corresponding block for the same, you'll see, it is calling the handle additional.product.info from layout, and in layout, it is core/text_list type of block. There you have it. You can simply reference your custom code aiming at this handle and Magento will pick up your information for the display and you won't need to copy over the entire template file to your extension.
Try this approach and see if you get a cleaner extension.
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
add a comment |
1.) Correct : Well, it largely depends upon the file/situation you are working in. But lot of core templates allow third party extensions to inject their code in a much decent manner, your condition happens to be one of those.
2.) Instead of copying over the entire core file, take a look at the template and layout files for the same. Inside template, you can see that there is a code block as <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>.
Now, if you search in corresponding block for the same, you'll see, it is calling the handle additional.product.info from layout, and in layout, it is core/text_list type of block. There you have it. You can simply reference your custom code aiming at this handle and Magento will pick up your information for the display and you won't need to copy over the entire template file to your extension.
Try this approach and see if you get a cleaner extension.
1.) Correct : Well, it largely depends upon the file/situation you are working in. But lot of core templates allow third party extensions to inject their code in a much decent manner, your condition happens to be one of those.
2.) Instead of copying over the entire core file, take a look at the template and layout files for the same. Inside template, you can see that there is a code block as <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>.
Now, if you search in corresponding block for the same, you'll see, it is calling the handle additional.product.info from layout, and in layout, it is core/text_list type of block. There you have it. You can simply reference your custom code aiming at this handle and Magento will pick up your information for the display and you won't need to copy over the entire template file to your extension.
Try this approach and see if you get a cleaner extension.
answered Mar 18 '16 at 10:51
PrateekPrateek
1,77911129
1,77911129
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
add a comment |
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
Prateek: Would be great if you could post some code snippet for Point #2 you mentioned considering block
– Slimshadddyyy
Mar 18 '16 at 11:03
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
See CODE EDIT above. I still do not show core block being called. Do I need to put the core html file and then inject my block ?
– Slimshadddyyy
Mar 21 '16 at 6:41
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- 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%2fmagento.stackexchange.com%2fquestions%2f106859%2fmagento-show-custom-data-on-order-information-page-customer-account%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