1

I'm struggling with a theme change. I would like to move the add to wishlist and add to compare actions from next to the add to cart button to next to the price.

what my theme (unfinished) looks like now: enter image description here

what the designer wants: enter image description here

I am trying to avoid copying a bunch of phtml files in my theme, I have seen it is possible to move the element with

<move element="category.product.addto.compare" destination="destination" />

however Im wondering how can I find the layout name of the price section? Path hints show me the phtml files and the block class names but does not seem to help me find the *layout names.

  • Can you check your themes list.phtml? – Sukumar Gorai Sep 18 '18 at 17:20
  • Thanks your comment was the one that really summarizes what seems to be the answer the best. I do not have a list.phtml yet in my theme (it inherits the Blank Magento theme) but I can find that the things I want to change are in there in the parent theme (at vendor/magento/module-catalog/view/frontend/templates/product/list.phtml). So basically since its all in this html template (the stuff I want to move, its container and the container I want to move to). I guess it means there is no way this can be changed just with layout xml but I'll need to copy list.phtml in my theme and modify it. – Pierre-Verthume Larivière Sep 19 '18 at 15:06
  • Are you using your theme's parent theme as blank theme? – Sukumar Gorai Sep 19 '18 at 15:20
  • Check my answer. – Sukumar Gorai Sep 19 '18 at 15:26
  • yes Sukumar I am using Magento blank as parent theme, and your answer is what worked for me. Thanks! – Pierre-Verthume Larivière Sep 21 '18 at 15:22
1

You need to copy the following file:

/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml

To

/app/design/frontend/Vendor/theme/Magento_Catalog/templates/product/list.phtml

And move the below code snippet:

<div data-role="add-to-links" class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>>
    <?php if ($addToBlock = $block->getChildBlock('addto')): ?>
        <?= $addToBlock->setProduct($_product)->getChildHtml() ?>
    <?php endif; ?>
</div>

Just after the below code snippet:

<?= /* @escapeNotVerified */ $block->getProductPrice($_product) ?>

Now what you need to do is css fixing.

  • yep, dont have enough rep to upvote but that is the answer that worked for me – Pierre-Verthume Larivière Sep 21 '18 at 15:20
  • You can accept the answer by clicking the tick mark near my answer. – Sukumar Gorai Sep 21 '18 at 15:29
0

The default xml for said layout should be in vendor/magento/module-catalog/view/frontend/layout/

I don't have a magento installation right here but let me know.

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.