Forum

Thread tagged as: Problem, Shop

Time has no meaning

Good Day, My client is trying to run a flash sale on their site, and we are having some issues. It seems that the time function of the sale is being ignored completely.

I can get the sale to work if I start the sale today and end it tomorrow, but it won't work when I try to set the sale from 6:00am to 7:00am on the same day. It's recognizing the day but not the time - so the sale doesn't work at all.

It also doesn't seem to recognize if I set the time to start an hour from now (and end the sale tomorrow). It just starts the sale right away.

Secondly, the sale price is also not showing up on the product listing, or product page. It only registers when the item hits the cart. The sale price does show in both places if I turn the sale on manually, so is there another function I need to add to show the sale price when I use the sale feature in the promotions tab?

Here is my template for the item listing:

<li class="product_list-item">

    <img src="<perch:shop id="image" type="image" width="350" height="350" density="1.6" crop="true" />" width="350" height="350">
    <a href="/shop/product?s=<perch:shop id="slug" type="slug" />" class="product_list-link" ><perch:shop id="title" type="text"  /></a>
    <perch:if not-exists="on_sale">
        <perch:shop id="price" type="shop_currency_value" label="Price" divider-before="Pricing" size="m" min="0" step="any" />
    </perch:if>
    <perch:if exists="on_sale">
        <perch:shop id="sale_price" type="shop_currency_value" label="Sale price" size="m" min="0" step="any" />
    </perch:if>

    <div class="button-wrap button-wrap-product_list">
        <perch:if not-exists="has_variants">
            <perch:form id="add_to_cart" app="perch_shop" action="/shop/cart" class="product_list-button_wrap">
                <perch:input id="product" type="hidden" value="<perch:shop id="productID" env-autofill="false" />" />
                <perch:input type="submit" value="Add to cart" class="button button-small" />
            </perch:form>
        </perch:if>
        <a href="/shop/product?s=<perch:shop id="slug" type="slug" />" class="button  button-transparent button-small">

        Product Details</a>
    </div>
</li>

and my diagnostics report:

Perch Runway: 3.0.11, PHP: 5.6.32, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (3.0.11), assets (3.0.11), categories (3.0.11), perch_blog (5.6.1), perch_forms (1.10), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2)
App runtimes: <?php $apps_list = [ 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_members', 'perch_shop', ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /chroot/home/wgw/wineglasswriter.com/html/perch
PERCH_CORE: /chroot/home/wgw/wineglasswriter.com/html/perch/core
PERCH_RESFILEPATH: /chroot/home/wgw/wineglasswriter.com/html/perch/resources
Image manipulation: GD
PHP limits: Max upload 50M, Max POST 50M, Memory: 128M, Total max file upload: 50M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: www.wineglasswriter.com
DOCUMENT_ROOT: /home/wgw/wineglasswriter.com/html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Herman Steuernagel

Herman Steuernagel 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you checked your server's clock?

Ok... So that seems to have worked,
However,

  1. This seems a little inconvenient for the user (my client) as it's 8 hours ahead of us.

  2. This is a national company, if they want to start the sale at midnight across timezones - i.e. they want the sale to start at both midnight in New York and midnight in Los Angeles, local times - is this not possible?

Drew McLellan

Drew McLellan 2638 points
Perch Support

To start the sale at the customer's local time, you'd need to geolocate the customer and then find the timezone from their location. This isn't something Shop does.

If you want to use it as-is, you'll need to pick a time and stick with it. If 8 hours ahead of your location is inconvenient, you could set it to your local time. The key is knowing which timezone it's set to.

Thanks Drew, Ok, so it's not that it "has" to be the server time.
However I've set define('PERCH_TZ', 'America/Vancouver'); in my config file. It's showing as such in my extended diagnostic report as well. Any thoughts on why it's not picking that up?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What are you seeing? What timezone is the server's clock set to?

The diagnostics shows: PERCH_TZ: America/Vancouver.
The server is set to UTC.

Drew McLellan

Drew McLellan 2638 points
Perch Support

So I think the way it's working is that the sale dates will run off your server's timezone, regardless of the display setting used with PERCH_TZ.