Fetch products on homepage

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
umair040
Posts: 5
Joined: 19 Dec 2018, 05:54

Fetch products on homepage

Post by umair040 » 19 Dec 2018, 07:19

We are using aimeos laravel package and we want to fetch all products and products by category on front page. Currently we are fetching products on category page like this: https://demo.com/{category}/{category_id}

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Fetch products on homepage

Post by aimeos » 20 Dec 2018, 11:59

The default output of the list view (without any parameters) lists all products. You only have to add that component to your home page: https://aimeos.org/docs/Laravel/Create_new_pages
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

umair040
Posts: 5
Joined: 19 Dec 2018, 05:54

Re: Fetch products on homepage

Post by umair040 » 28 Dec 2018, 08:30

I have got the product data like this.

Standard {#2375 ▼
-values: array:16 [▼
"product.id" => "14"
"product.siteid" => "1"
"product.typeid" => "1"
"product.code" => "demo 123 article"
"product.label" => "Demo article new"
"product.config" => []
"product.datestart" => null
"product.dateend" => null
"product.status" => "1"
"product.ctime" => "2018-05-27 11:21:02"
"product.mtime" => "2018-06-21 14:09:40"
"product.editor" => "demo@gmail.com"
"product.target" => ""
"product.type" => "default"
"product.typename" => "Article"
"date" => "2018-12-28 08:14:00"
]
-propItems: []
-refItems: array:3 [▶]
-listItems: array:3 [▶]
-prepared: false
-bdata: array:16 [▶]
-prefix: "product."
-available: true
-modified: false
}

How i can get product target link to navigate to product page?

umair040
Posts: 5
Joined: 19 Dec 2018, 05:54

Re: Fetch products on homepage

Post by umair040 » 28 Dec 2018, 08:30

And also how we can get category which we assigned to the product?
Last edited by umair040 on 28 Dec 2018, 08:33, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Fetch products on homepage

Post by aimeos » 28 Dec 2018, 13:16

Here you can see how to can retrieve the config for the detail target page:
https://github.com/aimeos/ai-client-htm ... rd.php#L48

Use the "$this->url()" view helper to build the link
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Fetch products on homepage

Post by aimeos » 28 Dec 2018, 13:24

Products can be in several categories. You should pass the f_catid parameter to know from which category the user is coming from.

If you want to display the categories along with the products, you can extend the HTML client to fetch the relations between categories and products.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply