Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Cannot import @website_sale/js/utils

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
javascript
2 Odpowiedzi
495 Widoki
Awatar
Chuck Mako

Hello I am patching WebsiteSale.prototype to modify the behavior of the add to cart button. Everything is working fine except I need to show the little popup when I press add to cart, I see in that by default the button uses updateCartNavBar and showCartNotification but I can't import these functions.

I tried

import { updateCartNavBar, showCartNotification } from "@website_sale/js/website_sale_utils";

or 

import { updateCartNavBar, showCartNotification } from "@website_sale/js/utils";

The former is giving me an error saying updateCartNavBar is not a function and the latter is saying that it cannot import from website_sale/js/utils

Any way I can fix that

0
Awatar
Odrzuć
Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

Hi,


The issue is the method of importing.Please import and use them using the reference given

import wSaleUtils from "@website_sale/js/website_sale_utils";

wSaleUtils.updateCartNavBar(data);

wSaleUtils.showCartNotification(callService, data.notification_info);


Hope it helps.

0
Awatar
Odrzuć
Chuck Mako
Autor

I don't seem to have access to callService in my patch

Chuck Mako
Autor

Nevermind I managed to make it work, thanks for your answer

Awatar
Chuck Mako
Autor Najlepsza odpowiedź

Anyone has an idea? I'm using Odoo 18, I have imported website_sale in manifest, I have imported my js file into frontend assets but it still doesn't work

0
Awatar
Odrzuć
Codesphere Tech

Have you tried this ?
import { CartNotification } from "@website_sale/js/notification/cart_notification/cart_notification";

Chuck Mako
Autor

Unless I'm mistaken, since I'm patching the legacy AddToCart widget I cannot use Owl components or services to create the notification?

Codesphere Tech

Yes, but could you tell me what you're trying to customize? Maybe I can help.

Chuck Mako
Autor

Basically I'm patching the AddToCart button to add extra parameters to the rpc call since I have added extra inputs to the product page. I had to do this because I had to override the controller in the backend and control the variant creation process.

patch(WebsiteSale.prototype, {
async _onClickAdd(ev) {
const form = this.el

ev.preventDefault();
ev.stopPropagation();

const res = await rpc("/shop/cart/update_json", payload);
},
});

Codesphere Tech

So you want to stop for a second while adding a product into cart, right? Share me the xml snippet or requirement here?

Chuck Mako
Autor

Everything works as far as what the add to cart button does, I call the backend and add the product to cart, I just need to show the cart notification when the button is clicked

Codesphere Tech

Ok like mini cart open when we add the product into cart?

Chuck Mako
Autor

Yes exactly the notification you get at the top right of the screen

Codesphere Tech

Ok for that, you need to changes inside the JS and XML like below(just sample):
<template id="product_review_form" inherit_id="website_sale.product" priority="20">
<form id="valid_review" t-attf-action="/submit_review/#{product.id}" method="POST" class="mt-2">
<input type="email" class="form-control email_submit" name="email_product" required=""
data-fill-with="email"/>
<button type="button" t-att-data="product.id" name="send_email" class="btn btn-primary mt-2">Send Email</button>
</form>
publicWidget.registry.AdvanceFormSwitcher = publicWidget.Widget.extend({
selector: '#valid_review',
events: {
'click button[name="send_email"]': '_sendEmail',
_sendEmail(ev){
your custom code here for open a popup..
}

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Cómo cerrar una transferencia interna al recibirla desde la vista de código de barras stock.picking
javascript
Awatar
0
lip 25
1103
Why use the Lazy Translation function _lt()
javascript
Awatar
Awatar
1
lip 25
6367
How to use ReactJS and Next.js to build a fully customizable, open-source headless frontend for Odoo
javascript
Awatar
0
lip 25
2143
Odoo 18 custom event(s) within a JavaScript form controller
javascript
Awatar
0
cze 25
2090
How to use multi label switching interface in Odoo Rozwiązane
javascript
Awatar
Awatar
1
cze 25
1770
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now