Commit e540e943 by Francisco Salazar

Validar envio a casa

parent 70a8968d
......@@ -5,7 +5,7 @@ return [
"slug-shop-category" => "categoria",
"tags-enable" => false,
"subcategory-enable" => false,
"version-minima-enable" => true,
"version-minima-enable" => false,
"product-index" => [
"pagination" => 15,
"otros" => 3
......
......@@ -321,7 +321,7 @@ class AdminProductController extends Controller
}
$client = $sale->client;
$orden = $sale->items;
if ($client->shipping != null) {
if ($sale->home_delivery != null) {
$shipping = $client->shipping;
$shipping_price = $shipping->shipping_price;
}
......
......@@ -251,6 +251,7 @@ public function shipping()
} else {
$sale = Sale::find(\Session::get('sale')->id);
$sale->total = ($this->total() + $costoEnvio);
$sale->home_delivery = $request->home_delivery;
$sale->facturacion = $request->facturacion;
$sale->save();
}
......
......@@ -20,9 +20,8 @@ class SubCategoryController extends Controller{
return $subcategories = $category->subcategories()->get();
}
$subcategories = $category->subcategories()->paginate(30);
$products = Product::pluck('name', 'id');
return view("shop::subcategory.index")
->with("products", $products)
->with("subcategories", $subcategories)
->with("category", $category);
}
......@@ -30,10 +29,8 @@ class SubCategoryController extends Controller{
public function edit($category_id, $id){
$category = Category::find($category_id);
$subcategory = SubCategory::where("category_id", $category_id)->find($id);
$products = Product::pluck('name', 'id');
return view("shop::subcategory.edit")
->with('products', $products)
->with("subcategory", $subcategory)
->with("category", $category);
}
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropTableRelatedProductsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('related_products');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('related_products', function (Blueprint $table) {
$table->increments('id');
$table->integer('product_id')->unsigned();
$table->foreign('product_id')
->references('id')
->on('products_shop')
->onDelete('cascade');
$table->integer('subcategory_id')->unsigned();
$table->foreign('subcategory_id')
->references('id')
->on('product_subcategories_shop')
->onDelete('cascade');
$table->timestamps();
});
}
}
......@@ -19,10 +19,6 @@
{!! Form::select('active', [true=>'Activo', false=>'Inactivo'], null, ["class"=>"form-control", "required"=>"required"]) !!}
</div>
<div class="form-group">
{!! Form::label('related_products', 'Productos relacionados') !!}
{!! Form::select('related_products[]', $products, null, ["class"=>"form-control", "required"=>"required", "multiple" => "multiple", "id" => "related_products", "style" => "width: 100%;"]) !!}
</div>
<div class="form-group">
{!! Form::label('portada', 'Imagén de portada') !!}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment