Add view 360 button in below cover button in admin side in product form

 

Log:

Table
Image and Image_shop
field name : view360

=================================================================

Class image.php
variable : view360
=================================================================
Productimagecontroller.php
– src/PrestaShopBundle/Controller/Admin

->add(‘view360’, ‘Symfony\Component\Form\Extension\Core\Type\CheckboxType’, array(
‘label’ => $translator->trans(‘360 image’, array(), ‘Admin.Catalog.Feature’),
‘required’ => false,
))
=================================================================
form.html.twig
– src/PrestaShopBundle/Resources/views/Admin/ProductImage
{{ form_widget(form.view360) }}
=================================================================
AdminProductWrapper.php
– src/Adapter/Product

public function ajaxProcessUpdateImage($idImage, $data)
{
// $img = new \ImageCore((int)$idImage);
$img = new Image((int)$idImage);
if ($data[‘cover’]) {
// \ImageCore::deleteCover((int)$img->id_product);
Image::deleteCover((int)$img->id_product);
$img->cover = 1;
}

if(empty($data[‘view360’]))
$img->view360 =”; //keithg added may 4 2017
else
$img->view360 =1; //keithg added may 4 2017

$img->legend = $data[‘legend’];
$img->update();
return $img;
}
=================================================================
ProductDataProvider.php
– src/Adapter/Product
public function getImage($id_image)
{
$imageData = new Image((int)$id_image);

return [
‘id’ => $imageData->id,
‘id_product’ => $imageData->id_product,
‘position’ => $imageData->position,
‘cover’ => $imageData->cover ? true : false,
‘view360’ => $imageData->view360 ? true : false, //keithg added may 4
‘legend’ => $imageData->legend,
‘format’ => $imageData->image_format,
‘base_image_url’ => _THEME_PROD_DIR_.$imageData->getImgPath(),
];
}
=================================================================

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...