Fix printMultiProductSheet
making 2 sheets for the firs product item
This commit is contained in:
parent
6aab7d4eff
commit
c88583d727
2 changed files with 8 additions and 9 deletions
|
|
@ -28,7 +28,6 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function index(IndexFilterRequest $request)
|
||||
{
|
||||
// DB::enableQueryLog();
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $brands */
|
||||
$brandsQuery = Brand::query();
|
||||
|
||||
|
|
@ -40,7 +39,6 @@ class ProductController extends Controller
|
|||
$this->sortQuery($productsQuery);
|
||||
|
||||
$products = $this->paginate($productsQuery);
|
||||
// dd(DB::getQueryLog(), $products->items());
|
||||
|
||||
/** @var array $printMultiProduct Array of id */
|
||||
$printMultiProduct = session('printMultiProduct') ?? [];
|
||||
|
|
@ -320,6 +318,7 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function printMultiProductSheet()
|
||||
{
|
||||
// FIXME: This should not use session.
|
||||
/** @var array printMultiProduct */
|
||||
$printMultiProduct = session('printMultiProduct') ?? [];
|
||||
asort($printMultiProduct);
|
||||
|
|
|
|||
|
|
@ -319,14 +319,14 @@ class Product extends Model
|
|||
// * If not yet defined, set the first page.
|
||||
if (is_null($pdf)) {
|
||||
$pdf = Product::generateProductPdf($product, $title);
|
||||
} else {
|
||||
// * Add another page and add HTML from view to this.
|
||||
$pdf->getMpdf()->AddPage();
|
||||
$pdf->getMpdf()->WriteHTML((string)view(
|
||||
'documents.product-body',
|
||||
['product' => (object)(new ProductResource($product))->toArray()],
|
||||
));
|
||||
}
|
||||
|
||||
// * Add another page and add HTML from view to this.
|
||||
$pdf->getMpdf()->AddPage();
|
||||
$pdf->getMpdf()->WriteHTML((string)view(
|
||||
'documents.product-body',
|
||||
['product' => (object)(new ProductResource($product))->toArray()],
|
||||
));
|
||||
}
|
||||
return $pdf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue