Comments (5)
Any feedback on this? I'll happily work on a PR but I want to get some feedback on the concept :)
from api-php-client.
Hello and sorry for the late response.
-
First point:
I don't understand how the "count" could be returned with theall
method.
It's a cursor returning the directly entities, not the page itself. -
Second point:
I strongly discourage you to do it this way for performance concern.
The cursor is, under the hood, iterating by doing several requests. So, it would count each time for every requests. It can have an impact on the performance on pretty big catalogs.
I advise you to get the count with the listPerPage
method, and then iterate over the categories with the all
.
$categoryCount = $client->getProductApi()->listPerPage(1, true)->getCount();
$categories = $client->getCategoryApi()->all(100);
from api-php-client.
Thanks for the reply but I don't think you understood the issue exactly :-) As far as I understood from the API docs (https://api.akeneo.com/api-reference-21.html#get_categories), the with_count
parameter adds the number of products per category to the result. It's not related to pagination or the cursor at all, is it?
What I need is the number of products per category so I can build something like this:
- Category A (512)
- Category C (18)
- Category D (494)
- Category B (32)
from api-php-client.
Hello,
No, this count is the total number of categories.
If you want to get the number of products in a category, you have to request the product endpoint with a filter IN CHILDREN
:
https://api.akeneo.com/documentation/filter.html#on-categories
It's not possible to do it in 1 request for several categories though.
from api-php-client.
Ah, I see. Thank you for taking the time to reply then 👍
from api-php-client.
Related Issues (20)
- Missing function for deleting product models HOT 1
- PHP 8.1 Deprecations HOT 1
- Add [\ReturnTypeWillChange] attribute to current and key methods in ResourceCursor class HOT 1
- Filter products for a single vendor
- symfony/options-resolver is used in src/Client/Options.php but it is only dev requirement through another package HOT 1
- auto switch to http from https with error HOT 4
- Unexpected exception when instantiating class - error in Symfony 5.4 and PHP 8.1 HOT 1
- Filters doesn't work for categories. HOT 2
- api-php-client calls undefined function in pim HOT 3
- IN operator not working for assets
- upsertList not working on Windows HOT 1
- Filters doesn't work for categories
- $client->getCategoryApi()->all() returns empty parent and position values for all
- Set a timeout when sending requests to Akeneo
- Random Server Side errors on random products
- Missing getter for private totalIndex
- Not able for get table attribute select options
- psr/http-message Current Version Issue HOT 8
- Support for symfony 7.0 HOT 1
- Suggested package php-http/guzzle6-adapter is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-php-client.