2

I want display brand name above product name on product list something like that: enter image description here

Additionally, it needs an additional inscription before the sale price text: "Retail price": enter image description here

can anyone help me which files should I edit?

I have found in app/design/frontend/{yourpackage}/{yourtheme}/template/catalog/product/list.phtml

                <div class="product details product-item-details">
                    <h5 class="product name product-item-name">
                        <a class="product-item-link" href="<?php echo $_product->getProductUrl() ?>">
                            <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
                            <?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getBrand(), 'brand') ?>
                        </a>
                    </h5>

                    <?php if(!$themeHelper->getStoreConfig('mpanel/catalog/review')): ?>
                        <?php echo $block->getReviewsSummaryHtml($_product, $templateType,true); ?>
                    <?php endif ?>

                    <?php echo $block->getProductPrice($_product) ?>

                    <?php echo $block->getProductDetailsHtml($_product); ?>
                    <?php if ($themeHelper->getStoreConfig('mpanel/catalog/disable_add_to_cart') == 0 && $themeHelper->getStoreConfig('mpanel/catalog/disable_hover_effect') == 1): ?>
                        <?php if ($_product->isSaleable()): ?>
                            <div>
                                <?php $postParams = $block->getAddToCartPostParams($_product); ?>
                                <form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $this->getUrl('checkout/cart/add', ['uenc'=>$postParams['data']['uenc'], 'product'=>$postParams['data']['product']]); ?>" method="post">
                                    <input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $postParams['data']['product']; ?>">
                                    <input type="hidden" name="uenc" value="<?php /* @escapeNotVerified */ echo $postParams['data']['uenc']; ?>">
                                    <input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" />
                                    <button class="action tocart btn-cart hover_effect" type="submit" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
                                        <span class="icon pe-7s-shopbag"></span>
                                        <span class="text"><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
                                    </button>
                                </form>
                            </div>
                        <?php endif ?>
                    <?php endif ?>
                </div>

and add this line but after replace file still no work. Can you confirm that I put it in the right place?

1

You have to find the phtml for this listing. At that's case, you can help you can help of Template Path Hints

Then add this above the product name

<?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_product->getBrand(), 'brand') ?>

Also.you need enables for brand attribute for product listing from Admin >Stores > Attributes > Product> Find your brand attribute . Then Used in Product Listing” options under storefront Properties are set to Yes. This blog also help on this https://rafaelstz.github.io/magento/magento2-display-custom-attribute-catalog-list-products.html

  • I have update my topic. – Sylvester Jul 18 '18 at 13:10

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.