Get supplier id from product

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!
DmS
Posts: 56
Joined: 09 Aug 2021, 08:59

Get supplier id from product

Post by DmS » 04 Mar 2022, 15:16

I'm trying to get supplierdata from a product item in a template.

It's in the file ext/<site>/client/html/templates/catalog/detail/body-standard.php
in product list when you are in a category I have this where the products are listed

Code: Select all

//this is what returns the products

<?php foreach ($this->get('products', []) as $id => $productItem) : ?>
//other code 

dump ($productItem->getSupplierItems()); //trying to get supplier data, but does not return any items

//all code to list products

<?php endforeach ?>
Everything in the page works, but I need to add supplier-data per product, how do I get that in the template
_____________
Laravel 8 with Aimeos 2021.10.7 + Marketplace. Setup via composer. Mac with Valet and MySql 8.0.25

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

Re: Get supplier id from product

Post by aimeos » 06 Mar 2022, 14:17

Make sure that "supplier" is passed as domain while fetching the data. This is done be this configuration:
https://aimeos.org/docs/2021.x/config/c ... l/#domains

To fetch supplier data too use for "client/html/catalog/detail/domains":

Code: Select all

['attribute', 'media', 'media/property', 'price', 'product', 'product/property', 'supplier', 'text']
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

DmS
Posts: 56
Joined: 09 Aug 2021, 08:59

Re: Get supplier id from product

Post by DmS » 07 Mar 2022, 06:28

Thank you, that solved it, once I figured out that I should use /lists/ instead of /detail/ in the conf :)
_____________
Laravel 8 with Aimeos 2021.10.7 + Marketplace. Setup via composer. Mac with Valet and MySql 8.0.25

User avatar
loeffe1
Posts: 52
Joined: 21 Feb 2020, 10:33

Re: Get supplier id from product

Post by loeffe1 » 23 May 2023, 09:47

I have added this to my typoscript

Code: Select all

catalog {
	detail {
		domains {
          0 = attribute
          1 = media
          2 = media/property
          3 = price
          4 = product
          5 = product/property
          6 = text
          supplier {
	        0 = text
	        1 = media
	        2 = supplier/address
          }
        }
	}
}
However I am not getting the supplier on the product detail page. What am I doing wrong?

User avatar
loeffe1
Posts: 52
Joined: 21 Feb 2020, 10:33

Re: Get supplier id from product

Post by loeffe1 » 23 May 2023, 09:54

I see his is how it is done in v22

Code: Select all

0 = attribute
              1 = attribute/property
              2 = catalog
              3 = media
              4 = media/property
              5 = price
              6 = product
              7 = product/property
              8 = supplier
              9 = supplier/address
              10 = text
But why do I need to explicitly add this, when it supposedly is the default setting?

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

Re: Get supplier id from product

Post by aimeos » 24 May 2023, 09:28

Did you overwrite "client/html/catalog/domains" before?

catalog/lists: https://github.com/aimeos/ai-client-htm ... #L431-L497
catalog/detail: https://github.com/aimeos/ai-client-htm ... #L281-L321
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply