PHP SDK: Yandex Market: Products and Search
Choose product links or a search phrase and delivery cities when creating a scenario. Each scenario keeps independent settings. Templates create drafts; verify a trial run before publishing or scheduling them.
products
products(): array returns normalized keys such as card:103324529910. Enter ordinary links or Market product codes in the form. Legacy /product--name/id links use product:id keys.
regions
regions(): array returns selected city codes as strings. Products in different cities have separate record keys.
query
query(): string returns the configured search phrase. Results can include related products rather than exact matches.
maxPages
maxPages(): int returns the requested depth, from 1 to 30 pages per run. Market controls the number of products per page.
card
card(string $product, string $regionId): array retrieves a selected product. Fields include product identifiers, city, title, brand, seller, link, images, description, available characteristics, rating and rating count.
price_rub is the displayed price without the Yandex Pay card, when confirmed. pay_price_rub is the card price. display_price_rub comes from structured page metadata and may require special payment conditions. Never substitute it for a confirmed regular price. base_price_rub is the price before discount; discount_percent compares it with the non-card price.
Missing values are null, not zero. Availability is true, false or null; exact warehouse quantities are not provided. Access restrictions and unverified pages raise an error and are never interpreted as an unavailable product. Review texts and reviewer identities are excluded.
$source = $ctx->yandexMarket();
foreach ($source->regions() as $region) {
foreach ($source->products() as $product) {
$card = $source->card($product, $region);
$ctx->emit($source->record($card), $card['ym_kind'].':'.$card['ym_id'].':'.$region);
}
}
search
search(string $regionId, int $page): array returns cards, page, total and has_next. The total may be null. Follow has_next, not a fixed page size. Search is restricted to the configured phrase, cities and depth. The price scenario requests Market's ascending price order; sponsored placements and payment conditions may affect that order.
Search records include source_query, search_page, position_on_page and a nullable sponsored flag. Page positions are observations, not universal rankings. Repeated products retain their first occurrence within a city and run.
record
record(array $card): array selects the fields of the current template while keeping product identifiers, city, title, link and images.
All requests use the platform's network protections and site rules. Access restrictions and markup changes can interrupt collection. A complete marketplace catalogue and permanent source availability are not guaranteed.