Giter VIP home page Giter VIP logo

yandex_yml's Introduction

CONTENTS OF THIS FILE

  • Introduction
  • Requirements
  • Installation
  • Configuration
  • Maintainers

INTRODUCTION

YML (Yandex Market Language) — is XML file with products for Yandex.Market. Not to be confused with YAML files, which also have .yml extension.

This module provide API for developers to generate product yml file. Module doesn't contain any administrative interface.

Features:

REQUIREMENTS

This module requires no modules outside of Drupal core.

INSTALLATION

It's recommended to install module via composer.

CONFIGURATION

There is no UI to configure module out of the box. This module is require you to write a bit of code. For further information look at documentation or in docs folder inside module.

MAINTAINERS

yandex_yml's People

Contributors

a-kovrigin avatar niklan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

yandex_yml's Issues

Конфигурация модуля

Подскажите пожалуйста, обновление XML-файл с товарами проходит автоматически при добавление либо удаление товаров?

И если можно, поясните как использовать API? Создать кастомный модуль? В вашем мануале по адресу https://yandex-yml.readthedocs.io/en/8.x-1.x/api-overview нет никакой инфы какие файлы необходимо создать для приведенных примеров кода в кастомном модуле. Модуль крайне необходим многим, нельзя ли подробнее расписать конфигурацию. Если есть такая страница с подробностями - дайте пожалуйста ссылку.

Нет возможности добавить параметр count

Здравствуйте. Нет возможности добавить параметр count для передачи остатков.

В файле OfferSimple.php добавил:

/**

  • Sets stock quantity for order.
  • @param int|float $count
  • The stock quantity.
  • @return $this
    */
    public function setCount($count) {
    $this->addElementChild(new Element('count', $count));
return $this;

}

Функция возврата буфера с данными

Привет, Спасибо большое за модуль API!
Наверно стоит создать функцию для возврата данных из буфера для использования сгенерированных данных в Контроллере?
#Например

/**
   * Generate file on all provided data.
   */
  public function generateFile($filename = 'products.xml', $destination_path = 'public://') {
    $this->writeHeader();
    $this->buildData();
    file_unmanaged_copy($this->tempFilePath, $destination_path . $filename, FILE_EXISTS_REPLACE);
  }

  protected function buildData(){
    $this->writeShopInfo();
    $this->writeCurrencies();
    $this->writeCategories();
    $this->writeDeliveryOptions();
    $this->writeOffers();
    $this->writeFooter();
  }

  public function getResponceData(){
    $this->writer->openMemory();
    $this->buildData();
    return $this->writer->outputMemory();
  }

И можно уже использовать в контроллере отдавая в качестве ответа уже готовый xml
#Например

public function build() {
    /** @var \Drupal\yandex_yml\YandexYmlGenerator $generator */
    $generator = \Drupal::service('yandex_yml.generator');

    /** @var \Drupal\yandex_yml\YandexYml\Shop\YandexYmlShop $shop_info */
    $shop_info = \Drupal::service('yandex_yml.shop')
      ->setName('Example shop name')
      ->setCompany('Fullname of the store')
      ->setAgency('https://niklan.net')
      ->setEmail('[email protected]')
      ->setCpa(0);
    $generator->setShopInfo($shop_info);
    
    $response = new CacheableResponse($generator->getResponceData(), Response::HTTP_OK, [
      'content-type' => 'application/xml',
    ]);

    return $response;
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.