Please refer to TemplateMonster Support for any issues surrounding TemplateMonster/TemplateTuning Themes – thanks, Jigoshop Team

Sale Price Dates not working


20 Jun, 2011 07:28 PM

I set the "sale price date from" parameter to some day in the future, but the "sales" legend still present on the product page.

I checked jigoshop_product.class.php and the parameters "sale_price_date_from" and "sale_price_date_to" are not being used any where on the class, specially is not being used to determine the sale status of the product (on the function is_on_sale ).

  1. Support Staff 2 Posted by Jigoshop on 20 Jun, 2011 07:52 PM

    Jigoshop's Avatar

    It won't do - to allow sorting and filtering we need to have a standard price field - so to handle sales we have a cron which changes the price when the criteria are met.

    What prices/dates have you set? Ill try to reproduce it.

  2. 3 Posted by jesus.rodriguez.viorato on 21 Jun, 2011 12:40 AM

    Well, i set:
    Regular price: 170, Sale price: 150
    Sale price dates:

     FROM: 2011-11-01 

    But you say that the price is changed by a cron job. So, should I wait until the cron run ? or should I run it some how? because I don't want to see the sale price until November 2011.

  3. 4 Posted by jesus.rodriguez.viorato on 21 Jun, 2011 03:04 AM

    I think i know what's happening. The problem is on product-data-save.php, on lines 164 to 171:

            if ($date_from && $date_from  strtotime('NOW')) :
                update_post_meta( $post_id, 'price', $data['regular_price'] );
                update_post_meta( $post_id, 'sale_price_dates_from', '');
                update_post_meta( $post_id, 'sale_price_dates_to', '');

    It is necessary to convert $date_to and $date_from to timestamp values using strtotime() function.

    I tested and all works fine to me now.

  4. Support Staff 5 Posted by Jigoshop on 21 Jun, 2011 10:12 AM

    Jigoshop's Avatar

    Thanks for the fix.

  5. 6 Posted by jesus.rodriguez.viorato on 21 Jun, 2011 03:30 PM

    With the change above another error popped out: in line 168 (same file product-data-save.php) it should be a "less than " symbol.

    This was causing loosing sales start and end dates after saving the product form.

  6. Support Staff 7 Posted by Jigoshop on 23 Jun, 2011 01:56 PM

    Jigoshop's Avatar

  7. 8 Posted by jesus.rodriguez.viorato on 23 Jun, 2011 09:32 PM

    Thanks Mike, excellent work and awesome plugin by the way.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.