Results 1 to 13 of 13

Thread: Overwrite renderField method in Catalog

  1. #1
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Overwrite renderField method in Catalog

    Hi,

    Would like to thank the development team for such a great module. I am using it to create Catalogs related to each other. All works fine. But when the catalog field type is select and refers to other catalog fields, its values are not rendered in the backend. Secondly, I have some catalogs that only have reference fields and no title fields.

    Am I using the Catalog incorrectly. Because I was able to get all the functionality that I wanted without writing a single line of code. The problem is if all the fields in a catalog are of type select (referencing other tables/catalogs), it doesn't render any value other than the id of the record in the catalog in the backend. Is this an intended functionality. I would like to overwrite "renderField" method to show the values from the catalog based on the field id. Was able to do it by updates to "renderField" in "Catalog.php". But I don't want to update the core modules.

    Would like to overwrite the "renderField" in my own extension without changing the core modules. Can anybody point me in the right direction.

    Thanks in advance.
    Ajay

  2. #2
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi,

    I am uploading some images for reference as to how the current output on the backend looks, how after code update the expected results are displayed and what are the fields in the Catalog.

    The intention here is to let the backend user see the referenced values, instead of the referenced ids or the catalog record id.

    Thanks in advance.

  3. #3
    User
    Join Date
    06-19-09.
    Location
    Kosice, Slovakia
    Posts
    61

    Default Re: Overwrite renderField method in Catalog

    You may try to override catalog settings in dcaconfig.php - not sure if it works, but give it a try, we may find some other solution if not.
    S.C.A.R.E

  4. #4
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Overwrite renderField method in Catalog

    Two things...

    1. You need to have the field enabled - [x] Visible in back-end list view - otherwise it won't show. You can ONLY show tags and selects in the new Alpha version - which I strongly recommend you upgrade to as its suitable to use for production sites -- as mostly the BE has changed. You can just avoid the new FE editing features that aren't working 100% yet.

    2. Once activated, you need to optionally specify the render string, e.g. {{myfield}} in the format title string area of the catalog's edit screen.

    This (has) and will always lookup the select/tags and display them as a string or comma seperated string (for tags).

  5. #5
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi Thyon and Scare,

    Thanks for the quick response.
    1. I have already enabled the fields for display in the backend. I would surely upgrade to the new alpha version and would report the status back.

    Meanwhile, I tried one more option based on Scare's feedback.

    I already have my custom extension for some other purpose. In the config file of the custom extension, I inserted a hook for "'regenerateDca'" that points to a "CustomCatalog.php" in my custom extension. The "CustomCatalog.php" is extended from existing "Catalog.php". In "CustomCatalog", I am pointing both "child_record_callback" and "label_callback" functions in getDefaultDca function ("CustomCatalog": overwritten Catalog) to "renderField" function ("CustomCatalog": overwritten Catalog) which has my code for display of relevant values.

    I regenerated the DCA and it used my "CustomCatalog" for regenerating the DCA, but when the values are rendered it doesn't use my overwritten method. It falls back on the "Catalog.php" module "renderField" method. Is there something missing that I have not considered. This information would help me out in future customizations, if required.

    Please let me know your thoughts on this while I upgrade to the alpha version.

    Thanks,
    Ajay

  6. #6
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi Thyon,

    Apologies for a stupid question. How and where can I get the alpha version you were talking about. Couldn't find it out in the "Extension Catalog" list under state Alpha.

    Thanks,
    Ajay

  7. #7
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Overwrite renderField method in Catalog

    In the forum at the top is a sticky topic which provides the link.

  8. #8
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi Thyon,

    Thanks a lot for all the timely help. Was able to see all the fields listed properly without a single line of code written anywhere.

    One more question I had, don't know whether it makes sense. Can we have a select field type where we can have a callback function to fetch values for the options either from the code itself or from a different database.

    Thanks,
    Ajay

  9. #9
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Overwrite renderField method in Catalog

    yes in the new Alpha version you can -- as a developer -- create ANY field type you like. Included in the Alpha is xtra's are some example fieldtypes, he created for other projects -- a ajaxrating field, etc.

    For your situation, a select is usually made of 2 situations -- custom text values and database retrieved values.... either case you can use another tl_xxxx table, another catalog table cat_xxxx or simply use the taxonomy application tl_taxonomy, which is why it was created in the first place -- to provide a hierarchy of tree values that can create categories...

    Some people have had great success using the tl_page with a set root point to create product categories for their site (as each page basically retrieves the data only for that "page" or category).

  10. #10
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi Thyon,

    Thanks for all the information. Will surely evaluate and implement the solutions specified by you. Alpha version seems to be the exact fit for the functionality we are looking for. When will this go live as a stable version, b'cos we just upgraded from 2.7.9 to 2.8 on production.

    Thanks,
    Ajay

  11. #11
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Overwrite renderField method in Catalog

    Its only Alpha because of the FE. The BE is pretty much stable for production. I've used it on production sites...

  12. #12
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi Thyon,

    Thanks again for a quick reply. When we upgrade Catalog to alpha on production, do we need to make any changes in Catalog_ext modules as well. B'cos as soon as we updated the catalog to alpha and updated the database, it started giving errors on the backend for catalog and modules relevant to catalog ext.

    We are using Catalog Extension modules for presenting the catalogs on the front end.

    Error on click of modules link in nav. on the backend.
    "Fatal error: Cannot redeclare class tl_module_catalog in /home/gaurisa2/public_html/system/modules/catalog_ext/dca/tl_module.php on line 651"

    Please let us know what changes might be required to avoid such errors. Secondly do we have a compatible catalog extension alpha version, which we can download and implement.

    Hope am not asking too many queries, but we have some unresolved issues as our end.

    Thanks,
    Ajay

  13. #13
    New user
    Join Date
    12-21-09.
    Posts
    10

    Default Re: Overwrite renderField method in Catalog

    Hi Thyon,

    I uninstalled all catalog and catalog associated extensions from production. Re-installed catalog extension alpha version. No errors, One change I had to do in CatalogExt.php and Config files, renamed "removeOldFeeds" to "removeOldSubscriptions" as it was giving a conflict with Controller function.

    Thanks,
    Ajay

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •