Exemple #1
0
    public static IEnumerable Shop_GetProducts(string StoreName, string APIKey, string Password, string PublishedStatus = null, string ProductType = null, int Page = 1)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        ePublishedStatus _ps = ePublishedStatus.any;

        if (PublishedStatus != null)
        {
            if (Enum.TryParse(PublishedStatus, out _ps))
                _ps = (ePublishedStatus)Enum.Parse(typeof(ePublishedStatus), PublishedStatus);
        }

        string _pt = ProductType != null ? ProductType : "";
        ArrayList prods = new ArrayList();

        foreach(SIProduct pr in sp.GetProducts(_ps, _pt, Page))
        {
            SIOption op1 = pr.options[0];

            foreach(SIVariant vr in pr.variants)
            {
                ArrayList al = new ArrayList();
                al.Add(pr.id);
                al.Add(pr.title);
                al.Add(pr.product_type);
                al.Add(vr.price);
                al.Add(vr.compare_at_price);
                al.Add(vr.sku);
                al.Add(vr.inventory_quantity);
                al.Add(vr.id);
                al.Add(op1.id);
                al.Add(pr.tags);

                prods.Add(al);
            }
        }

        return prods;
    }
        private void GetSPPRoducts()
        {
            sp = new ShopifyClient(_storename, _apikey, _password);
            List<SIProduct> prods = sp.GetProducts(ePublishedStatus.unpublished);

            txtRawData_Copy.Clear();
            foreach(SIProduct sip in prods)
            {
                txtRawData_Copy.Text += String.Format("productID: {0}| sku: {1}| variantID: {2}| Qty: {3}| price: {4}\n", sip.id, sip.title, sip.variants[0].id, sip.variants[0].inventory_quantity, sip.variants[0].price);
            }
        }