Ext.define('TradePortal.store.addCartProduct', {
    extend: 'Ext.data.Store',
    model: 'TradePortal.model.Valid',
    storeId: 'addCartProduct',
    proxy: {
        type: 'jsonajax',
        url: BASE_URL + '/fluid/FluidAppServerProxy?ipApi=presenter&ipService=Frameworks.Interfaces.Mobile.TradePortal&ipFunction=addCartProduct'
    },
    listeners: {
        load: {
            fn: function (store, records, options) {
                if (!records[0].data.errorTable) {
                    Ext.getStore('Cart').load(
                        {
                            params: {
                                userName: Ext.getStore('HomeStatistic').last().data.id_user,
                                sessionID: Ext.getStore('createCart').last().data.sessionID
                            }
                        });
                } else {
                    Ext.getCmp('viewport').setLoading(false);
                    Ext.Msg.alert('Alert', 'Error, can not add product.', Ext.emptyFn);
                }
            }
        }
    }

});
