Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] website_sale, *: add products searchbar snippet #30366

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@kea14
Copy link
Contributor

kea14 commented Jan 18, 2019

  • website

When the e-commerce is installed, you can now add a new snippet that can
be dropped anywhere: a search bar to search for products with an
autocomplete feature.
That snippet is also used as default "/shop" search bar. Finally,
you have the possibility to customize the snippet via snippet options.

task-1866973

@kea14 kea14 requested a review from qsm-odoo Jan 18, 2019

@robodoo robodoo added the seen 🙂 label Jan 18, 2019

@C3POdoo C3POdoo added the RD label Jan 18, 2019

@robodoo robodoo added the CI 🤖 label Jan 18, 2019

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Jan 21, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Jan 21, 2019

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Jan 28, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Jan 28, 2019

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Jan 29, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Jan 29, 2019

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Jan 30, 2019

@robodoo robodoo removed the CI 🤖 label Jan 30, 2019

@kea14

This comment has been minimized.

Copy link
Contributor Author

kea14 commented Jan 30, 2019

@qsm-odoo updated. Could you check ? (comme je te disais tout à l'heure par rapport à l'organisation de mon code dans les fichiers, pas spécialement le code en lui même pour le moment comme je n'ai pas complètement terminé)

@robodoo robodoo added the CI 🤖 label Jan 30, 2019

@qsm-odoo
Copy link
Contributor

qsm-odoo left a comment

There are stuff to change of course but I think you are in the right way. Have you still the problem you talked about yesterday ?

Show resolved Hide resolved addons/website_sale/static/src/js/website_sale_options.js Outdated
@kea14

This comment has been minimized.

Copy link
Contributor Author

kea14 commented Jan 31, 2019

@qsm-odoo Yes I still have this problem : my snippet options only works when in edit mode on /shop. Apart from that, everything is at least working 😄

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Jan 31, 2019

@robodoo robodoo removed the CI 🤖 label Jan 31, 2019

Show resolved Hide resolved addons/website_sale/static/src/js/website_sale_options.js Outdated
Show resolved Hide resolved addons/website_sale/static/src/js/website_sale_options.js Outdated
Show resolved Hide resolved addons/website_sale/static/src/xml/website_sale.editor.xml Outdated

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Feb 1, 2019

@kea14

This comment has been minimized.

Copy link
Contributor Author

kea14 commented Feb 1, 2019

Branch update.
last TODOs:

  • "that snippet can be used as default /shop search bar too"
  • re-read all the code

@robodoo robodoo added the CI 🤖 label Feb 1, 2019

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Feb 4, 2019

@robodoo robodoo removed the CI 🤖 label Feb 4, 2019

@kea14 kea14 force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Feb 5, 2019

@kea14

This comment has been minimized.

Copy link
Contributor Author

kea14 commented Feb 5, 2019

@qsm-odoo Can you have a look when you have some time ?

"that snippet can be used as default /shop search bar too" In fact I don't really understand. Should there be an option to enable using this snippet instead of default /shop search bar ?

Thanks 😄

@seb-odoo
Copy link
Contributor

seb-odoo left a comment

Some thoughts about the controller

Show resolved Hide resolved addons/website_sale/controllers/main.py Outdated
Show resolved Hide resolved addons/website_sale/controllers/main.py Outdated
Show resolved Hide resolved addons/website_sale/controllers/main.py Outdated
Show resolved Hide resolved addons/website_sale/controllers/main.py
Show resolved Hide resolved addons/website_sale/controllers/main.py Outdated
Show resolved Hide resolved addons/website_sale/controllers/main.py Outdated
Show resolved Hide resolved addons/website_sale/controllers/main.py Outdated
Show resolved Hide resolved addons/website_sale/controllers/main.py

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Mar 11, 2019

@robodoo robodoo removed the CI 🤖 label Mar 11, 2019

@qsm-odoo

This comment has been minimized.

Copy link
Contributor

qsm-odoo commented Mar 11, 2019

@JKE-be @seb-odoo Pushed a new commit on top, I have not yet reread and tested properly but this should take all your comments into account. Maybe you can check if the python route seems "better" than before. (I send you this now as I have to go :))

@seb-odoo

This comment has been minimized.

Copy link
Contributor

seb-odoo commented Mar 11, 2019

To write down what I just told you:

You still need to call _get_combination_info but with only_template=True to get the proper price: this method will apply for example b2b/b2c settings and currency convert depending on current pricelist. See f2d4b11 and 956b5ca#diff-caf4f49644744b1b91211fd12223dbd2R105 to see how it is done on /shop (this has yet to be forward-ported).

If you need to return the current currency, you need to get it from the pricelist like it was done before. The currency field on the product is the currency on which the product was encoded, usually the currency of the main company (and not the destination currency).

@robodoo robodoo added the CI 🤖 label Mar 11, 2019

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Mar 12, 2019

@robodoo robodoo removed the CI 🤖 label Mar 12, 2019

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Mar 12, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Mar 12, 2019

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Mar 13, 2019

@robodoo robodoo removed the CI 🤖 label Mar 13, 2019

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Mar 13, 2019

@qsm-odoo

This comment has been minimized.

Copy link
Contributor

qsm-odoo commented Mar 13, 2019

@kea14 : new review of your work

  1. odoo-dev@be0f9a1 use correct ordering. The shop page used a function to determine the correct order, the autocomplete should have used it too. Also, you forced the user to choose a specific order for the autocomplete, while the most useful order is the default one. I added the possibility to choose the default one. Also, the shop page search order was broken when removing the sort by button without this.

  2. odoo-dev@d1b4b23

  • allow to choose the number of records to display with autocomplete (and add a max limit, the previous code allowed to get 1000000 products from the database)
  • review the way options are handled in routes
  • @seb-odoo Is the new /shop/products/autocomplete route method correct now ? (I included your 12.0 commit in the PR)
  • allow to use the search snippets without the autocomplete feature (just a searchbar)
  1. odoo-dev@810b485 replaced the use of the autocomplete library as it will be removed for 13.0 and it does not work with website style and themes anyway (ugly blue, etc). Now it uses a bootstrap dropdowns. Note that we may want to extract this to be reusable elsewhere... I suppose I will see with the framework team when they will remove jquery.ui.

@JKE-be One comment: the options for the searchbar are only possible on the snippets, not on the shop page's searchbar... maybe we should at least add the possibility to disable the autocomplete thanks to a customize menu option ?

@qsm-odoo

This comment has been minimized.

Copy link
Contributor

qsm-odoo commented Mar 13, 2019

Update: for point (3), I will try to use select2

@robodoo robodoo added the CI 🤖 label Mar 13, 2019

@qsm-odoo

This comment has been minimized.

Copy link
Contributor

qsm-odoo commented Mar 13, 2019

Mmh, I think I will forget about select2, we can think about it if we need it in a future task again. But here, with more code, I have:

  • No caching of the requests
  • The lib is out-dated
  • Forced to initialize the select2 in multiple mode, so it adds a tag on selection (and I am forced to do the redirected to the product page in JS
  • Broken style, I managed to use bootstrap classes on top but some ugly blue and hovering style remained
  • The search button cannot work anymore as the search term is removed once you leave the input
  • When you leave the input, the input shrinks
  • For some reason I cannot click on the items...

We will see if we need an autocomplete again, I will backup my select2 tests.

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch to ce0f694 Mar 13, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Mar 13, 2019

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch Mar 14, 2019

@robodoo robodoo removed the CI 🤖 label Mar 14, 2019

@qsm-odoo

This comment has been minimized.

Copy link
Contributor

qsm-odoo commented Mar 14, 2019

Handled @seb-odoo requested changes here (including displaying the promotions): odoo-dev@f2f6a40

Also here: odoo-dev@a3f360e I handled the too long descriptions by truncating server side according to the max number of characters the client asks (depending on the input length). cc @JKE-be -> maybe we should do that for titles too ?

[IMP] website_sale, *: add products searchbar snippet
* website

When the e-commerce is installed, you can now add a new snippet that can
be dropped anywhere: a search bar to search for products with an
autocomplete feature.
That snippet is also used as default "/shop" search bar. Finally,
you have the possibility to customize the snippet via snippet options.

task-1866973

Co-authored-by: qsm-odoo <qsm@odoo.com>

@qsm-odoo qsm-odoo force-pushed the odoo-dev:master-searchbar-snippet-products-aul branch to c140fdc Mar 14, 2019

@robodoo robodoo added the CI 🤖 label Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.