2017 © Pedro Peláez
 

package shopctrl

Afosto ShopCtrl client

image

afosto/shopctrl

Afosto ShopCtrl client

  • Thursday, July 5, 2018
  • by afosto
  • Repository
  • 0 Watchers
  • 0 Stars
  • 335 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 34 Versions
  • 30 % Grown

The README.md

ShopCtrl

Use this client to convieniently interact with ShopCtrl. This PHP package was developed by Afosto to make a reliable connection between Afosto (Retail Software) and ShopCtrl and provides the following functionality:, (*1)

  • get product data from ShopCtrl
  • get order data from ShopCtrl
  • create new orders at ShopCtrl

Getting Started

Simply follow the installation instructions. You will need an account at ShopCtrl that is set up for you to use., (*2)

Prerequisites

What things you need to install the software and how to install them - PHP5.5+ - Composer (for installation), (*3)

Installing

Installing is easy through Composer., (*4)

composer require afosto/shopctrl

Examples

Now, to fetch productdata from ShopCtrl use the following code., (*5)

First set some configuration parameters:, (*6)

$settings = new Settings();

Define the settings with data obtained from ShopCtrl, (*7)

$settings->shopId = '';
$settings->baseUrl = '';
$settings->username = '';
$settings->password = '';
$settings->cultureId = '';

Initialze the application:, (*8)

App::init($settings);

Get a product (from shop context)

Run a foreach for ProductSelections to get shop-context-related data and the full product that belongs to the productSelection data, (*9)

foreach (ProductSelection::model()->findAll() as $productSelection) {
    $product = Product::model()->find($productSelection->productId);

    //Use the product data
    dump($productSelection, $product);
}

Generate an order

To create an order use the following sample. First set the contact data., (*10)

$contact = new ContactInfo();
$contact->streetAddress = 'Grondzijl';
$contact->streetAddressNumber = 16;
$contact->city = 'Groningen';
$contact->countryCode = 'NL';
$contact->companyName = 'Afosto SaaS BV';
$contact->eMail = 'peter@afosto.com';
$contact->firstName = 'Peter';
$contact->lastName = 'Bakker';
$contact->postalCode = '9731DG';
$contact->phone = '0507119519';

Create an order row., (*11)

$orderRow = new OrderRow();
$orderRow->orderRowKey = 1;
$orderRow->itemQuantity = 1;
$orderRow->productName = 'TestProduct';
$orderRow->productCode = 'ProductSku';
$orderRow->productDescription = 'Description test product';
$orderRow->itemPriceIncVat = 5.00;
$orderRow->rowDiscountIncVat = 0;
$orderRow->vatperc = 21;
$orderRow->rowTotalIncVat = 5;

Create an order., (*12)

$order = new Order();
$order->id = 0;
$order->shipToContact = $contact;
$order->billToContact = $contact;
$order->date = (new DateTime())->format('Y/m/d H:i:s');
$order->viewModusIncVAT = true;
$order->paymentFeeIncVat = 0;
$order->shippingCostsIncVat = 0;
$order->customerNote = '';
$order->syncSource = 'Afosto';
$order->discountIncVat = 0;
$order->orderRows[] = $orderRow;
$order->orderCode = 'test' . time();
$order->orderTotalIncVat = 5.00;
$order->currencyId = 1;
$order->currencyCode = 'EUR';

Set some specific data for the order based on the context / settings, (*13)

$order->paymentTypeId = App::getInstance()->getSettings()->getPaymentTypeId('iDeal');
$order->cultureId = App::getInstance()->getSetting('cultureId');
$order->shopId = App::getInstance()->getSetting('shopId');
$order->mainStatusId = App::getInstance()->getSettings()->getOrderStatus('Active');

Now create the order, (*14)

$order->create();

Now use the new data (model is updated with the results from the server), (*15)

$order->id;

Other examples

In the examples directory you will find more examples of this project., (*16)

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository., (*17)

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details, (*18)

The Versions

05/07 2018

dev-Hotfix/invalid-validation-configuration

dev-Hotfix/invalid-validation-configuration https://afosto.com

Afosto ShopCtrl client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client afosto shopctrl

25/06 2018
07/05 2018

dev-hotfix/exception-handling

dev-hotfix/exception-handling https://afosto.com

Afosto ShopCtrl client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client afosto shopctrl

30/10 2017

dev-feature/allowIndividualSale

dev-feature/allowIndividualSale https://afosto.com

Afosto ShopCtrl client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client afosto shopctrl

26/10 2017

dev-Feature/adding-brand-to-product

dev-Feature/adding-brand-to-product https://afosto.com

Afosto ShopCtrl client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client afosto shopctrl

03/05 2017

dev-feature/product-selection

dev-feature/product-selection https://afosto.com

Afosto ShopCtrl client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

client afosto shopctrl

14/03 2017