RSI-SHOP Posted January 16, 2020 Share Posted January 16, 2020 Witam, Chciałbym na stronie wyświetlić ile sztuk danego produktu zostało sprzedanego. Ilość dostępna wiem jak wyświetlić ale za cholerę nie wiem jak wyświetlić ile zostało sprzedany sztuk danego produktu. Może mnie ktoś nakierować jak taki efekt osiągnąć ? Prestashop 1.6.24 Pozdrawiam Link to comment Share on other sites More sharing options...
atomek Posted January 16, 2020 Share Posted January 16, 2020 Zobacz do tabeli ps_product_sales, w klasie ProductSale.php znajdziesz funkcje do obsługi tej tabeli. Link to comment Share on other sites More sharing options...
RSI-SHOP Posted January 16, 2020 Author Share Posted January 16, 2020 Funkcję znalazłem ale zmiennej nie zbytnio wiem jak wywołać I nie wiem czy jest to możliwe. Link to comment Share on other sites More sharing options...
atomek Posted January 16, 2020 Share Posted January 16, 2020 Na stronie produktu możesz to wywołać np. tak: <p>{ProductSale::getNbrSales($product->id)}<p> Wywołanie tej funkcji spowoduje wyświetlenie ile razy nastąpiła sprzedaż tego produktu - nie ilości sprzedanych sztuk, Aby wyświetlić ilość sprzedanych sztuk musisz napisać własną funkcje która będzie pobierała dane z pola 'quantity', możesz wzorować się na funkcji getNbrSales. Innym rozwiązaniem jest wyciągnięcie danych z tabeli ps_order_detail, zobacz jak to jak to jest zrobione w module 'statsproduct' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now