Kodi_Babu
(Poongudivanan N)
March 15, 2016, 4:36pm
1
i want add my custom values in cart item. <block class="Magento\Checkout\Block\Cart\Item\Renderer"
there is no block name ? how to rewrite the template file.
file path : /magento/module-checkout/view/frontend/layout/checkout_cart_item_renderers.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="checkout_item_price_renderers"/>
<body>
<referenceBlock name="checkout.cart.item.renderers">
<block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="cart/item/default.phtml">
What exactly do you want to add to a cart item?
Kodi_Babu
(Poongudivanan N)
March 15, 2016, 5:11pm
3
i want to add custom values near by products name. within the
<tr class="item-info">
<td data-th="<?php echo $block->escapeHtml(__('Item')); ?>" class="col item">
<?php echo "custom values here"; ?>
<?php if ($block->hasProductUrl()):?>
<a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl() ?>"
title="<?php echo $block->escapeHtml($block->getProductName()) ?>"
tabindex="-1"
class="product-item-photo">
<?php else:?>
<span class="product-item-photo">
<?php endif;?>
file name
/magento/module-checkout/view/frontend/templates/cart/item/default.phtml
Kodi_Babu
(Poongudivanan N)
March 16, 2016, 7:31am
5
Oh… Thanks for you replay…
any example code ?
<referenceBlock name="checkout.cart.item.renderers">
<block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="cart/item/NEW_TEMPLATE.phtml">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.default.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
</block>
</block>
</referenceBlock>
Hello Poongudivanan,
Can you please let me know if the code provided by Dmitry Fedyuk hepled you in overriding the cart/item/renderers/default.phtml file.
As I have tried its not working in my module layout file ‘checkout_cart_item_renderers.xml’
<referenceBlock name="checkout.cart.item.renderers">
<block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="cart/item/NEW_TEMPLATE.phtml">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.default.actions" as="actions">
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.default.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.default.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
</block>
</block>
</referenceBlock>
So please let me know the solution for this.
Thanks in advance.
Ajay