Shopware 6 custom element type image not showing any data on storefront - shopware6

I have created my component to add some desired config fields in Shopware 6. Everything is working fine but one problem that is image is looking as it is being saved in the administration but is not showing any src or else in dump.
And here is my dump preiew having #data null.
can anyone tell what should I do else here?
I will be very thankful.

There is a guide in the docs that explains exactly what your case is.
You can likely extend the \Shopware\Core\Content\Media\Cms\ImageCmsElementResolver and override the getType function:
public function getType(): string
{
return 'my-component-name';
}
The important part of the default ImageCmsElementResolver is the loading the media information. For that you also need in your CMS element resolver. I explain some parts of the existing ImageCmsElementResolver so you can see which steps you need:
public function collect(CmsSlotEntity $slot, ResolverContext $resolverContext): ?CriteriaCollection
{
// read the configuration, that is defined in the Admin JS. Likely also media for you
$mediaConfig = $slot->getFieldConfig()->get('media');
// if this config is NOT containing useful info
if (
$mediaConfig === null
|| $mediaConfig->isMapped()
|| $mediaConfig->isDefault()
|| $mediaConfig->getValue() === null
) {
// return nothing
return null;
}
// otherwise use the configured value as mediaId to load the media entry from the database
$criteria = new Criteria([$mediaConfig->getStringValue()]);
$criteriaCollection = new CriteriaCollection();
$criteriaCollection->add('media_' . $slot->getUniqueIdentifier(), MediaDefinition::class, $criteria);
// return the criterias to execute later, when all needed entities for the CMS page are fetched
return $criteriaCollection;
}
Now the data is fetched and as next step you need to put it into a variable accessible from the Twig template. For this you write into the same CMS element resolver this:
public function enrich(CmsSlotEntity $slot, ResolverContext $resolverContext, ElementDataCollection $result): void
{
$config = $slot->getFieldConfig();
$image = new ImageStruct();
// this is important for accessing data in Twig
$slot->setData($image);
// read the config again
$mediaConfig = $config->get('media');
// if the configuration looks promising
if ($mediaConfig && $config->isStatic() && $mediaConfig->getValue()) {
$image->setMediaId($config->getStringValue());
// look up the media from the entity loading step
$searchResult = $result->get('media_' . $slot->getUniqueIdentifier());
if (!$searchResult) {
return;
}
/** #var MediaEntity|null $media */
$media = $searchResult->get($config->getValue());
// if we do not have a media, then skip it
if (!$media) {
return;
}
// set the media entity to the slot data we just assigned to the slot
$image->setMedia($media);
}
}
After that you should have more info in the slot variable in Twig to embed a media.

Related

Change name of cshtml file in ASP.NET Core RazorPages

My environment: ASP.NET Core 5 with RazorPages, Webpack 5.
In razor pages (.cshtml) that reference svg files, I want to inline them. This is something Webpack can do (via a plugin), but I'm not sure how to integrate these two tech stacks.
I could write templatised cshtml files, and populate them via webpack:
ContactUs.cshtml.cs
ContactUs.cshtml <------ read by webpack
ContactUs.generated.cshtml <------ generated by webpack
But then how do I force msbuild / aspnet to use the generated file (ContactUs.generated.cshtml) instead of the template file (ContactUs.cshtml) when building?
I suspect the answer is to use IPageRouteModelConvention but I'm unsure how.
(A dirty workaround is to instead use the filenames ContactUs.template.cshtml and ContactUs.cshtml but I prefer something like the above, as "generated" is clearer.)
UPDATE
To simplify the problem:
The compiler looks for Foo.cshtml.cs and Foo.cshtml.
How do I tell it to instead look for Foo.cshtml.cs and Foo.generated.cshtml?
When loading the app, the framework loads for you a set of PageRouteModels which is auto-generated from the razor page folders (by convention). Each such model contains a set of SelectorModel each one of which has an AttributeRouteModel. What you need to do is just modify that AttributeRouteModel.Template by removing the suffixed part from the auto-generated value.
You can create a custom IPageRouteModelConvention to target each PageRouteModel. However that way you cannot ensure the routes from being duplicated (because after modifying the AttributeRouteModel.Template, it may become duplicate with some other existing route). Unless you have to manage a shared set of route templates. Instead you can create a custom IPageRouteModelProvider. It provides all the PageRouteModels in one place so that you can modify & add or remove any. This way it's so convenient that you can support 2 razor pages in which one page is more prioritized over the other (e.g: you have Index.cshtml and Index.generated.cshtml and you want it to pick Index.generated.cshtml. If that generated view is not existed, the default Index.cshtml will be used).
So here is the detailed code:
public class SuffixedNamePageRouteModelProvider : IPageRouteModelProvider
{
public SuffixedNamePageRouteModelProvider(string pageNameSuffix, int order = 0)
{
_pageNameSuffixPattern = string.IsNullOrEmpty(pageNameSuffix) ? "" : $"\\.{Regex.Escape(pageNameSuffix)}$";
Order = order;
}
readonly string _pageNameSuffixPattern;
public int Order { get; }
public void OnProvidersExecuted(PageRouteModelProviderContext context)
{
}
public void OnProvidersExecuting(PageRouteModelProviderContext context)
{
if(_pageNameSuffixPattern == "") return;
var suffixedRoutes = context.RouteModels.Where(e => Regex.IsMatch(e.ViewEnginePath, _pageNameSuffixPattern)).ToList();
var overriddenRoutes = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var route in suffixedRoutes)
{
//NOTE: this is not required to help it pick the right page we want.
//But it's necessary for other related code to work properly (e.g: link generation, ...)
//we need to update the "page" route data as well
route.RouteValues["page"] = Regex.Replace(route.RouteValues["page"], _pageNameSuffixPattern, "");
var overriddenRoute = Regex.Replace(route.ViewEnginePath, _pageNameSuffixPattern, "");
var isIndexRoute = overriddenRoute.EndsWith("/index", StringComparison.OrdinalIgnoreCase);
foreach (var selector in route.Selectors.Where(e => e.AttributeRouteModel?.Template != null))
{
var template = Regex.Replace(selector.AttributeRouteModel.Template, _pageNameSuffixPattern, "");
if (template != selector.AttributeRouteModel.Template)
{
selector.AttributeRouteModel.Template = template;
overriddenRoutes.Add($"/{template.TrimStart('/')}");
selector.AttributeRouteModel.SuppressLinkGeneration = isIndexRoute;
}
}
//Add another selector for routing to the same page from another path.
//Here we add the root path to select the index page
if (isIndexRoute)
{
var defaultTemplate = Regex.Replace(overriddenRoute, "/index$", "", RegexOptions.IgnoreCase);
route.Selectors.Add(new SelectorModel()
{
AttributeRouteModel = new AttributeRouteModel() { Template = defaultTemplate }
});
}
}
//remove the overridden routes to avoid exception of duplicate routes
foreach (var route in context.RouteModels.Where(e => overriddenRoutes.Contains(e.ViewEnginePath)).ToList())
{
context.RouteModels.Remove(route);
}
}
}
Register the IPageRouteModelProvider in Startup.ConfigureServices:
services.AddSingleton<IPageRouteModelProvider>(new SuffixedNamePageRouteModelProvider("generated"));

Configuration::get() returning empty value in Controller of PrestaShop 1.6

I am using PrestaShop 1.6.1.0
I have a field in my module supporting different languages, the postProcess() looks like this:
protected function postProcess()
{
$languages = Language::getLanguages(false);
$values = array();
foreach ($languages as $lang)
{
$values['CUSTOMPAGECONFIGURATION_HEADING_TEXT'][$lang['id_lang']] = Tools::getValue('CUSTOMPAGECONFIGURATION_HEADING_TEXT_'.$lang['id_lang']);
}
Configuration::updateValue('CUSTOMPAGECONFIGURATION_HEADING_TEXT', $values['CUSTOMPAGECONFIGURATION_HEADING_TEXT'], true);
return $this->displayConfirmation($this->l('The settings have been updated.'));
}
Problem:
When I try to get this configuration variable value in a custom controller (path: /controllers/front/CustomPageController.php) like shown below, it is not fetching any results:
$headtxt = Configuration::get('CUSTOMPAGECONFIGURATION_HEADING_TEXT');
print_r($headtxt);
exit;
It is not printing anything. I want to fetch this value in a controller, but it does not work and returns an empty string.
Site is using PrestaShop 1.6.1.0 and I tried many codes available. Am I missing something?
I am using this code in new controller created by me for custom page:
$headtxt = Configuration::get('CUSTOMPAGECONFIGURATION_HEADING_TEXT');
print_r($headtxt);
exit;
I expect to output results of configuration variable which saved by the postProcess() method.
Hi #Ankur and Welcome to SO!
In your postProcess() method, you are saving this Configuration value as a multilingual value.
However, while calling the Configuration::get() static method, it seems to me you forgot to mention the language ID, here's the function prototype:
public static function get($key, $idLang = null, $idShopGroup = null, $idShop = null, $default = false)
This should work:
$id_lang = (int)$this->context->cookie->id_lang
$headtxt = Configuration::get('CUSTOMPAGECONFIGURATION_HEADING_TEXT', $id_lang);
print_r($headtxt);
exit;

Failed to set unsafe attribute upload yii

uploading images has been causing much trouble. I'm always having two problems. First it always fail to upload or unable to find the files when using asset manager when it is there in the folder!! So when my controller says unlink the file, it won't unlink anything. Second, it'll show failed to set unsafe attribute when my rules are set to safe.
Here is my rule:
array('product_image,product_gallery_1, product_gallery_2, product_gallery_3, product_gallery_4, product_gallery_5, product_gallery_6', 'file','types'=>'jpg, jpeg, gif, png','allowEmpty'=>true, 'on'=>'update', 'safe'=>true),
on view I do have
'htmlOptions'=>array('enctype'=>'multipart/form-data'),
Here's a section on update controller. It does upload multiple images:
public function actionUpdate($id)
{
$model=$this->loadModel($id);
$old_img = $model->product_image;
if(isset($_POST['Product']))
{
$model->update_date = time();
$model->product_approval_status = "N";
$t_product_image = $model->product_image;
$model->attributes=$_POST['Product'];
$product_image=CUploadedFile::getInstance($model,'product_image');
$storeid = $model->store_id;
$date = date('mdy');
$rnd = rand(0,9999);
$f_product_image = "{$rnd}-{$date}{$storeid}-{$product_image}";
//main img
if(!empty($product_image))
{
$model->product_image = $f_product_image;
}
else
{
if(file_exists(Yii::app()->basePath.'/images/shop/thumbnail/thumb_'.$model->product_image))
unlink(Yii::app()->basePath.'/images/shop/thumbnail/thumb_'.$old_img);
if(file_exists(Yii::app()->basePath.'/images/shop/product/'.$model->product_image)&& ($old_img !==null))
unlink(Yii::app()->basePath.'/images/shop/thumbnail/'.$old_img);
$model->product_image = $t_product_image;
}
if($model->save())
{
$url = Yii::app()->basePath.'/images/shop/product/';
$thumb = Yii::app()->basePath.'/images/shop/thumbnail/';
if(!empty($product_image))
{
$product_image->saveAs($url.$f_product_image);
$this->createThumb($url.$f_product_image, $thumb.'thumb_' . $f_product_image);
}
$this->redirect(array('submitted'));
}
}
$this->render('update',array(
'model'=>$model,
));
}
The problem is with your current defined scenario
In your model, you specify the attributes safe under the update scenario.
array('product_image, ..., product_gallery_6', ... 'on'=>'update', 'safe'=>true)
Therefore, in your controller, you need to set the scenario.
$model = new MyActiveRecord('update');
Since you are using a function you may not have control over, you can explicitly set this:
$model->scenario = 'update';
Note that your problem might be elsewhere, depending on the operation of loadModule(), because ceratin ActiveRecord scenarios are automatically loaded. See the section 'CActiveRecord scenarios' in the linked page.

my zend session name spacing does not work

I am new to Zend and very keen to learn, so I would really appreciate some help and guidance.
I am trying to create a 'method in a class' that will save the session variables of product pages visited by members to a site i.e
i,e examplesite com/product/?producttype= 6
I want to save the number 6 in a session variable. I also do not want to have a global session for the entire site; I just want it for selected pages. So, I guess I have to have Zend_Session::start() on the selected page; but I am not clear how this should be done.
Should I instantiate it in the page view page. i.e products page or do this in the indexAction() method for the products page. I have attempted to instantiate it below but it did not work.
public function rememberLastProductSearched()
{ //my attempt to start a session start for this particular page.
Zend_Session::start();
}
$session->productSearchCategory = $this->_request->getParam('product-search-category');
return" $session->productSearchCategory ";
}
else
{
//echo " nothing there
return " $session->productSearchCategory";
//";
}
}
With the rememberLastProductSearched() method I was trying to get the method to first check whether the user had searched for a new product or just arrived at the page by default. i.e whether he had used the get() action to search for a new product. If the answer is no, then I wanted the system to check whether their had been a previous saved session variable. so in procedural syntax it would have gone like this:
if(isset($_Get['producttype']))
{
//$dbc database connection
$producttype = mysqli_real_escape_string($dbc,trim($_GET['producttype']));
}
else
if(isset($_SESSION['producttype'])){
$producttype = mysqli_real_escape_string($dbc,trim($_SESSION['producttype']));
}
Can you please help me with the Zend/oop syntax. I am totally confused how it should be?
you're asking about simple work flow in an action, it should begin something like:
//in any controller
public function anyAction()
{
//open seesion, start will be called if needed
$session = new Zend_Session_Namespace('products');
//get value
$productCategory = $this->getRequest()->getParam('producttype');
//save value to namespace
$session->productType = $productCategory;
//...
}
now to move this off to a separate method you have to pass the data to the method...
protected function rememberLastProductSearched($productType)
{
//open seesion, start will be called if needed
$session = new Zend_Session_Namespace('products');
$session->productType = $productType;
}
So now if you want to test for presence of a value...
//in any controller
public function anyAction()
{
//open seesion, call the namespace whenever you need to access it
$session = new Zend_Session_Namespace('products');
if (!isset($session->productType)) {
$productCategory = $this->getRequest()->getParam('producttype');
//save value to session
$this->rememberLastProductSearched($productCategory)
} else {
$productCategory = $session->productType;
}
}
That's the idea.
Be mindful of your work flow as it can sometimes be very simple to inadvertently overwrite your session values.
$session = new Zend_Session_Namespace("productSearch");
if ($this->getRequest()->getParam('producttype')) { //isset GET param ?
$session->productType = $this->getRequest()->getParam('producttype');
$searchedProductType = $session->productType;
} else { //take the session saved value
if ($session->productType) {
$searchedProductType = $session->productType;
}
}
//now use $searchedProductType for your query

Uploading image file through API using Symfony2 & FOSRESTBundle

I have been coding an API for a photo sharing app like Instagram using Symfony2, FOSRESTBundle, and Vichuploader for file uploads.
I'm able to work around GET and POST requests, but I can't find an example of how to attach to a POST request, the actual image so that in my case, Vichuploader can grab it and help me out with the file upload.
By the way, I can upload a file without issue using the stack mentioned through the use of a normal form.
I have been looking for a solution about the exact same problem. Here is what I did.
First let me explain my constraints. I wanted my API to be full JSON and to take power of the HTTP protocol (headers, methods, etc.). I chose to use:
Symfony2 for the "everything is almost done for you, just code your business logic".
Doctrine2 because by default with Symfony2 and provide a way to integrate with most popular DBMS by changing one line.
FOSRestBundle to handle the REST part of my API (do the maximum with annotations, body listener, auto format for the response with JMSSerializer support, etc.).
KnpGaufretteBundle because I wanted to be allowed to change the way I store blob file quickly.
First solution envisaged: base64
My first thought, because I was thinking JSON everytime, was to encode all the incoming images in base64, then decode them inside my API and store them.
The advantage with this solution is that you can pass images along with other data. For instance upload a whole user's profile in one API call. But I read that encoding images in base64 make them grow by 33% of their initial size. I did not wanted my users to be out of mobile data after sending 3 images.
Second solution envisaged: form
Then I thought using forms as described above. But I did not know how my clients could send both JSON data (for instance {"last_name":"Litz"}) and image data (for instance image/png one). I know that you can deal with an Content-Type: multipart/form-data but nothing more.
Plus I was not using forms in my API since the beginning and I wanted it to be uniform in all my code. [mini-edit: hoho, something I just discovered, here]
Third and last solution: use HTTP..
Then, one night, the revelation. I'm using Content-Type: application/json for send JSON data. Why not use image/* to send images? So easy that I searched for days before coming with this idea. This is how I did it (simplified code). Let suppose that the user is calling PUT /api/me/image with a Content-Type: image/*
UserController::getUserImageAction(Request $request) - Catching the Request
// get the service to handle the image
$service = $this->get('service.user_image');
$content = $request->getContent();
$userImage = $service->updateUserImage($user, $content);
// get the response from FOSRestBundle::View
$response = $this->view()->getResponse();
$response->setContent($content);
$response->headers->set('Content-Type', $userImage->getMimeType());
return $response;
UserImageService::updateUserImage($user, $content) - Business Logic (I put everything here to be simplier to read)
// Create a temporary file on the disk
// the temp file will be delete at the end of the script
// see http://www.php.net/manual/en/function.tmpfile.php
$file = tmpfile();
if ($file === false)
throw new \Exception('File can not be opened.');
// Put content in this file
$path = stream_get_meta_data($file)['uri'];
file_put_contents($path, $content);
// the UploadedFile of the user image
// referencing the temp file (used for validation only)
$uploadedFile = new UploadedFile($path, $path, null, null, null, true);
// the UserImage to return
$userImage = $user->getUserImage();
if (is_null($userImage))
{
$userImage = new UserImage();
$userImage->setOwner($user);
// auto persist with my configuration
// plus generation of a unique ID that allows
// me to retrieve the image at anytime
$userImage->setKey(/*random string*/);
}
// fill the UserImage properties
$userImage->setImage($uploadedFile);
$userImage->setMimeType($uploadedFile->getMimeType());
/** #var ConstraintViolationInterface $validationError */
if (count($this->getValidator()->validate($userImage)) > 0)
throw new \Exception('Validation');
// if no error we can write the file definitively
// [KnpGaufretteBundle code to store on disk]
// [use the UserImage::key to store]
$this->getEntityManager()->flush();
return $userImage;
You use form types for posts with the FOSRestBundle:
For example you have this form type:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('facebook_id',
'text',
array(
'mapped' => FALSE
)
)
->add('profile_pic',
'text',
array(
'mapped' => FALSE
)
)
;
$builder->addValidator(new CallbackValidator(function(FormInterface $form)
{
if ($form["facebook_id"]->getData() === '' || $form["facebook_id"]->getData() === NULL)
{
$form->get('facebook_id')->addError(new FormError('facebook_id should not be empty'));
}
if ($form["profile_pic"]->getData() === '' || $form["profile_pic"]->getData() === NULL)
{
$form->get('profile_pic')->addError(new FormError('profile_pic should not be empty'));
}
})
);
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
// 'validation_constraint' => $collectionConstraint,
'csrf_protection' => FALSE,
));
}
public function getName()
{
return 'data';
}
Then what you can do is post JSON to the API. Don't forget to set the header as "Content-type = application/json" when you do a POST.
The JSON structure would look like this:
{
"data": {
"facebook_id": "12345",
"profile_pic": "/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPAAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoKDBAMDAwMDAwQDA4PEA8ODBMTFBQTExw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Zv3h+9Pfr7v9P7YfrH/y+Imrhw/ln9nzW/xd8yjI+e2qf+bLmr4V/wC10R6ek2UW854x+XuV773PHAsUu1XD7lCEuG4fLil9jNJ6ua5TTXae4TwhGr/SWSWjJHkyQhomhzYRn3Zofc1V9MxZHpFv62cLP4el/Fwoyvt/rUVRXX/yZnRTx6ev54zI7fznqn5p/Keiym2J+fSvuJRwSeWXD7lLht6vF+mw6etN/F1qwoUpr5JQ51WOmMaEaUsvOhPNp3eVHmfy+Iqnp9Is42fD9f3Wet3F+mrKy/q99fXTTR1WfzR1VdE1WU/5uqZ6emPXr+Tg9i+33uGfDb5dKuH3eneKeG3KbEsRlmm59TDf+L6OSeWNWaho/a7dOnCp/EN6P9+n+1VVWTFn5RbPw4WfD9Pj+9zysrIjMpqiuqaZzK+mn+WMz5+uY+Xq/wD07qpp48P5bPH3Bee5Kn/Zf8hdKVHnYzTqYxuRhHk36HrN2lT/AHm0yR3q3m/th+35/mZNXzWx/Nx58f7319nRkR9HoqmbMmYo+NH+3xnh69n6es8P0ep7k/8A6X6n0lL/ALN/meZ6HTDk+u9VvcrTv6Nznfr1P6f+X+pbV9W2z5ur99p0ZH9B09U/Q+jZ1fn0dHr6evTx9Ln/2Q=="
}
}
Why is this json wrapped in "data"? Because your form type also has "data" in getName so it will use validation and etc.
What I always do is I encode my pictures as a base64 string while sending them to the API.
Then in the post function you just convert it back:
$base64 = $form['profile_pic']->getData();
//decode back to image data and create image
$image = imagecreatefromstring(base64_decode($base64));
imagepng($image, $path);
This is a full upload from api code bit. This does upload the file, but I am still having trouble with validating the uploaded file. Hope this helps.
This uses fosrest bundle for REST.
private function addResource(Entity $resource) {
$em = $this->getDoctrine()->getManager();
$em->persist($resource);
$em->flush();
}
private function processForm(Entity $resource)
{
$em = $this->getDoctrine()->getManager();
$uploadedFile = null;
$form = $this->createForm(new EntityForm(), $resource);
foreach ($_FILES as $file) {
$uploadedFile = new UploadedFile(
$file['tmp_name'],
$file['name'], $file['type'],
$file['size'], $file['error'],
$test = false);
}
$submitData = array(
"file" => $uploadedFile,
);
$form->submit($submitData);
if ($form->isValid()) {
$repository = $this->getDoctrine()
->getRepository('AcmeBundle:Product');
$view = View::create();
$resource->setFile($uploadedFile);
// handling api requests
if ($this->getRequest()->getMethod() == "POST") {
$this->addResource($resource);
// store image url
$resource = $repository->find($resource->getId());
if ($resource->getImage()) {
$fs = new Filesystem();
if ($fs->exists($resource->getWebPath())) {
$resource->setImagePath($resource->getWebPath());
}
$this->addResource($resource);
}
$view->setData($resource);
}
return $view;
}
return View::create($form);
}
An example for a upload method exepting post requests:
public function uploadAction() {
$em = $this->getDoctrine()->getManager();
$document = new Document();
foreach ($_FILES as $file) {
$document->setTitle($file['name']);
$document->file = new UploadedFile($file['tmp_name'],
$file['name'], $file['type'],
$file['size'], $file['error'], $test = false);
$em->persist($document);
$em->flush();
break;
}
$serializer = $this->get('jms_serializer');
$data = $serializer->serialize(
$document, 'json',
SerializationContext::create()->setGroups(array('someGroup')));
return new Response($data);
}
So this action first stores the document on the server and returns a json response containing document meta data and path. I used the response for further processing in my web application.
I am not familiar with VichUploader, the above code is native Symfony2 code using Symfony\Component\HttpFoundation\File\UploadedFile.
Read: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html