update_5_2_2019
This commit is contained in:
@@ -120,12 +120,24 @@ class TeamStoreController extends Controller {
|
||||
$teams_array = $m->getTeams($product_array[0]->Id);
|
||||
$sizes_array = $m->getSizes();
|
||||
|
||||
if($product_array[0]->ProductAvailableQty != null){
|
||||
$soldQty = $m->getSoldQty($product_array[0]->Id);
|
||||
// var_dump($soldQty);
|
||||
// echo $product_array[0]->ProductAvailableQty;
|
||||
$availableQty = $product_array[0]->ProductAvailableQty - $soldQty[0]->SoldQty;
|
||||
}else{
|
||||
// echo 'no qty';
|
||||
$availableQty = null;
|
||||
}
|
||||
// $product_array[0]->ProductAvailableQty
|
||||
|
||||
return view('teamstore-sublayouts.product-details')
|
||||
->with('store_array', $store_array)
|
||||
->with('product_array', $product_array)
|
||||
->with('thumbnails_array', $thumbnails_array)
|
||||
->with('teams_array', $teams_array)
|
||||
->with('sizes_array', $sizes_array);
|
||||
->with('sizes_array', $sizes_array)
|
||||
->with('available_qty', $availableQty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -134,5 +134,13 @@ class TeamStoreModel extends Model {
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getSoldQty($productId){
|
||||
$i = DB::table('orders')->select(DB::raw('SUM(Quantity) AS SoldQty'))
|
||||
->where('ProductId', $productId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user