Jump to content

Show products in home page


Amit9713

Recommended Posts

Hi i tried to render the products on home page but it is not showing

 

<?php

use Illuminate\Database\Capsule\Manager as Capsule;

function hook_getProductGroups($vars){

    $getProductGroups = Capsule::table('tblproductgroups')->where('tblproductgroups.id','2')->select('id','name','headline','tagline')->first();
    $decodedata = json_decode(json_encode($getProductGroups), true);
    return array("productgroup" => $decodedata);
}
add_hook("ClientAreaPageHome", 1, "hook_getProductGroups");

 

This is my hook and it not returning on homepage.tpl

 

I used  {debug} but no object is there

 

Link to comment
Share on other sites

On 02/09/2020 at 13:13, Amit9713 said:

This is my hook and it not returning on homepage.tpl

physically, it won't output anything in the template.. unless you've modified homepage.tpl to output the returned array.

On 02/09/2020 at 13:13, Amit9713 said:

I used  {debug} but no object is there

then are you sure that you have a product group #2?

if you pass it a group that doesn't exist, then it won't return anything.... but if you give it a group that exists, it will return the selected information.

xhgnkVb.png

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