[Solved] Shopping Cart insert


#1

Good day, I am trying to create an eccomerce site and I am havving a little bit of trouble.

I am following a tutorial from pluralsight.com and they do not cover exactly what they are doing.

This is the Gist

and this is the project.

https://github.com/orozcorp/sp

I keep getting a message

error: 500, reason: “Internal server” details: undefined, error type “Meteor.Error”


#2

The error message should contain much more than that, including a file name and line number. It is impossible to help you with this much information. But if you can provide the complete error details, perhaps we could try to see what the cause of the problem may be.


#3


#4

Can you show me your line 45 of the original products.js that is in your app (not the one from the gist)

In fact, could you post the whole products.js file

I checked the sources on github but could not find which file that may be.

Also, could you please tell me exactly when you get the error? Does it happen when you do something or during startup etc.


#5
if (Meteor.isClient){

Template.productos.onCreated(function() {
this.sortTecOrder = new ReactiveVar(1);
});

Template.productos.helpers({
productos: function(){
return ProductList.find({fields: {costo : false}});
},
precioa: function(){
var precio = this.precio;
return accounting.formatMoney(precio);
},
productos: function () {
var self = Template.instance();
var sortTecOrder = self.sortTecOrder.get();
return ProductList.find({}, { sort: { tipotec: sortTecOrder, codigo:1 } });
}

})

Template.productos.events({
‘click #sortTec’: function() {
var self = Template.instance();
self.sortTecOrder.set(self.sortTecOrder.get() * -1);
},
‘click .showP’:function(){
var productId = this._id;
Session.set(‘selectedProduct’, productId);
var selectedProduct = Session.get(‘selectedProduct’);
console.log(selectedProduct);
$(’#productInfo’).modal(‘show’);
},
‘click #add-to-cart’: function(ev){
ev.preventDefault();
addToCart(this.codigo, function(err,res){
console.log(err);
console.log(res);
});
}
})
}


#6

You are missing the check package

meteor add check

will resolve the issue.

When you get errors like that (500) you should check your server console. The server console prints a message of what had went wrong.


#7

I keep getting the same message.

Ill check what other package I might be missing


#8

Check your server console for error information.


#9

Hi,
error 1 : check is not defined
=> meteor add check
error 2 :
var product = Products.bycodigo(codigo); // Products is not defined
=> var product = ProductList.bycodigo(codigo);
error 3 : at [object Object].Meteor.methods.addToCart (meteor://:computer:app/lib/shopping_cart.js:64:35)
(line 64, column 35)
=> var product = ProductList.byCodigo(codigo);
error 4 : Error: Products is not defined
I20151013-14:15:44.785(7)? at [object Object].Meteor.methods.saveCart (meteor://:computer:app/lib/shopping_cart.js:118:22)
=> replace all Products => ProductList
That all.Sorry, about my english :slight_smile:


#10

Dude! You rock! :grinning:

thank you It Worked Great!