1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Checkout Step 2 - show days to expiry

Discussion in 'Templates, HTML, CSS, and Design Help' started by mattp008, Apr 15, 2012.

  1. mattp008 New Member

    Hi there,
    I am modifying step 2 of the checkout process with success so far, but would like to display the "days to expiry" of each package.

    What is the field/code I should use to display the days to expiry?

    Here is a snippet of what I have so far, but note the "30" hard coded as the "days to expiry".

    {section name=numloop loop=$results}
    <tr valign="top">
    <td align="center"> <strong>{$results[numloop].pTitle}</strong></td>
    <td align="center"> {$results[numloop].pDescription|nl2br}</td>
    <td align="center"> {$results[numloop].pPrice|format_money}</td>
    <td align="center"> 30</td>

    Thanks,
    Matt

    Running v4.2.4 Developer
    Custom template
  2. Blair Moderator

    Hi Matt -

    Unfortunately, the "Days to expiration" value is not pulled from the db and therefore not sent to the template file.

    There are a couple of ways to handle this:

    (Easiest)
    - include the days to expiration in the listing packages description field.

    (More involved)
    - modify the SQL query in the getListingPackagesByCatID function (located in the includes/classes/kernel/Products.php file at line 72) to pull the value of pExpiration from the products table. Basically, add pExpiration like this:

    PHP:
    $sSQL "SELECT pID,pTitle,pDescription,pListPrice,pPrice,pGroup,pExpiration FROM " PREFIX "products_packages_lookup LEFT JOIN " PREFIX "products ON pID=cID WHERE cCategoryID=" Filter::mysql_quote((int) $id) . " AND pType=1 AND pActive = 'Y' ORDER BY pOrder ASC";
    - then you can just refer to the value within your step2.tpl file as:
    Code:
    {$results[numloop].pExpiration}
  3. mattp008 New Member

    SOLVED
    Thanks Blair - You're the best. I used the "more Involved" solution and it worked a treat. I guess I need to keep that change in mind though for future upgrades of 68C as it is outside the templates folder?
    Thanks again - much appreciated.
  4. Blair Moderator

    I'm going to add pExpiration to the query in the Products.php core file so that it will be available in the next release. I'm not adding it to the .tpl file but the value will be available if someone wants to make this change to their own step2.tpl file in the future.

Share This Page