Place Products on Sale

98 views
Skip to first unread message

Brian Lee

unread,
Jul 28, 2010, 5:41:44 PM7/28/10
to Satchmo users
How can I place a product on Sale so that the below code's if case is
triggered (from default product template)?

I thought it would be to have two prices with one having expiration
date. But that is not the case.

{% if sale %}<strike id="fullprice" style="display:
block;">{{ product|discount_price:""|currency }}</strike>{% endif %}
<span id="price">{{ product|discount_price:sale|currency }}</span>

Where do I need to look to see how {% if sale % is triggered?

lzantal

unread,
Jul 28, 2010, 6:36:20 PM7/28/10
to Satchmo users
Hi,
I run into the same issue awhile back. It's on my list to make it more
clean and use a templatetag
instead of this Hack.
But here is a quick hack to show the full price strike through and the
sale price
"""
<p>
<span class="product-titles">Price:</span>
{% if product.get_qty_price_list.1.1 %}
<span style="text-decoration: line-
through;">{{ product.get_qty_price_list.0.1|currency }}</span>
&nbsp
<span style="color:red;">{{ product|discount_price:sale|currency }}
</span>
{% else %}
{{ product|discount_price:sale|currency }}
{% endif %}
</p>
"""

Hope it helps

lzantal

John-Scott

unread,
Jul 28, 2010, 6:49:39 PM7/28/10
to Satchmo users
Proper 'sales' as normally understood (30% off Brand X, no discount
code required) are not directly supported in Satchmo as best as I can
tell.

The 'sale' template tag returns an actual Discount code object if and
only if there is an automatic discount (aka store wide sale). See [1]
for the relevant criteria used for selecting a Discount as 'sale'.

No other types of Discounts or temporary price reductions will
automatically show up for this template tag. I'm am currently trying
to work out a template tag which will cover all cases, but it's a
beast.

[1] http://bitbucket.org/chris1610/satchmo/src/0bd6df5821d2/satchmo/apps/product/utils.py#cl-26

Stanislav Mihaylov

unread,
Oct 16, 2012, 10:10:10 AM10/16/12
to satchm...@googlegroups.com
Hello Scott, I was wondering did you manage to develop this template tag after all ? I am trying to implement sales for particular products without discount code too...

LZAntal

unread,
Oct 16, 2012, 2:53:41 PM10/16/12
to satchm...@googlegroups.com
Hi,

I needed that functionality as well. I ended up using is adding a second price for the product with an expiration date then in my template I check for that price.
"""
{% if product.get_qty_price_list.1.1 %}
<span style="text-decoration: line-through;">{{ product.get_qty_price_list.0.1|currency }}</span>
&nbsp;
<span style="color:red;">{{ product|discount_price:sale|currency }}</span>
{% else %}
{{ product|discount_price:sale|currency }}
{% endif %}
"""

Hope it helps.

Laszlo
http://twitter.com/LZAntal
> --
> 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/-/LAsanoCSTA0J.
> 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.

Stanislav Mihaylov

unread,
Oct 21, 2012, 3:40:27 PM10/21/12
to satchm...@googlegroups.com
Thank you for your answer, I also found this solution by reading through the topics in the group - it is good for displaying the full price and then the discounted one.
Nevertheless, my client wanted a more comprehensive way of creating sales from the admin panel - being able to create 'absolute amount off', 'percentage of'f' and multibuy sales from the type '3 for the price of 2' and being able to apply it to multiple products without having to open every product's edit page, so I ended up creating custom 'Sale' model that has a similar interface to 'Discount', but instead of messing with discounts, its save method creates such second prices for products, selected from a multi-choice checkbox widget. In order to connect the 'Sale' to the created second prices for further reference and CRUD operations, I subclassed the 'Price' model with my own 'SalePrice' that has a foreign key to Sale. So a new Sale creates SalePrices and they in turn create Price entries, while Satchmo's original models stay unmodified.
If anybody needs any further details of how I did it, feel free to ask!

gg

unread,
Nov 15, 2012, 12:51:48 PM11/15/12
to satchm...@googlegroups.com
Hi

I would be interested to add your logic of code and I think that may help me in my current satchmo shop. Would it be possible for you to send me your code please ?

Thanking you in advance.
++

Stanislav Mihaylov

unread,
Nov 26, 2012, 12:23:08 PM11/26/12
to satchm...@googlegroups.com
Hi,

I am sorry for the late reply, I must have missed the email notification from your message. Do you still need my help? I am glad to help you, but please give me more details of what exactly do you need as functionality. Do you need just the models and admin code or also ideas of how to implement it in the template, displaying a product sale e.g.?

gg

unread,
Nov 27, 2012, 12:09:22 AM11/27/12
to satchm...@googlegroups.com
Hi

Thanks for your reply.

Yes. I still need your help very much.

I would be highly obliged to get the codes and also the way to implement it in the template for displaying products. Presently I am running into couple of problems with the existing standard discounting module which has few bottlenecks. 

As you said discounting is one entity, Sales across the shop is another entity like "Get3 if you buy 2" etc..I agree with you. 

I am looking forward to your kind help. 

Thanking you in advance.
++


Reply all
Reply to author
Forward
0 new messages