PHP code example of erkineren / shopwarebot
1. Go to this page and download the library: Download erkineren/shopwarebot library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
erkineren / shopwarebot example snippets
use ShopwareBot\ShopwareBot;
.dev";
$username = 'user';
$password = 'password';
$bot = ShopwareBot::getInstance($shop_url);
try {
// login to backend
$bot->login($username, $password);
} catch (\ShopwareBot\Exceptions\CsrfException $e) {
die($e->getMessage());
}
// Orders
$order = $bot->getOrderModule()->getOrderByNumber('12345');
$orders = $bot->getOrderModule()->getList($filter);
// Document
$bot->getOrderModule()->generateDocumentInvoice($orderId);
$bot->getOrderModule()->generateDocumentDeliveryNote($orderId);
$bot->getOrderModule()->generateDocumentCreditNote($orderId);
$bot->getOrderModule()->generateDocumentReversalInvoice($orderId);
$bot->getOrderModule()->generateDocument($orderId, $documentType); // custom document
// Customers
$bot->getCustomerModule()->getCustomerById($id);
$bot->getCustomerModule()->getCustomerByNumber($number);
$bot->getCustomerModule()->getCustomersByEmail($email);
$bot->getCustomerModule()->getCustomersByFirstname($firstname);
$bot->getCustomerModule()->getCustomersByFirstname($firstname);
$bot->getCustomerModule()->getCustomersByCustomerGroup($groupName);
$bot->getCustomerModule()->getCustomersByNumber($customernumbers);
$bot->getCustomerModule()->search($q);
$bot->getCustomerModule()->getBy($property, $value);
$bot->getCustomerModule()->getList($filter);
$bot->getCustomerModule()->getDetail($customerID);
$bot->getCustomerModule()->getUserAddressList($customerId);
$bot->getCustomerModule()->getUserOrders($customerID);
$bot->getCustomerModule()->getOrderChart($customerID);
$bot->getCustomerModule()->getUserPickwareArticles($customerID);
$bot->getCustomerModule()->delete($userId);
// Cache
$bot->getCacheModule()->clearShopCache();
// Logs
$bot->getLogModule()->createLog('Some logged data');
// ImportExport Plugin
$bot->getImportExportModule()->getProfiles();
$bot->getImportExportModule()->getProfiles();
$bot->getImportExportModule()->prepareExport($data);
$bot->getImportExportModule()->exportPartially(ImportExportModule::ARTICLES_COMPLETE, $limit); // for big data
$bot->getImportExportModule()->download($filename, 'files/saveto.csv');
// Pickware DPD,DHL adapters plugins
$bot->getDpdModule()->getShippingOrderData($orderId);
$bot->getDpdModule()->getAllLabels($orderId);
$bot->getDpdModule()->getTrackingUrls($trackingCodes);
$bot->getDpdModule()->getCountries();
$bot->getDpdModule()->getAllConfigurations();
$bot->getDpdModule()->getProducts();
$bot->getDpdModule()->getOrderConfigData($shopId);
$bot->getDpdModule()->calculateShippingWeight($orderId);
$bot->getDpdModule()->getMergedLabelsForOrder($orderId);
$bot->getDpdModule()->getLabelPdf($code);
$bot->getDpdModule()->getReturnLabelPdf($code);
// create shipping label
$bot->getDpdModule()->createLabel([
'orderId' => $orderId,
'detailsFirstName' => $address['firstname'],
'detailsLastName' => $address['lastname'],
'detailsStreet' => $address['street'],
'detailsStreetNumber' => $address['no'],
'detailsZipCode' => $address['postalcode'],
'detailsCity' => $address['city'],
'detailsStateId' => 0,
'detailsCountryId' => $country['id'],
'detailsEmail' => $address['email'],
'packagingWeight' => 5
]);
// get shipping label that created from DPD plugin
ob_clean();
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=" . $code . ".pdf");
echo $bot->getDpdModule()->getLabelPdf($code);
die;
// Pickware ERP Plugin
$bot->getPickwareModule()->saveIncomingStock($articleDetailId,$binLocationId,$warehouseId,$incomingStock);
$bot->getPickwareModule()->saveIncomingStock($articleDetailId,$binLocationId,$warehouseId,$incomingStock);
$bot->getPickwareModule()->getStockList();
$bot->getPickwareModule()->getStockListByOrderDetailId();
$bot->getPickwareModule()->getStockListByUserId();
$bot->getPickwareModule()->getStockListByComment();
$bot->getPickwareModule()->getStockListByType();
// Plugins
$bot->getPluginsModule()->isPluginActive($technicalName_or_Label);
$bot->getPluginsModule()->getActivePlugins();
$bot->getPluginsModule()->getLocalList();
// Articles
$bot->getArticleModule()->deleteProduct($Detail_id);