We're going to rework the Product Page in PS 1.7.8 .
Here is the list of technical issues we need to explore to find a suitable solution able to handle properly the usecase.
On 1st tab, there is a complex and powerful image manager component able to upload, edit and delete images and associated data.
Goal: build a stand-alone, configurable and maintainable JS component able to do all these actions
Actions are
On "Combinations tab" there is a listing of all combinations for a given product. Today this listing is displayed whole even if it contains thousand of items. Moreover multiple actions are available on the listing items, some targeting a single row and some having bulk behavior.
Goal: build a stand-alone, configurable and maintainable JS component able to handle this listing.
It must provide
There is a component where you select a configuration and it generates combinations for the listing.
Goal: build a stand-alone, configurable and maintainable JS component able to handle this feature.
Some data is duplicated, sometimes directly (same data on 2 tabs), sometimes indirectly on the page (same data but displayed differently on 2 tabs).
So when data 1 is updated, related data 2 must be updated accordingly. Currently there are some issues linked to that.
For example if you modify VAT included price, the VAT excluded must be updated too.
Goal: build a pluggable system that we can use to link fields and be able to describe the relationships between them.
Also need to use a dedicated mathematical JS library to make sure price computations are accurate.
On 1st tab you can link a product to multiple categories and there is a category tree to choose the target categories. It probably breaks when there are too many categories.
Goal: check current categories widget and see how it can scale when given thousand of categories input data.
https://github.com/PrestaShop/PrestaShop/issues/19281
On last "Options" tab there are multiple tabs that have dynamic content:
Goal: although these are supposed to be simple, it would be nice to have a reusable component for each of them. Or at least shared functions, maybe embedded in different components (so a AjaxListing.js util file for example being used in CustomFieldsListing.js and SuppliersFieldListing.js).
I expect us to iterate over these items multiple times. Having JS tests would be nice to be able to upgrade them without breaking existing behaviors.
Let's not forget multistore behavior and RTL behavior 馃槃
Hello,
please let's not add react as we already have Vue, this will make PrestaShop harder to be mastered for no reason.
Lets stick with Vue,
thanks
React ? Where did you see that ? Can't find it anywhere @mickaelandrieu
React ? Where did you see that ? Can't find it anywhere @mickaelandrieu
In my initial post (I edited it since then) I said
Product page must have a rigorous and exhaustive handling of all data displayed and managed to address "synchronization of data around the whole page" issue (=> use of Vue.js ? React.js ?)
I mentioned both examples but obviously we wll stick to Vue.js . I just wanted to list multiple possibilities.
Ok thanks :)
So do we use vue.js for all of these?
If yes, then I suppose we need to decide the architecture for vue?
There already exists new-theme/vue
dir which also has components
, but we will need the whole product page on vue, so would it follow similar principle new-theme/vue/pages/product
?
For the image dropzone.
So far, I think its better to stay with @tomas862 example instead of Vue, because
_Some things to consider if we use dropzone:_
Docs https://www.dropzonejs.com
1.Image Upload - when using multiple images, the server side endpoint should still be made for single image (should be refactored instead of bulk in #18689) and return image id or image settings in response. The upload should be processed by chunks (sending multiple requests). chunks are supported by Dropzone.
previewTemplate
and events
), so it would add data attribute with image-id or image settings values. So if response returns image settings, we can show the settings form onclick without separate request (which would be better IMO, especially cuz there is just couple values), else we will need another endpoint for each image settings.So far these were the main struggles, but it sounds doable with the dropzone component (more convenient than using vue.js at the moment).
its easier to follow our javascript "conventions" for migrated pages
Choosing the easy way is not always the best way, if it requires to change a bit of conventions maybe this is the good moove (Do we wants to introduce some vue anywhere or do we wants to stick with our ugly jQuery stack on new pages?) wdyt @PrestaShop/prestashop-core-developers
its easier to reuse existing html components (by passing it as template rendered in twig)
Can be easily done as I did on the POC I provided, just kick off the part from .vue files and include them in a .twig that you include in the #vueapp markup using twig. But everyone should validate that it's a good workflow and not a pain point. (Maybe it increase workflow complexity, but it's a first step about migrating the front to Vue)
It seems better to avoid introducing different frameworks in a single page.
This is something done since years on PS, the only fact that we use jQuery with VanillaJS is already a bad practice at this time as Vanilla has been really improved since years. Also Vue is already introduced on some other pages... Maybe I did'nt understand that point!
Docs https://www.dropzonejs.com
I seriously agree with the fact that we should use a library for such a component, as well as I think that complex component such as tables shouldn't be maintained by PS but by someone focusing on maintaining his own lib and not maintaining a whole big stack project.
But this is not a shock point, we could use an open source lib using vanilla JS or even VueJS..
its easier to reuse existing html components (by passing it as template rendered in twig)
Can be easily done as I did on the POC I provided, just kick off the part from .vue files and include them in a .twig that you include in the #vueapp markup using twig. But everyone should validate that it's a good workflow and not a pain point. (Maybe it increase workflow complexity, but it's a first step about migrating the front to Vue)
If its as easy as you say, then this point might make it worth using vue. It was the main argument against it.
It seems better to avoid introducing different frameworks in a single page.
... Maybe I did'nt understand that point!
I wanted to say that it becomes messy if we use vue.js for couple components and jquery (for example) for others in the SAME page. It would be much cleaner to use vue.js OR jquery in single page.
Which component will use jQuery if we use vue ? the dropdown ? Maybe we can find a good maintained lib to introduce in order to delegate this work
Related combinations discussion #19123
Most helpful comment
Hello,
please let's not add react as we already have Vue, this will make PrestaShop harder to be mastered for no reason.
Lets stick with Vue,
thanks