Skip to content

Commit

Permalink
Added long time conditianal addition
Browse files Browse the repository at this point in the history
Was loitering around in my work tree - need to push this
  • Loading branch information
Chris Glass committed Sep 27, 2011
1 parent 04ce00f commit eb725fa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions shop_simplevariations/views.py
Expand Up @@ -27,8 +27,10 @@ def post(self, *args, **kwargs):
option_ids.append(self.request.POST[key])
elif key.startswith('add_item_text_option_'):
id = key.split('add_item_text_option_')[1]
text_option_ids.update({id:self.request.POST[key]})

txt = self.request.POST[key]
if txt != '':
text_option_ids.update({id:txt})

#now we need to find out if there are any cart items that have the exact
#same set of options
qs = CartItem.objects.filter(cart=cart_object).filter(product=product)
Expand Down Expand Up @@ -80,11 +82,12 @@ def post_success(self, product, cart_item):
elif key.startswith('add_item_text_option_'):
id = key.split('add_item_text_option_')[1]
txt = self.request.POST[key]
txt_opt = TextOption.objects.get(pk=id)
cito = CartItemTextOption()
cito.text_option = txt_opt
cito.text = txt
cito.cartitem = cart_item
cito.save()
if txt != '':
txt_opt = TextOption.objects.get(pk=id)
cito = CartItemTextOption()
cito.text_option = txt_opt
cito.text = txt
cito.cartitem = cart_item
cito.save()

return self.success()

0 comments on commit eb725fa

Please sign in to comment.