Feature: Suppliers (extra fields / translations)

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Yvler
Posts: 33
Joined: 04 Jun 2015, 10:15

Feature: Suppliers (extra fields / translations)

Post by Yvler » 29 Jul 2015, 13:29

Hi Aimeos

I'm back with another request ;-)
Is it possible to upgrade "suppliers" like the "catalog"? We would like to add attributes to it, and add translations :)

We would like to use this as the storage for brands for products..
but a brand has another name in different languages
(for example: Calippo is a product and "Ola" is the brand.. but in Spain, the brand "Ola" is called "Frigo")
and we'd like to add a description field to the supplier/brand for extra information and some other fields.. :)

Is this possible? Is there already a plan to change this or can we just change / extend the code ourself?

Yvler
Posts: 33
Joined: 04 Jun 2015, 10:15

Re: Feature: Suppliers (extra fields / translations)

Post by Yvler » 29 Jul 2015, 14:40

Also: we noticed supplier isn't linked with a product. How can print a label on items-body-default.html?
Should I define a manager again and get it via searchItems?

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

Re: Feature: Suppliers (extra fields / translations)

Post by aimeos » 29 Jul 2015, 20:18

Yvler wrote:Is this possible? Is there already a plan to change this or can we just change / extend the code ourself?
We would love to get a pull request from you :-)

I will guide you through so you know what you have to do:
1.) Add a list and list type type to the SQL definition in lib/mshoplib/setup/default/schema/mysql/supplier.sql (copy/paste/adapt from another domain with a list table)
2.) Add the SQL statements to the configuration in lib/mshoplib/config/{common,mysql}/mshop/supplier/manager/... and adapt it to your SQL table definition (same as in other domain again)
3.) Implement a new supplier list and list type manager (copy/paste/adapt too)
4.) Write the unit tests for the supplier list and list type manager (you know what to do *gg*)

As you have your own administration interface, I think you are not interested in extending the existing one as well, do you?

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

Re: Feature: Suppliers (extra fields / translations)

Post by aimeos » 29 Jul 2015, 20:27

Yvler wrote:Also: we noticed supplier isn't linked with a product. How can print a label on items-body-default.html?
The supplier code is part of the product item, so currently you can have a 1:n relation between supplier and products.
Yvler wrote:Should I define a manager again and get it via searchItems?
Each product block in the items-body-default.html isn't extensible by its own subpart. That would be too expensive when thinking about performance. You should extend the existing client html catalog list item class, overwrite the _setViewParams() method to add the supplier items for all product items and overwrite the items-body-default.html template with your own version where you add the supplier data you need.

Keep in mind that this will slow down rendering the list views because you will load a lot of data if you fetch the supplier, list attribute and attribute texts in the list view!

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

Re: Feature: Suppliers (extra fields / translations)

Post by aimeos » 30 Jul 2015, 10:35

aimeos wrote: The supplier code is part of the product item, so currently you can have a 1:n relation between supplier and products.
We discussed this internally and it might be a better idea to use the product list to associate suppliers to products. This would not only make m:n relations possible but can ease the handling of suppliers in the templates too because the supplier items could be loaded in the list view instantly by only configuring the domains used for searchItems() (https://aimeos.org/docs/Configuration/C ... st/domains).

You should use the texts associated to a supplier to display the localized names in the product list because it's much faster to load the suppliers including the associated items then loading first these data and afterwards the attributes with all associated data too (fetch only 2 levels instead of 3 levels of data).

Yvler
Posts: 33
Joined: 04 Jun 2015, 10:15

Re: Feature: Suppliers (extra fields / translations)

Post by Yvler » 30 Jul 2015, 13:01

Can you clear your last post? :)
We're not understanding what we have to do.

What we have is an item display on the list page and detail page, where we have a product like this:
"Calippo
- image of the calippo
- Supplier/brand name in the language of the site: Ola
- supplier logo
extra info of the product..."

Correct me if i'm wrong:
you're saying that we should use the product list table/manager (like we need to use to get the price or text) to store supplier and supplier data?
how do translations work for these list items? and how do we give a list item extra attributes like a logo or description?
orrr... do we have to link the supplier id (supplier table) to a list item of a product?


Or is it maybe a better idea to extend the whole system for brands? :)
We don't have any experience for this atm. Until now, we could just use the managers to get, create, update, delete items via our own admin interface :)

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

Re: Feature: Suppliers (extra fields / translations)

Post by aimeos » 30 Jul 2015, 13:18

Yvler wrote: orrr... do we have to link the supplier id (supplier table) to a list item of a product?
Yes, that's exactly what I've meant. This simplifies some things and offers more flexibility too.
Yvler wrote: Or is it maybe a better idea to extend the whole system for brands? :)
No, the supplier domain is exactly build for that :-)

Yvler
Posts: 33
Joined: 04 Jun 2015, 10:15

Re: Feature: Suppliers (extra fields / translations)

Post by Yvler » 30 Jul 2015, 13:23

OK! Great!
And if we add the supplier id as the ref ID in the list, can we just fetch the supplier label in the product list/detail view?

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

Re: Feature: Suppliers (extra fields / translations)

Post by aimeos » 30 Jul 2015, 13:35

Yvler wrote: And if we add the supplier id as the ref ID in the list, can we just fetch the supplier label in the product list/detail view?
Yes, that would be automatically available in the supplier item attached to the product if you configure the fetched domains to include the supplier domain as well:
- https://aimeos.org/docs/Configuration/C ... st/domains
- https://aimeos.org/docs/Configuration/C ... il/domains

Yvler
Posts: 33
Joined: 04 Jun 2015, 10:15

Re: Feature: Suppliers (extra fields / translations)

Post by Yvler » 12 Aug 2015, 11:38

Hi

We linked the products with the suppliers.
Now, we're taking the next step..
We'd like to add a logo to a supplier (media), a description (text) and a discount at supplier level (hidden attribute -> prices are calculated in a cronjob and written to the products)
What is the best way to link these items to a supplier (mshop_supplier)? Via the list tables of the the items itself (mshop_text_list, mshop_attribute_list, mshop_media_list) or add an extra list table to suppliers (mshop_supplier_list)?

As a result of this, we would like to generate a list (like the categories listing) on the front end with products of a specific supplier, with the supplier logo and description on top of the listing :). (how do we extend this?)

cheers

Post Reply