I'm glad I got you going in the right direction even if I misunderstood =)

That sounds like a pretty good approach.  Good luck!

On Tue, Dec 2, 2014 at 1:18 AM, Wesley <[email protected]> wrote:

> Hi Josh,
>   Thanks for your reply.
>
> I think DiscountCodeManager's active() method can only control visible of
> DiscountCode model, right?
> Currently, I wanna control behavior of Product and Category.
>
> Lucky that what you said gives me a good direction to dig into the code.
> So, I see that Category/Product inherit from Displayable Model where are
> publish_date and expiry_date come from.
> And, Category/Product's objects are both related to PublishedManager which
> has a published() method.
>
> So, I think:
> 1. inject one Time field to Displayable model
> 2. custom published() method to check the new added Time field.
>
> I don't know If this is correct but I will have a try later.
>
> Thanks.
> Wesley
>
>
> Hey Wesley, what I would do is use field injection to add the time fields
>> to Product and then monkey patch active method of the DiscountManager (
>> https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/
>> managers.py#L212) to also check the current time against the newly
>> injected time fields.
>>
>> On Sun, Nov 30, 2014 at 1:08 AM, Wesley <[email protected]> wrote:
>>
>>> Hi guys,
>>>   I have a question regarding Product's valid_from and valid_to field.
>>> Currently, I see we can control product's visibility by setting its
>>> valid_from and valid_to field.
>>>
>>> I see they are DateTime filed, i.e. I have to set both date and time
>>> part, and, product shows all the time through the given datetime period.
>>>
>>> However, currently, I have a requirement that set the visibility by
>>> Time, instead of DateTime,
>>> I mean, show the product through a specified time period every day, for
>>> example, display the product 08:00 - 16:00 every day.
>>>
>>> Is there anyway to achieve this without changing Mezzanine/Cartridge
>>> source code?
>>>
>>> Thanks.
>>> Wesley
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to