• Resolved fghdev

    (@fghdev)


    How to add the description to the top of the product-list + category pages?

    I modified the AbstractProductList.php page to pass the desription to the shop render function, and added a custom shop.php file to my template “/jigoshop/” folder to pass description to the shop/list render function, and added the property into a custom list.php file in my template “/jigoshop/shop/” folder

    But, I’m sure this would get updated when you publish a new version of Jigoshop. Is there a better way to customize the AbstractProductList.php

    \jigoshop-ecommerce\src\Jigoshop\Frontend\Page\AbstractProductList.php
    public function render()
    {

    $query = $this->wp->getQuery();
    $products = $this->productService->findByQuery($query);
    $content = do_shortcode($this->getContent());

    return Render::get(‘shop’, [
    ‘content’ => $content,
    ‘products’ => $products,
    ‘product_count’ => $query->max_num_pages,
    ‘messages’ => $this->messages,
    ‘title’ => $this->getTitle(),
    ‘description’ => $query->queried_object->description,
    ]);
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Instead of modifying the AbstractProductList.php file, modify the “shop.php” template by adding

    <?php elseif (\Jigoshop\Frontend\Pages::isProductCategory()) : ?>
        <?= apply_filters('jigoshop\shop\content\title', '<h1 class="page-title">' . $title . '</h1>', $title); ?>
    <strong>    <?= '<h2>' . get_queried_object()->description . '</h2>'; ?>

    after line 14 ??

    Thread Starter fghdev

    (@fghdev)

    I took out the apply_filters line since it duplicated the category header.

    Thanks Marcin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding the category description to the top of the category page’ is closed to new replies.