amsgames / laravel-shop

Laravel shop package
MIT License
479 stars 167 forks source link

Column not found 'items.carts_id' #41

Open Mathias88 opened 8 years ago

Mathias88 commented 8 years ago

Hi,

I have this problem when I use {!! $cart->count !!}. Why?

This is the error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'items.carts_id' in 'on clause' (SQL: select sum(items.quantity) as itemCount, sum(items.price * items.quantity) as totalPrice, sum(items.tax * items.quantity) as totalTax, sum(items.shipping * items.quantity) as totalShipping from carts inner join items on items.carts_id = carts.id where carts.id = 8 limit 1) (View: /var/www/theshop/modules/Shopping/Resources/views/cart/cart.blade.php)

Thanks!

amostajo commented 8 years ago

carts_id looks odd.

Mathias88 commented 8 years ago

In the config, I change the name of table. By default, the name is "cart", but I change by "carts"

amostajo commented 8 years ago

Did you changed the name of column in table items as well? On Mar 24, 2016 5:38 PM, "Mathias88" notifications@github.com wrote:

In the config, I change the name of table. By default, the name is "cart", but I change by "carts"

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/amsgames/laravel-shop/issues/41#issuecomment-201074217

Mathias88 commented 8 years ago

In the table items, the name of column is cart_id.

amsgames commented 8 years ago

Your query for some reason is looking for carts_id instead of cart_id. Weird On Mar 25, 2016 11:43 AM, "Mathias88" notifications@github.com wrote:

In the table items, the name of column is cart_id.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/amsgames/laravel-shop/issues/41#issuecomment-201382653