The word "stock info" was bugging me as it's not quite correct for the
combination of availability and price information. The problem is the
word "stock" which implies physical widgets in a warehouse somewhere.
It sounds weird for ask for stock info for a digital product.
Hence, I came up with PurchaseInfo, which is a bit more vague but
captures the information better.
Use a custom widget to show unavailable variants in dropdown
We define a custom select widget which allows certain choices to be
marked as disabled. We use this to include unavailable variants in the
add-to-basket dropdown.
Ensure basket lines have a strategy instance in formset
This change ensures that each basket line instance has a strategy set
for the BasketLineFormSet. This means you can access the price and
availability properties of the line.
Fixes #961
Previously, a variant was only added to the "Pick a variant" dropdown
when it had one or more product attributes set. This helps distinguish
variants with the same title, but should not be required by Oscar as
one can also set different titles for the variants.
This is a tricky one as there were many places that called this method.
It now exists on the availability instance and doesn't require the user
to be passed anymore (as it is already available).
Quite a tricky change for the search index as it doesn't have a
request/user to use for a pricing/availability strategy. Instead, we
need to enable a *default* strategy that applies to all users in some
sense.
This requires changes to `add_product` to allow the chosen stock record
to be passed in. The various basket properties then use the selected
stockrecord to fetch price information.
This implementation is likely to change to allow tax to be calculated
based on session variables at some point - probably by injecting the
price strategy into the constructor.
When adding to the basket, products with options were treated as
different products for each combination of options. This allowed adding
more products into the basket than are available for purchase.
The handling has been updated to sum up the already added quantity of
the product regardless of options.
Fixes #665
Before this commit, all products of Lines in the saved basket would be
checked for availability on each action, even on unrelated actions
like deleting a line or moving another line to the basket. This was
mentioned in issue #666.
This changeset only does the availability check if the Line is to be
moved back to the basket.
I refactored the fields list for SavedLineForm from blacklisting six
fields to whitelisting two field for clarity reasons.
Fixes #666
This commit will make the templatetags to pull the form rendering
permission from the form object.
Also there will be two attributes set in the form when redering
purchase_permitted, and reason. This will allow a better information to
be displayed on the template.
It was injecting user and basket separately before onto form contructor.
The result was that in some cases it would make it difficult to twist
functionality that was depending for instance on the request object.
Passing the whole request object on the form will make it more flexible
to change.
Also, the basket_tags where reviewed they also started passing the
request object instead of the user.
Main page content of basket page has been extracted into a partial so it
can be loaded separately. The basket page now uses jQuery's load
function to update the #content_inner div when the formset is submitted.
Rework the clean() method of the add-to-basket form
This fixes a bug with adding customised products to the basket, where
the clean method would get a MultipleObjectsReturned exception as the
lookup wasn't taking options into account.
Also fixed a display issue with required options in basket forms.
Fixed #254 - Reworked basket form validation for product.
This fix is slightly different from the suggested patch in that I don't
dynamically set the form field. Instead, I removed the required=False
and handle the validation within the clean method.