roshyo / prestashop-webservice-bundle

PrestaShop WebService 库捆绑包

安装: 2

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 0

分支: 6

类型:symfony-bundle

1.2.0 2017-11-17 16:50 UTC

This package is auto-updated.

Last update: 2024-09-12 21:39:12 UTC


README

此版本捆绑包需要 Symfony 2.1+。

安装

步骤 1:通过 Composer 添加依赖

composer require iq2i/prestashop-webservice-bundle

步骤 2:在 app/AppKernel.php 中激活

public function registerBundles()
{
    $bundles = array(
        // ...
        new IQ2i\PrestaShopWebServiceBundle\IQ2iPrestaShopWebServiceBundle(),
    );
}
步骤 3:在 app/config/config.yml 中添加配置
# app/config/config.yml
iq2i_prestashop_web_service:
    connections:
        my_prestashop_1:
            url: http://my-prestashop-1.com/
            key: G5U3GCMX88EF9SFYKN82PBRYJAQQ3Z2G
            debug: false
        my_prestashop_2:
            url: http://my-prestashop-1.com/
            key: G5U3GCMX88EF9SFYKN82PBRYJAQQ3Z2G
            debug: false

在您的应用程序中使用

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction()
    {
        
        $presta = $this->container->get('iq2i_prestashop_web_service')->getInstance('my_prestashop_1');
        $result = $presta->get(array(
            "resource" => "orders"
        ));
        var_dump($result);
        die();
    }
}