Ejemplo n.º 1
0
        public void WriteDateToDate(PsProduct Obj)
        {
            String TxtSQL = "update ps_specific_price "
                            + " set ps_specific_price.from = '0000-00-00 00:00:00', "
                            + " ps_specific_price.to = '0000-00-00 00:00:00' "
                            + " where id_product = " + Obj.IDProduct;

            if (Core.Global.GetConfig().ArticleFiltreDatePrixPrestashop)
            {
                TxtSQL += " and ps_specific_price.from = '0001-01-01 00:00:00' "
                          + " and ps_specific_price.to = '0001-01-01 00:00:00' ";
            }
            this.DBPrestashop.ExecuteCommand(TxtSQL);
        }
Ejemplo n.º 2
0
        public void WriteReductionType(PsProduct Obj)
        {
            String TxtSQL = "update ps_specific_price "
                            + " set ps_specific_price.reduction_type = 'percentage' "
                            + " where id_product = " + Obj.IDProduct
                            + " and reduction <> 0 ";

            if (Core.Global.GetConfig().ArticleFiltreDatePrixPrestashop)
            {
                TxtSQL += " and ps_specific_price.from = '0001-01-01 00:00:00' "
                          + " and ps_specific_price.to = '0001-01-01 00:00:00' ";
            }
            this.DBPrestashop.ExecuteCommand(TxtSQL);
        }
        public void Add(PsProduct Obj, UInt32 IDShop)
        {
            this.DBPrestashop.PsProduct.InsertOnSubmit(Obj);
            this.Save();

            //Si le produit n'existe pas dans la boutique, il est rajouté.
            if (!ExistInShop(Obj.IDProduct, IDShop))
            {
                DBPrestashop.PsProductShop.InsertOnSubmit(new PsProductShop()
                {
                    Active = Obj.Active,
                    AdditionalShippingCost  = Obj.AdditionalShippingCost,
                    AdvancedStockManagement = Obj.AdvancedStockManagement,
                    AvailableDate           = Obj.AvailableDate,
                    AvailableForOrder       = Obj.AvailableForOrder,
                    CacheDefaultAttribute   = Obj.CacheDefaultAttribute,
                    Customizable            = Obj.Customizable,
                    DateAdd           = Obj.DateAdd,
                    DateUpd           = Obj.DateUpd,
                    EcOtAx            = Obj.EcOtAx,
                    IDCategoryDefault = Obj.IDCategoryDefault,
                    IDProduct         = Obj.IDProduct,
                    IDShop            = IDShop,
                    IDTaxRulesGroup   = Obj.IDTaxRulesGroup,
                    Indexed           = Obj.Indexed,
                    MinimalQuantity   = Obj.MinimalQuantity,
                    OnlineOnly        = Obj.OnlineOnly,
                    OnSale            = Obj.OnSale,
                    Price             = Obj.Price,
                    ShowPrice         = Obj.ShowPrice,
                    TextFields        = Obj.TextFields,
                    UnitPriceRatio    = Obj.UnitPriceRatio,
                    Unity             = Obj.Unity,
                    UploadAbleFiles   = Obj.UploadAbleFiles,
                    WholesalePrice    = Obj.WholesalePrice,
                                        #if (PRESTASHOP_VERSION_161 || PRESTASHOP_VERSION_172)
                    PackStockType = Obj.PackStockType,
                                        #endif
                });
                DBPrestashop.SubmitChanges();
            }
        }