1

I can't get sale_start_date or sale_end_date to work in expresso store.

The following code (inside {exp:store_product})

{if on_sale}
<strong>På salg: <strike>{regular_price}</strike> {price}</strong><br>
<em>Du sparer {you_save}</em><br>
<em>Salget varer til {sale_end_date format="%m-%d-%Y"}</em>
{if:else}
<strong>Pris: {price}</strong>
{/if}

simply outputs {sale_end_date format="%m-%d-%Y"} as plain text exactly as is. It doesn't seem to be a recognized tag. All other tags seem to work.

What am I doing wrong? I can't see anything else in the docs.

4
  • What version of Store and EE are you using? Jun 30, 2014 at 13:33
  • Store 2.3.1 and EE 2.8.1 Jun 30, 2014 at 17:43
  • What happens if you output {sale_end_date} without the formatting param? Jul 1, 2014 at 8:39
  • Same result. Outputs as plain text. Jul 1, 2014 at 9:22

2 Answers 2

0

It appears this variable never made it into Store 2 even though it is in the docs. Email support and we will take a look and getting this fixed.

** Edit v2.3 doesn't have this variable for a reason. With Store 2 you can have multiple sales per product, so there is no single variable that would work. We will need to add a new feature in an upcoming version to make it work.

1
  • Also ran into this now and can see there isn't actually an attribute like sale_start_date or sale_end_date parsed in the Product.toTagArray() function. Can understand why this is difficult to achieve, because products and sales are completely separate so that a product can belong to any discounts or sales. Maybe in the mean time it can be removed from the docs, because it is obviously incorrect.
    – telliks
    Jan 13, 2015 at 11:57
0

This is probably not the best solution, because it will just use the last sale's start and end date if there's multiple sales and discounts, but it is better than nothing and most sites will only run one sale at a time.

In store/src/Store/Service/ProductsService.php just below the line (+- line 248)

$product->on_sale = true;

Add:

// HACK: added sale start and end date
$product->sale_start_date = isset($sale['start_date']) ? $sale['start_date'] : NULL;
$product->sale_end_date = isset($sale['end_date']) ? $sale['end_date'] : NULL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.