summaryrefslogtreecommitdiff
path: root/indoteknik_custom
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-10-16 11:19:07 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-10-16 11:19:07 +0700
commit34baf6dc9d7031fdfa196446ef4274fff03d0abc (patch)
treef8e4fc3bf65e280df9c0b8e80982f0f9828c162c /indoteknik_custom
parenteefe129e31b112d80038fc3aecf2aee4c4e10108 (diff)
Fix cart API
Diffstat (limited to 'indoteknik_custom')
-rw-r--r--indoteknik_custom/models/website_user_cart.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index 47a695fe..2721d66f 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -55,11 +55,15 @@ class WebsiteUserCart(models.Model):
def get_product_by_user(self, user_id, selected=False, source=False):
user_id = int(user_id)
- source = source if source else 'add_to_cart'
+
+ if source == 'buy':
+ source = ['buy']
+ else:
+ source = ['add_to_cart', 'buy']
parameters = [
('user_id', '=', user_id),
- ('source', '=', source)
+ ('source', 'in', source)
]
if selected: