SilverCart Forum

We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?

You can help us helping you by providing detailed error messages, screenshots and logfile entries.

SebastianRamon

Page: 1 , 2
Topic Special product type - what is the right way? 5617 Views

Special product type - what is the right way?

15 February 2013 at 10:04pm

Hi guys,

1.3.5 is excelent piece of work. Great progress from 1.2 which I tested lastly.

I will definitely use it for production site in current project, most complicated things are working (slovak language, import/export of products /delimiter problem/, variations), installation and default setup wasn't easy (complicated payment/shipping setup), but im ready now ;)

My question: i have special product type with some custom fields. Almost all products in store use same custom fields. Probably simplest way is to use DataObjectDecorator for SilvercartProduct dataobject, but what is correct way for stores with 5 - 6 product types? Creating SpecialXYSilvercartProduct types extending SilvecartProduct? Any cons here (e.g. import/export will need some adjustments, ...)? How about plugin mechanis, can i use it here?

Kind regards.

Pali

Re: Special product type - what is the right way?

19 February 2013 at 4:36pm

Hello Pali,

thanks for your kind words, hopefully SilverCart will serve you well :)

In order to add custom fields to a SilvercartProduct you should always use the DataObjectDecorator pattern; otherwise you'd have to adjust calls to SilvercartProduct in quite a few places in your ascending classes and other files (e.g. SilvercartProductGroupPage etc...).

If there are several product types you could prefix the custom field names in your decorating classes in order to distinguish them.

Plugin mechanics don't have any advantages over the DataObjectDecorator pattern in the described use case.

All the best,
Sascha

Re: Special product type - what is the right way?

1 March 2013 at 2:34pm

Hello Sascha,

thanks for your info. I have one more question regarding this: my decorator is ready with sume custom fields. How can i show this fields in CSV export pls. I tried almost everything (summaryFields, updateColumnsAvailable in CollectionController) adding it in decorator or hardcoded to core class, but no luck :( Any hint here, pls.?

Anyway, import works fine, if I add properly named column, data are stored correctly...

Best regards

Pali

Re: Special product type - what is the right way?

1 March 2013 at 3:27pm

Hello Pali,

if your decorator adds new $db-fields to SilvercartProduct they should appear automatically in the backend product export admin (under "CSV field definitions").

By pushing them from "Not attributed fields" to "Attributed fields" they should be available in the generated CSV export file.

All the best,
Sascha

Re: Special product type - what is the right way?

1 March 2013 at 3:35pm

Hello Sascha,

i see it in list (specification activated by click), but when i hit export, these fields are not in CSV :(

What does it mean pushing from Not attributed fields to Attributed fields? How can i do this?

Regards

pali

Re: Special product type - what is the right way?

1 March 2013 at 3:45pm

In the administration area for product exports there is a tab "CSV field definitions" with two boxes "Not attributed fields" and "attributed fields".

See this screenshot:

Only fields that are in the "attributed fields" box will appear in the export file.

Re: Special product type - what is the right way?

1 March 2013 at 6:27pm

Ah, ok, i didnt use Product Exporter feature, but button which is in products section in model admin (below list of products).

Is this button customizable somehow (somewhere must be defined which columns will be included in this export).

Kind regards

Pali

Re: Special product type - what is the right way?

4 March 2013 at 1:53pm

Hello Pali,

currently the CSV field list for products is hard coded in the file "/silvercart/code/backend/SilvercartProductTableListField.php" (variable $fieldListCsvSpecial).

In SilverCart 1.3.6 we'll implement a mechanism to override the field list.

SilverCart 1.3.6 should be available in 2 to 3 days, I'll write a how-to here when this version is published.

All the best,
Sascha