Come possiamo ignorare questa posizione nell'opzione personalizzata per mostrarla in un altro file phtml.
aggiunto questo codice in checkout_cart_index.xml
cui sovrascrive solo il form.phtml
non sovrascrivere il default.phtml
file.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<!-- <update handle="checkout_cart_item_renderers"/> -->
<body>
<referenceContainer name="content">
<referenceBlock name="checkout.cart.form">
<action method="setTemplate">
<argument name="template" xsi:type="string">Bespoke_Bespoke::cart/form.phtml</argument>
</action>
</referenceBlock>
<referenceBlock name="checkout.cart.item.renderers.override">
<action method="setTemplate">
<argument name="template" xsi:type="string">Bespoke_Bespoke::cart/item/default.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
sto ricevendo un errore per quanto riguarda il fatto che checkout.cart.item.renderers
ha già un figlio con alias 'semplice' di cui ho modificato il filecheckout_cart_item_renderer.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.form">
<action method="setOverriddenTemplates">
<argument xsi:type="array">
<!-- list override templates -->
<item name="default" xsi:type="string">Bespoke_Bespoke::cart/item/default.phtml</item>
<item name="simple" xsi:type="string">Bespoke_Bespoke::cart/item/default.phtml</item>
<item name="virtual" xsi:type="string">Bespoke_Bespoke::cart/item/default.phtml</item>
</argument>
</action>
</referenceBlock>
</body>
</page>
per sovrascrivere il file che abbiamo usato etc/di.xml
<config xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Checkout\Block\Cart\AbstractCart" type="AGS\Bespoke\Block\Checkout\Cart\AbstractCart"/><preference for="Magento\Catalog\Block\Product\View\Option" type="AGS\Bespoke\Block\Product\View\Option"/>
<preference for=" Magento\Checkout\Block\Cart" type="AGS\Bespoke\Block\Checkout\Cart"/>
<preference for="\Magento\Checkout\Block\Cart\Item\Renderer" type="AGS\Bespoke\Block\Checkout\Cart\Item\Renderer"/>
<virtualType name="AGS\Bespoke\Model\ResourceModel\Bespoke\Bespoke\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments><argument name="mainTable" xsi:type="string">ags_bespoke</argument><argument name="resourceModel" xsi:type="string">AGS\Bespoke\Model\ResourceModel\Bespoke</argument>
</arguments></virtualType><type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments><argument name="collections" xsi:type="array">
<item name="bespoke_record_bespoke_list_data_source" xsi:type="string">AGS\Bespoke\Model\ResourceModel\Bespoke\Bespoke\Collection</item>