Jump to content

About Categories on Homepage


Recommended Posts

Hello Gus,

I have one question

I want to put the categories on the home page. Now I have seen you hook that I took. The question is whether it is possible that from that category he takes the first lowest price from that product.

includes/hook/Products_Tables.php

<?php

// 

use Illuminate\Database\Capsule\Manager as Capsule;


if (!defined("WHMCS"))
  
die("This file cannot be accessed directly");

function hook_getProductGroups($vars) {

    $getProductGroups = Capsule::table('tblproductgroups')
        ->where('tblproductgroups.hidden', '0')
        ->select('id', 'name')
        ->orderBy('order', 'asc')
        ->get();

    $encodedata = json_encode($getProductGroups);
    $decodedata = json_decode($encodedata, true);

    return array("productgroups" => $decodedata);
}

add_hook("ClientAreaPageHome", 1, "hook_getProductGroups");

homepage.tpl

{foreach $productgroups as $pgroup}
    <div class="col-md-4">
        <div class="panel panel-default">
            <div class="panel-heading">{$pgroup.name}</div>
            <div class="panel-body">
                <!-- Something like this
                {$pgroup.monthly}<span>/month
                -->
            </div>
            <div class="panel-footer">
                <a href="cart.php?gid={$pgroup.id}" class="btn btn-primary">order</a>
            </div>
        </div>
    </div>
   {/foreach}

i know there are probably made themes but i really can't find what i want

Link to comment
Share on other sites

8 hours ago, rade023 said:

I want to put the categories on the home page.

it's probably worth mentioning that in v8.1 (still in beta), if you choose the new '21' theme, then product categories are shown on the homepage by default...

Kg4VPnt.png

it's a very boring design, but the product groups will be there without the need for a hook.

8 hours ago, rade023 said:

The question is whether it is possible that from that category he takes the first lowest price from that product.

that's just a change to the query, but you'd have to be very specific about exactly what you were looking for... the lowest price could mean different things to different people - e.g is the actual lowest price $10 monthly instead of $100 annually, or is $100 annual the lowest price??

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated