| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Dealing with Complex Schema API | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Dealing with Complex Schema API
I want to create a complex schema for ProductVariant entity. I follow the implementation of Tony-Restapicomplex module but i got an exception such as :
There is no model schema for that class. This is my schema : PHP Code:
And this is the Complex.php file that decorate \XLite\Module\XC\RESTAPI\Core\Schema\Complex : PHP Code:
What is wrong ?! The demo-entity works very well. But ProductVariant not.
__________________
Soptareanu Alex |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Dealing with Complex Schema API
@Alex,
You should try to implement getAllowedEntityClasses() method as follows: Code:
In other words, the key of return array must be name of model class and the value must be name of the class that implements the complex schema. Please, let me know if it helps. Quote:
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
|
#3
|
|||||||
|
|||||||
Re: Dealing with Complex Schema API
Quote:
I tested and it works very well. Now I have another issue. Because I have very much products and productvariants, sometimes I get an 500 error because the server takes much time to respond. I want to create a tool that pull products from API in batches but for that I need instead reciving all products, get only number of rows. Is there a posibility to do that ? By default convertModel() function fetching result for each rows of entity.
__________________
Soptareanu Alex |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Dealing with Complex Schema API
Quote:
Did you try using _cnd[limit] in your request as explained here: https://devs.x-cart.com/rest-api/#limiting-the-output-pagination Just add something like _cnd[limit][0]=0&_cnd[limit][1]=100 to your request and it will pull batches of entities instead of all.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#5
|
|||||||
|
|||||||
Re: Dealing with Complex Schema API
Quote:
__________________
Soptareanu Alex |
|||||||
#6
|
|||||||||
|
|||||||||
Re: Dealing with Complex Schema API
Quote:
Knowing total number of rows is not necessary as you should stop sending requests once you receive first empty result.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|