hector68/vk-market-export

dev-master 2017-04-22 19:31 UTC

This package is not auto-updated.

Last update: 2024-04-14 00:02:04 UTC


README

vk-market-export

Build Status Coverage Status

Экспортирует продукты в vk

Для тестов создайте свое приложение и сделайте локальный конфиг tests/_get_config.php

use Hector68\VkMarketExport\config\VkConfig;

return new VkConfig(
    >>>AppId<<<,
    >>>AppSecret<<<,
    'http://localserver.dev/tests/test_get_token.php',
    '>>>GroupId<<<',
    >>>token<<< // Можно получить пройдя по ссылке 'http://localserver.dev/tests/test_get_link.php'
);

сохрание продукта

$config =  require __DIR__.'/tests/_get_config.php';

$market = new Market($config);

$goods = GoodsFabric::newGoods(
    $config,
    'Второй тестовый продукт',
    'Описание продукта',
    256,
    __DIR__.'/G1J0oFX6OJQ.jpg'
);

$market->saveProduct($goods);

Изменение продукта

/**
 * @var $firstGoods Goods
 */
$firstGoods = array_shift($allGoods);
$firstGoods->setTitle('Измененое название');
$firstGoods->setPrice(666);

$market->updateProduct($firstGoods);