Add new column to the product table - nopcommerce

Nopcommerce uses binary code to store the images in the database, that's a big 'no no' for me because I want the images in a folder so the supplier can upload/update those via FTP.
Now I added a new column called imagePath to the product table, but I cant use it now in my project. I already searched for an ADO entity file but could not find anything.
Does someone know how to do this, or is there a work around for my problem.?

You don't need to do this as it's already been supported. Just change the settings in nopCommerce Admin Dashboard to store the image in file system. :)

add new property in Product.cs and ProductModel.cs
public string imagePath { get; set; }
Add this property in your Product table.
Note: Manually add this column in table is necessary.
Change your ProductController and its related View. Now you can pass your external imagepath based on your requirement.
If you want to get to more detail about Add Custom Field In NopCommerce Table

Related

How do I add the new field to the user's data? (avatar)

I'm developing a REST API with Wordpress. I had to develop a new one myself, ignoring the Gravatar method. Currently, users can upload images. But I have to somehow merge the avatar path with the user's data.
I need user_avatar field like user_login, user_nicename, user_url. I know, I can hide the path of the avatar file with the wp_usermeta of the user.
But I need to do more queries to get this information. To bypass this situation, I need to combine the relevant avatar path with the user's information. When I use the get_user() or get_users() methods, I want to see the user_avatar field in them.
Can I set this flow to appear in every query without breaking the database structure? Or do you have a better suggestion for it?

ACF Fields missing after migrate but website works fine

I have recently migrated my DB to a staging environment using string find and replace on the DB to rename the domain. This has made the ACF fields in the CMS to go missing.
That page should have several fields available. And while the fields are showing in the pages that ACF group is assigned to I can't edit or see them here any more. I can't even create a New ACF group because I can't see the Add Fields box.
The website works fine, the only issue is the fields cannot be edited anymore.
Any ideas?
Solution:
Go to your DB, open table usermeta, find your user and delete the field acf_user_settings

How to populate an ArrayCollection variable with existing data from a form?

I'm kind of new with Symfony, and I have a question.
I'm currently making a Gallery Bundle (consisting of 'Gallery' and 'Image' entities), and here comes my problem.
I can upload images as well as use my entity Image corresponding to the file, but then I'd like to categorize my images into galleries. I made a One-To-Many relationship between my Gallery and Image entities, with an ArrayCollection $images (into Gallery Entity) that should represents the images.
Now, how can I populate that $images variable from a browser ?
I thought of that solution : add a text field into the Gallery entity, with the images names, and before persisting the Gallery entity, I would fetch the corresponding Images entities and put them into my variable $images, but the problem is that I can't access the entity manager from an entity..
Thanks for the help, if you need code I can of course show you, even if it's pretty basic.
EDIT: I found a way to get access to the entity manager from an entity, but it is said to be unsecure. For the time being I'll probably use that, but if someone can explain to me a better way, I'll take it.
You could write a service injected with the entity manager which can create &/or update a gallery from an array of $image names and have your controller call that rather than having your entity dependent on the entity manager. For example: (see link above for how to configure the service in services.yml)
class GalleryManager
{
private $entityManager;
public function __construct(\Doctrine\ORM\EntityManager $entityManager)
{
$this->entityManager = $entityManager;
}
public function updateGalleryImages(Gallery $gallery, array $imageNames)
{
...
}
}
However, I'm not sure if typing in image names is the best approach here. How will you ensure your image names are unique? Handle names that aren't found? Handle duplicate names? Does it matter how usable the interface is? How about efficiency - one query for each image name? how many is a gallery likely to contain?
An alternative user interface would be to provide some sort of image search/list and allow the user to select images from the results to add to the gallery - in this case the selection should come back as an array of Image entities if implemented correctly. At it's simplest, for a small number of images this could just be a multi-selectable list box of all image names although ideally the user would want to see thumbnail previews of the images they're choosing from.
A basic list box of all image names (or set of checkboxes) could be implemented using a form (data_class Gallery) with an entity field for the images collection. This would map directly onto gallery->images and the entity would never need to depend on EntityManager.
Selecting from a filtered set of images is more complex although I can point you in the right direction if it's of interest to you.
I don't know if I am missing something important which force you to populate your $images manually, but to populate a multiple image gallery from a browser and persist it I would follow the next steps:
Use a form builder from your entities to create the mapped form.
Build the Form
Validate fields (if needed)
Use Collection Field type to add multiple images
Use the controller action to persist(you should have your doctrine mappings)
Forms and Doctrine
Use the doctrine eventos: preUpdate, prePersist, PostPersist, etc. To correctly upload the image files.
File Uploads
As you can see, the cook book is a great reference to start with; it will guide you through the most common tasks on web development.

using Ckeditor or tiny mce to upload image with html in asp.net

I want to WYSIWYG editor like tiny mce or ck editor to add product description, the issue is , the user can add images using built in image uploader available in the editor within the html. Within the database i have 4 fields , producttitle, productdescription ,productimage. I am out of ideas of how will i save the images in the productimage field/ if i dont use that field how the editor will save images including the html in the productdescription field. Any suggestions or assistance will be appreciated.
Thanks
That depends on your website structure. Generally we need a separate upload field and then we store the path in database. With that way you can retrieve producttitle and productimage in order to list your products. Also with that way you keep all your product pages structure the same. I explain, let's say you have your product image on the left and the description on the right. If you want anytime to change this structure you modify one file, otherwise you will need to modify each product description field.
However it's necessary to have also an uploader on your WYSIWYG editor. You maybe need it once to add extra images or some icons. In addition, it's nice to make things easier, not only for you, but for the client. In general clients like things that they are already used (MS Office) like a complete WYSIWYG.

create field in view other than database fiels

i want to add one field in view from my module.Is there any way to add a field which is not in database to the drupal view?
Can you add a computed field (http://drupal.org/project/computed_field) to your nodes? This doesn't have to be stored in the database and it could use your module, or you could enter php code directly.

Resources