5

I've set up a child theme of Luma and want to change the layout of my individual product detail page. What file controls this? I don't see the .phtml file and don't see how changing block order in my xml will accomplish what I need to do.

1

There isn't a single template file for the product page, you can manipulate it by layout.

See here the doc.

The main layout file is magento/module-catalog/view/frontend/layout/catalog_product_view.xml

In order to see the templates that forms the parts of your page, you can activate the template hints in:

Store -> Configuration -> Advanced -> Developer -> Debug > Enabled Template Path Hints for Storefront > Yes

  • You should add that in order to properly change it, you will need to add the files to your custom theme keeping path directives properly. – Ezequiel Alba Aug 30 at 20:52
0

To change the layout of individual product detail page, as you have created the child theme assuming your child theme path is something like this

magento_root/app/design/frontend/company_name/theme_name/

Now navigate to your child theme and follow these steps.

  1. Create a folder Magento_Catalog and inside it create another folder layout, so the path now looks like this (magento_root/app/design/frontend/company_name/theme_name/Magento_Catalog/layout).
  2. Copy your xml file from magento_root/vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml
    • Do not edit this as this is core file.
  3. Paste the xml file under magento_root/app/design/frontend/company_name/theme_name/Magento_Catalog/layout/ now edit this as required.
  4. Create the following path magento_root/app/design/frontend/company_name/theme_name/Magento_Catalog/templates/product/view
  5. Go to magento_root/vendor/magento/module-catalog/view/frontend/templates/product/view/ where all .phtml files are located which gets required data into product details page.
  6. Copy the required .phtml files from core folder(magento_root/vendor/magento/module-catalog/view/frontend/templates/product/view/) to your child theme folder(magento_root/app/design/frontend/company_name/theme_name/Magento_Catalog/templates/product/view) and edit them as required.

Hope this helps your question.

0

You have to change inside layout xml file,

if you want to display product details page 2column left then change file is catalog_product_view.xml

set layout value layout="2columns-right" inside <page> node.

< page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-right" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.