Re: Price always $0 on Custom Product

50 views
Skip to first unread message

Chris Moffitt

unread,
Jun 7, 2012, 9:31:03 PM6/7/12
to satchm...@googlegroups.com
I can't reproduce this. Did you try running python manage.py satchmo_rebuild_pricing ?

-Chris

On Thu, Jun 7, 2012 at 12:53 PM, MaDeuce <khea...@gmail.com> wrote:
I am attempting to provision a custom product into Satchmo 0.9.2, but the price always shows as $0, no matter what I enter.  I'm sure I'm missing something, but I can't figure out what.

What I'm doing:
  1. Created an option group with two items, with prices of $10 and $20. 
  2. Create an ordinary product using Satchmo admin, giving the product a price of $100.  When I list products in the admin, it shows up and the unit price is correct.
  3. Return to product in Satchmo admin, click 'Add custom product'.
  4. On custom product screen, set percent downpayment to 100, uncheck deferred shipping, select option group from 1) above, then 'save'.
When I view the product, it is correctly shown as a custom product, but the price is now $0.  This is the case regardless of the downpayment amount and deferred shipping settings.

Shouldn't the base price of the product show up as $100?  Any pointers greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Satchmo users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/satchmo-users/-/koLjIJO0AO0J.
To post to this group, send email to satchm...@googlegroups.com.
To unsubscribe from this group, send email to satchmo-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en.

MaDeuce

unread,
Jun 9, 2012, 4:08:54 PM6/9/12
to satchm...@googlegroups.com
Chris, thanks for the reply.  No, I had not run satchmo_rebuild_pricing.  I did run it after I saw your note; it made no difference. 

My initial reaction is that I'm adding the custom product incorrectly, but I've gone through the process dozens of times in various sequences and always get the same result -- the price that a customer would see for the custom product is $0.

I ran through it again and attempted to be as precise as possible recording my steps:

My environment is unmodified 0.9.2 using virtualenv/virtualenvwrapper, Python 2.7.2, OS-X.

1) clonesatchmo.py
2) cd store; ./manage.py runserver 8001
3) Add product
      Category->software
      Full Name->Example
      Price->11.11
      Save

At this point, the product appears in product listing and its price is correctly shown as $11.11.

4) Add Option Group
      Name->ExGroup
      Option Items
          Display value->None,  Stored value->1,  Price Change->0,  Sort order->0
          Display value->Little,  Stored value->2,  Price Change->9.00,  Sort order->1
          Display value->Lot,  Stored value->3,  Price Change->66.99,  Sort order->2
      Save

5) Edit product created in step 3
   Click 'Add CustomProduct'

6) In Add Custom Product view,
   Click 'ExGroup'    (created in step 4)
   Save

Results:

A) If I view products in Satchmo admin, unit price now shows '$-0.00', product subtypes is "('CustomProduct',)".

B) If I view product via http://localhost:8001/product/example/, ExGroup options appear correct, but changing option value has no affect on 'Price' -- Price remains at '-$0.00'.

C) If I view the product via http://localhost:8001/admin/product/product/20/, the correct price of $11.11 is shown.

If there is additional info that I can provide, please let me know.

--Ma

MaDeuce

unread,
Jun 9, 2012, 5:01:22 PM6/9/12
to satchm...@googlegroups.com
This doesn't address addresses the root of the problem, however, I was bugged as to why selecting different option values didn't update the product's price (even if it was incorrectly 0).  

After poking around a little, it seems like there should be a 'change' event handler for any selects present in the custom product template, much like what appears in the configurable product template.  This would, of course, require that jQuery and jQuery Form be included, which they are not.  Figured I'd throw this out, FWIW.  Sorry if I'm in the weeds on this one.

--Ma

MaDeuce

unread,
Jul 23, 2012, 8:36:43 PM7/23/12
to satchm...@googlegroups.com
Wanted to close the loop on this one. I was indeed in the weeds with the jQuery comment.

This was caused by an error in the way that MacPorts built Python 2.7.2,
which caused Decimal division to return incorrect values.  In my
case, the bug caused the price calculation to always evaluate to 0,
resulting in the behavior I was asking about.

Satchmo specifics: in the file satchmo/apps/product/modules/custom/models.py, the
function get_qty_price() returns the value of the following
expression:  'price * self.downpayment / 100'.  Due to the bug, the expression always has a value of 0.

You can tell if your Python is built with this problem by running the
following test:

python -m doctest /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/decimal.py

If the doctest returns errors, your configuration may have the bug.

The current MacPorts has apparently been patched and current versions build
Python27 correctly.  I didn't want to simply upgrade everything, so I
made the minimum possible fix by adding the following line

configure.compiler gcc-4.2

to the Python27 portfile (which is located at

Then run the following commands:

sudo port clean python27
sudo port upgrade --force python27

Here is the link is where I first learned about the problem:
Although the solution outlined there didn't work for me (i.e., I
wasn't able to simply change CC and recompile).

Here's the bug report on MacPorts:
Reply all
Reply to author
Forward
0 new messages