Product Thumbnails On Vendor Pages

I would like to add some product thumbnails to each vendors profile page



{assign var=“obj_id” value=$company_data.company_id}

{assign var=“products” value=$obj_id|fn_get_products}



I’ve tried to get the products using the company_id and the get_products function but it doesn’t seem to work





How do you know what variable names to use to call up the info?



Any ideas?



thanks

Hi janskor,



Getting array of products is better to do on PHP side. For this you may add the “app/addons/my_changes/controllers/frontend/companies.post.php” file for version 4.x with the following content:


```php


if (!defined('BOOTSTRAP')) { die('Access denied'); }

if ($mode == 'view') {
$params = array(
'company_id' => $_REQUEST['company_id'],
'limit' => 10,
);

list($products) = fn_get_products($params);

$view->assign('products');
}
```

NOTE: For version 2.x or 3.x the full filename should be "addons/my_changes/controllers/customer/companies.post.php"
NOTE: The change will work properly only if the "My changes" module is activated

Additionally you may add params like "sort_order" and "sort_by" and change limit to the necessary one.


After this you can use this array in Smarty to draw thumbnails.

I hope it helps.

Best regards,
Sergei

[quote name='mink' timestamp='1398841814' post='182680']

Hi janskor,



Getting array of products is better to do on PHP side. For this you may add the “app/addons/my_changes/controllers/frontend/companies.post.php” file for version 4.x with the following content:


```php


if (!defined('BOOTSTRAP')) { die('Access denied'); }

if ($mode == 'view') {
$params = array(
'company_id' => $_REQUEST['company_id'],
'limit' => 10,
);

list($products) = fn_get_products($params);

$view->assign('products');
}
```

NOTE: For version 2.x or 3.x the full filename should be "addons/my_changes/controllers/customer/companies.post.php"
NOTE: The change will work properly only if the "My changes" module is activated

Additionally you may add params like "sort_order" and "sort_by" and change limit to the necessary one.


After this you can use this array in Smarty to draw thumbnails.

I hope it helps.

Best regards,
Sergei
[/quote]

Let me note some corrections. The following content should be used for 4.x versions:

```php
use Tygh\Registry;
if (!defined('BOOTSTRAP')) { die('Access denied'); }
if ($mode == 'view') {
$params = array(
'company_id' => $_REQUEST['company_id'],
'limit' => 10,
);
list($products) = fn_get_products($params);
Registry::get('view')->assign('products', $products);
}
```

Thanks.

Sergei,



Works like a charm. Thank you very much for this



Jan