Laravelshoppingcart: How to change tax value?

Created on 8 Oct 2016  路  22Comments  路  Source: Crinsane/LaravelShoppingcart

my country using 0.18 tax. but laravelshopping cart used presumably 0.21. i need to change tax value but there are not config file.

thanx for reply.

Most helpful comment

You can write php artisan vendor:publish.
You will find cart.php file into config folder

All 22 comments

You can write php artisan vendor:publish.
You will find cart.php file into config folder

I have the same issue as kvlknctk but when ir run "php artisan vendor:publish" i get

[ErrorException]                                               
The use statement with non-compound name 'Cart' has no effect 

@kvlknctk you have a /vendor/gloudemans/shoppingcart/src folder, inside of it is there a "cart.php" where you can change tax value and many oders things!

We don't change values under vendor folder. If you update your package all values will be reset.

so what i have to do?

php artisan vendor:publish should have worked. I am already using it and vendor:publish worked.

What is your Laravel version, by the way?

I'm gettin this error...

captura de pantalla 2016-10-11 a las 16 18 15

Even when i do php artisan migrate

Did you setup Cart alias into config/app.php?

Maybe Cart class not found.

Yes

'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,

Maybe i should change for ?

'Cart' => Gloudemans\Shoppingcart\Src\Facades\Cart::class

Well, it seems you did great 馃憤

'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,

Look, when I wrote vendor:publish.

screenshot 2016-10-12 00 24 53

Look, if i search for Cart.php this is what i found.

captura de pantalla 2016-10-11 a las 16 27 56

Maybe i am including the alias with a wrong path?

No, Src is a folder path, but your class has NAMESPACE namespace Gloudemans\Shoppingcart\Facades so you have to call class by Namespace not folder source.

OK i did it,

captura de pantalla 2016-10-11 a las 16 33 11

i was adding "use Cart;" in a Controller, i don't know why, maybe I pasted there accidentally! Thanks!

Good, you have figured it out 馃憤

I want the admin user to be able to change the sales tax. This is what I added cart.php config:
'tax' => \DB::table('business_info')->select('sales_tax')->first(),

When refreshing the page to test it I get an error:
Class 'DB' not found

Is there a better route to take in handling this type of function?

You can't access the db in the configuration. I guess right now you best option is to set the config in you AppServiceProvider or something at runtime with Config::set()

Thank you.

'tax' => \Illuminate\Support\Facades\DB::table('products')->value('tax'),

is there any way that the tax value will be dynamic? I mean for different product tax value will be counted from respective product tax column.

You can write php artisan vendor:publish.
You will find cart.php file into config folder

Thanks bhai jan

Was this page helpful?
0 / 5 - 0 ratings

Related issues

morganchorlton3 picture morganchorlton3  路  3Comments

ChrisThompsonTLDR picture ChrisThompsonTLDR  路  5Comments

rubelkhan447 picture rubelkhan447  路  6Comments

gauravojha picture gauravojha  路  8Comments

pelachile picture pelachile  路  8Comments