All Projects → Bukimedia → Prestasharp

Bukimedia / Prestasharp

Licence: gpl-3.0
CSharp .Net client library for the PrestaShop API via web service

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Prestasharp

Fo Dicom
Fellow Oak DICOM for .NET, .NET Core, Universal Windows, Android, iOS, Mono and Unity
Stars: ✭ 674 (+402.99%)
Mutual labels:  dot-net
Rupengmessagehub
.Net Chat Server Hub
Stars: ✭ 84 (-37.31%)
Mutual labels:  dot-net
Skiasharp.extended
SkiaSharp is a cross-platform, comprehensive 2D graphics API for all .NET platforms. And, here is where you will find all sorts of extras that you can use with it.
Stars: ✭ 118 (-11.94%)
Mutual labels:  dot-net
Iec 60870
.NET implementation of IEC-60870 104
Stars: ✭ 41 (-69.4%)
Mutual labels:  dot-net
Skater .net Obfuscator
Skater .NET Obfuscator is an obfuscation tool for .NET code protection. It implements all known software protection techniques and obfuscation algorithms.
Stars: ✭ 64 (-52.24%)
Mutual labels:  dot-net
Farnet
Far Manager framework for .NET, PowerShell, F#.
Stars: ✭ 92 (-31.34%)
Mutual labels:  dot-net
Ipc
IPC is a C++ library that provides inter-process communication using shared memory on Windows. A .NET wrapper is available which allows interaction with C++ as well.
Stars: ✭ 332 (+147.76%)
Mutual labels:  dot-net
Yaxlib
Yet Another XML Serialization Library for the .NET Framework and .NET Core
Stars: ✭ 124 (-7.46%)
Mutual labels:  dot-net
Tsadmin
asp.net web api 2 + vue.js +elementui 实现的前/后端分离的后台管理系统框架示例程序。
Stars: ✭ 70 (-47.76%)
Mutual labels:  dot-net
Prig
Prig is a lightweight framework for test indirections in .NET Framework.
Stars: ✭ 106 (-20.9%)
Mutual labels:  dot-net
Fluenttc
🌊 👬 🏢 Integrate with TeamCity fluently
Stars: ✭ 42 (-68.66%)
Mutual labels:  dot-net
Simplify
Simplify is a set of .NET libraries that provide infrastructure for your applications. DI and mocking friendly.
Stars: ✭ 52 (-61.19%)
Mutual labels:  dot-net
Influxdb.client
InfluxDB Client for .NET
Stars: ✭ 94 (-29.85%)
Mutual labels:  dot-net
Untech.sharepoint
Untech.SharePoint - library that will improve your work with Lists in SharePoint (can be used with SSOM and CSOM)
Stars: ✭ 8 (-94.03%)
Mutual labels:  dot-net
Nsubstitute
A friendly substitute for .NET mocking libraries.
Stars: ✭ 1,646 (+1128.36%)
Mutual labels:  dot-net
Mahou
Mahou(魔法) - The magic layout switcher.
Stars: ✭ 335 (+150%)
Mutual labels:  dot-net
Rubberduck
Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
Stars: ✭ 1,287 (+860.45%)
Mutual labels:  dot-net
Csly
a C# embeddable lexer and parser generator (.Net core)
Stars: ✭ 129 (-3.73%)
Mutual labels:  dot-net
Slimmessagebus
Lightweight message bus interface for .NET (pub/sub and request-response) with transport plugins for popular message brokers.
Stars: ✭ 120 (-10.45%)
Mutual labels:  dot-net
Statiq.web
Statiq Web is a flexible static site generator written in .NET.
Stars: ✭ 1,358 (+913.43%)
Mutual labels:  dot-net

PrestaSharp

Build Status Total alerts Language grade: C#

CSharp .Net client library for the PrestaShop API via web service

Introduction

A simple .Net REST client written in C# for the Prestashop API. PrestaSharp uses the RestSharp library to consume the Prestashop services.

Installation

NuGet

PrestaSharp is available on NuGet. Use the package manager console to install it:

Install-Package PrestaSharp

Basic usage

  1. Initiate a client instance:
string baseUrl = "http://www.myweb.com/api";
string account = "ASDLKJOIQWEPROQWUPRPOQPPRQOW";
string password = "";

ManufacturerFactory manufacturerFactory = new ManufacturerFactory(baseUrl, account, password);
  1. Perform CRUD actions through the client:
Bukimedia.PrestaSharp.Entities.manufacturer manufacturer = manufacturerFactory.Get(6);
manufacturer.name = "Iron Maiden";
manufacturer.active = 1;
manufacturerFactory.Add(manufacturer);
manufacturerFactory.Update(manufacturer);
manufacturerFactory.Delete(manufacturer);
  1. Add an image:
Bukimedia.PrestaSharp.Entities.product myProduct = new Bukimedia.PrestaSharp.Entities.product();
ProductFactory productFactory = new ProductFactory(baseUrl, account, password);
myProduct = productFactory.Add(myProduct);
ImageFactory imageFactory = new ImageFactory(baseUrl, account, password);
imageFactory.AddProductImage((long)myProduct.id, "C:\\MyImage.jpg");
  1. Set quantity of products: The quantity of a product may not be updated directly in the 'product' entity. You need to update 'stock_available' entity.
StockAvailableFactory stockAvailableFactory = new StockAvailableFactory(baseUrl, account, password);
long stockAvailableId = myProduct.associations.stock_availables[0].id;
Bukimedia.PrestaSharp.Entities.stock_available myStockAvailable = stockAvailableFactory.Get(stockAvailableId);
myStockAvailable.quantity = 99; // Number of available products
myStockAvailable.out_of_stock = 1; // Must enable orders
stockAvailableFactory.Update(myStockAvailable);

Advanced usage

  1. Get all. This sample retrieves the list of manufacturers:
List<manufacturer> manufacturers = ManufacturerFactory.GetAll();
  1. Get ids. This sample retrieves the list of the manufacturer ids:
List<long> ids = ManufacturerFactory.GetIds();
  1. Get by filter. This sample retrieves the list of manufacturers which name is "Metallica":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "Metallica");
List<manufacturer> manufacturers = ManufacturerFactory.GetByFilter(dtn, null, null);
  1. Get by filter with wildcards. This sample retrieves the manufacturers which name starts with "Metall":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "[Metall]%");
List<manufacturer> manufacturers = ManufacturerFactory.GetByFilter(dtn, null, null);
  1. Get ids by filter. This sample retrieves the list of the manufacturers ids which name is "Metallica":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "Metallica");
List<long> ids = ManufacturerFactory.GetIdsByFilter(dtn, null, null);
  1. Get ids by filter with wildcards. This sample retrieves the list of the manufacturers ids which name starts with "Metall":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "[Metall]%");
List<long> ids = ManufacturerFactory.GetIdsByFilter(dtn, null, null);
  1. Get by complex filter. This sample retrieves the top five manufacturers in ascendent sorting which name starts with "Metall":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "[Metall]%");
List<manufacturer> manufacturers = ManufacturerFactory.GetByFilter(dtn, "name_ASC", "5");
  1. Get by filter for pagination. This sample retrieves the top five manufacturers from tenth position in ascendent sorting which name starts with "Metall":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "[Metall]%");
List<manufacturer> manufacturers = ManufacturerFactory.GetByFilter(dtn, "name_ASC", "[9,5]");
  1. Get ids by filter. This sample retrieves the list of the manufacturers ids which name is "Metallica", "Nirvana" or "Pantera":
Dictionary<string, string> dtn = new Dictionary<string, string>();
dtn.Add("name", "[Metallica|Nirvana|Pantera]");
List<long> ids = ManufacturerFactory.GetIdsByFilter(dtn, null, null);
  1. Get by filter by range date. This sample retrieves the orders in a date range:
DateTime startDate = new DateTime (2016, 1, 1);
DateTime endDate = new DateTime (2016, 1, 31);
Dictionary<string, string> filter = new Dictionary<string, string>();
string dFrom = string.Format("{0:yyyy-MM-dd HH:mm:ss}", startDate);
string dTo = string.Format("{0:yyyy-MM-dd HH:mm:ss}", endDate);
filter.Add("date_add", "[" + dFrom + "," + dTo + "]");
List<long> prestaSharpOrderIds = this.OrderFactory.GetIdsByFilter(filter, "id_DESC", null);

Supported resources

  • Address
  • Carriers
  • Carts
  • Categories
  • Combinations
  • Currencies
  • Customers
  • Customer Messages
  • Customer Threads
  • Guests
  • Groups
  • Images
  • Languages
  • Manufacturers
  • Messages
  • Orders
  • Order Carriers
  • Order Cart Rules
  • Order Histories
  • Order Invoices
  • Order States
  • Products
  • Product Features
  • Product Feature Values
  • Product Options
  • Product Option Values
  • Product Suppliers
  • Shops
  • Specific Prices
  • Specific Price Rules
  • States
  • Stock Availables
  • Tags
  • Tax
  • Tax Rule
  • Tax Rule Groups
  • Warehouse
  • Zones

Supported actions

  • Create
  • Read
  • Update
  • Delete

Roadmap

  • Add other resources

Debugging

Enabling debugging in PrestaShop would make PrestaSharp exceptions more verbose, to enable that, edit /config/defines.inc.php file in your PrestaShop website and edit this code block:

define('_PS_MODE_DEV_', false);

to:

define('_PS_MODE_DEV_', true);

More information in the development section of PrestaShop's documentation.

Help & Discussion

If your problem is how to implement anything with PrestaSharp or make a question, please, refer to our Slack group: PrestaSharp Slack Group

License

PrestaSharp is GNU General Public License (GPL)

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantabilty or fitness for a particular purpose. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Bukimedia reserves the right to mention of companies or individuals who use this software.

Copyright (C) 2019 Bukimedia

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].