Extend The Index Of Sravendors

Hi,

can you extend the SraVendors, so that we can add additional fields to the Vendor Array.

You delete all of the fields, who are not set in $response_fields.

Maybe you can create a function with hook, to extend the $response_fields Variable.

Hello,

What do you mean by "SraVendors"? What is that? Do you want to add more fields to vendor configuration?

Best regards,

Robert

This is a Class of storefront_rest_api Addon.

You should change the following file

app/addons/storefront_rest_api/Tygh/Api/Entities/v40/SraVendors.php

I have it. But I want to have these changes in the next update, so we do not have added our changes after next updates.

If it's a defect, you can submit it to the bugtracker and in a year or so it MIGHT be added.

If it's your own enhancement you can contact helpdesk and ask them to give you a price for including it in an upcoming release (if they deem it is beneficial for everyone). Otherwise you'll be left to update it at each release. Sure you can't use a hook in the functional area of the product to extend the data you want to extend?

I have it. But I want to have these changes in the next update, so we do not have added our changes after next updates.

Unfortunately, this class does not have hooks. But you can extend the API. For example, create v50 directory and your custom SraVendrors class there and use v50 version in API request

Or CS Cart Devs can add an Hook. That costs maybe 5 seconds of time and can maye help more storeowners than me alone. I think, this is the function of Hooks, to extend the core, without changing original files ;-)

This is my solution for the Moment


This is my solution for the Moment

17032020112720.jpg

Hello

After updating the program, your changes may be overwritten. You must remember to check it after each update.

Best regards

Robert

Or CS Cart Devs can add an Hook. That costs maybe 5 seconds of time and can maye help more storeowners than me alone. I think, this is the function of Hooks, to extend the core, without changing original files ;-)

Please make a post here

https://forum.cs-cart.com/topic/40547-your-add-on-needs-a-new-hook-in-cs-cart-post-it-here/page-9?

Done! 8)

Why don't you just use the existing 'get_company_data' hook in the function fn_get_company_data() in the file app/functions/fn.companies.php

Do you really have a need to go down to the class level?

Why don't you just use the existing 'get_company_data' hook in the function fn_get_company_data() in the file app/functions/fn.companies.php

Do you really have a need to go down to the class level?

1. This function is not used in the API

2. List of available fields is hardcoded in the class. Other fields are deleted there

Exacly @eComLabs This is the Problem.

1. This function is not used in the API

2. List of available fields is hardcoded in the class. Other fields are deleted there

Well that should be fixed. Data is data and should be consistent throughout. The 'orders' API uses fn_get_order_info() which enables one to use a simple hook to adjust data. In the hook you could even use if( defined("API') ) if need be.... Duplicate engineering. At a minimum they should use the same hook name so that data from fn_get_company_data() and the class work equivalently.

Well that should be fixed. Data is data and should be consistent throughout. The 'orders' API uses fn_get_order_info() which enables one to use a simple hook to adjust data. In the hook you could even use if( defined("API') ) if need be.... Duplicate engineering. At a minimum they should use the same hook name so that data from fn_get_company_data() and the class work equivalently.

It uses default fn_get_companies function. As you know, data returned by this function is limited

then he can use the 'get_companies' or the 'get_companies_post' hook. No need to morph a class.

See point #2 in my post #14

See point #2 in my post #14

they should get rid of all the hard-coding of fields and either use a schema or hooks to modify them. Orders suffers from the same.