It is working ok, but the particular values selected are not showing
up in:
- the "New Orders" summary in the admin dashboard
- the /contact/order list
- the /contact/order/1 detail
Could someone summarize what I'd need to change to get that to
be shown?
Thanks.
I need the particular choices made to be available in the confirmation
email
as well as in the admin reports.
So far as I can tell however, this can't easily be done -- the saved
data is tied
to the shop_cart entity, not the contact_order entity, and I don't see
a path
of joins between them.
So maybe I'm going to have to redo my whole approach and go back
to the Product Variation thing, where there is a reified product
entity
for every possible cross-product of option values?
my knowledge of python and of django is limited, but here is what i've
done so far just working in the dark.
Added to satchmo/contact/models.py
from satchmo.product.models import Product, DownloadableProduct,
CustomTextField
....
class CustomFieldValue(models.Model):
"""
The value of some product_customtextfield chosen by a user for
some
contact_orderitem
"""
order_item = models.ForeignKey(OrderItem)
custom_field = models.ForeignKey(CustomTextField)
value = models.CharField(max_length=200)
I ran manage.py sql contact add ran the generated "CREATE TABLE".
added inner loop in satchmo/payment/comment/pay_ship.py (which seems
to be where
the cart is converted to an order):
# Add all the items in the cart to the
order
for item in cart.cartitem_set.all():
new_order_item = OrderItem(order=new_order,
product=item.product, quantity=item.quantity,
unit_price=item.unit_price, line_item_price=item.line_total)
new_order_item.save()
# for each custom text field in the cart item, save a row in
contact_customfieldvalue
for details in item.cartitemdetails_set.all():
new_field_value =
CustomFieldValue(order_item_id=new_order_item.id,
custom_field_id=details.customfield_id, value=details.detail)
new_field_value.save()
new_order.recalculate_total()
All I know is that the above seems to be syntactic python.
So the good news is my site is still running.
The bad news is that my new table is still empty after doing a
checkout,
so something is wrong with my inner loop code.
Anybody see what is wrong?
-mda
On Nov 5, 6:48 am, "Chris Moffitt" <ch...@moffitts.net> wrote:
> I can't see what's wrong
in particular i wasn't sure whether
for details in item.cartitemdetails_set.all():
was the right way to get at the shop_cartitemdetails table
from the shop_cartitem row.
if i have to i'll do that but ultimately i want admin reports and CSV
exports that break out values into separate columns.
I could parse it out of course; that just adds a bit more to
my speed-learning of python :)
-mda
Any suggestions? I don't see how me altering existing files could
possible mess with url mapping.
the traceback includes:
# /group/uhurupies.com/satchmo/satchmo/payment/views.py in
contact_info
# return common_contact.contact_info(request)
# /group/uhurupies.com/satchmo/satchmo/payment/common/views/
common_contact.py in contact_info
# url = lookup_url(paymentmodule, 'satchmo_checkout-step2')
# /group/uhurupies.com/satchmo/satchmo/payment/urls.py in lookup_url
# url = urlresolvers.reverse(name)
Maybe there is some buried inner exception about getting contact?
Now my problems include:
1. If I enable email for "autosuccess", I get an exception
NameError at /shop/checkout/auto/
global name 'orderToProcess' is not defined
(I'm not sure why "autosuccess" is even managing its own email anyhow)
2. For some reason my install has decided not to do checkout over
https anymore.
I have both the master and subsidiary checkboxes enabled for this
in the admin. And it used to work. But now, even if I enter a "https:"
url to help it along as it were, it redirects back to "http:"
-mda
1. If I enable email for "autosuccess", I get an exception
NameError at /shop/checkout/auto/
global name 'orderToProcess' is not defined
(I'm not sure why "autosuccess" is even managing its own email anyhow)
2. For some reason my install has decided not to do checkout over
https anymore.
I have both the master and subsidiary checkboxes enabled for this
in the admin. And it used to work. But now, even if I enter a "https:"
url to help it along as it were, it redirects back to "http:"
1. If I enable email for "autosuccess", I get an exception
NameError at /shop/checkout/auto/
global name 'orderToProcess' is not defined
(I'm not sure why "autosuccess" is even managing its own email anyhow)