Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2016
    Location
    Norcatur, Kansas, USA
    Posts
    80
    Plugin Contributions
    3

    Idea or Suggestion Putting Sale text in header from Sales manager

    Okay, so I have my store running. I am running a sale right now, but I want a snippet of code put into my header.php that will:

    1. Parse the sales list in the database (that are defined in the Sales Manager).
    2. Gets sale information for the sale with the lowest ZOrder.
    3. Defines HEADER_SALES_TEXT with the following "Take advantage of our " + Sales Name + " Sale and save " + Sale Amount Off + " through " + End of Sale Date + "!"


    This would allow my sales in my Sales manager to automatically update the header as sales are created and deleted.

    Anyone have an idea of how to do this?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Putting Sale text in header from Sales manager

    In your template's tpl_header.php there is a section of code similar to this:
    Code:
    <?php              if (HEADER_SALES_TEXT != '') {
    ?>
          <div id="tagline"><?php echo HEADER_SALES_TEXT;?></div>
    <?php
                  }
    ?>
    You could change it to something like this:
    Code:
    <?php
    $saleDetails = $db->Execute("select * from " . TABLE_SALEMAKER_SALES . " where sale_status=1 order by sale_date_end asc, sale_id asc");
    if ($saleDetails->RecordCount()) {
      $saleTitle = $saleDetails->fields['sale_name'];
      $saleAmount = number_format($saleDetails->fields['sale_deduction_value'], 2); // might have to adjust depending on sale_deduction_type setting
      $saleExpiry = $saleDetails->fields['sale_date_end']; // might have to adjust if you forget to set an expiry date
    ?>
          <div id="tagline">Take advantage of our <?php echo $saleTitle;?> Sale and save <?php echo $saleAmount;?> through <?php echo $saleExpiry;?>!</div>
    <?php
                  }
    ?>
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Mar 2016
    Location
    Norcatur, Kansas, USA
    Posts
    80
    Plugin Contributions
    3

    Default Re: Putting Sale text in header from Sales manager

    Okay, I figured out what should be inserted:

    Code:
    <?php
    $saleDetails = $db->Execute("select * from " . TABLE_SALEMAKER_SALES . " where sale_status=1 order by sale_date_end asc, sale_id asc");
    if ($saleDetails->RecordCount()) {
    $saleTitle = $saleDetails->fields['sale_name'];
    $saleAmount = number_format($saleDetails->fields['sale_deduction_value'], 2); // might have to adjust depending on sale_deduction_type setting
    $saleExpiry = $saleDetails->fields['sale_date_end']; // might have to adjust if you forget to set an expiry date
    ?>
          <div id="tagline">Take advantage of our <?php echo $saleTitle;?> Sale and save <?php 
    if ($saleDetails->fields['sale_deduction_type'] == 2) echo '$';
    echo round($saleAmount); 
    if ($saleDetails->fields['sale_deduction_type'] == 1) echo '%';
    ?> through <?php echo $saleExpiry;?>!</div>

 

 

Similar Threads

  1. v153 Putting a product on sale without putting in specials section
    By bam3312 in forum Setting Up Specials and SaleMaker
    Replies: 2
    Last Post: 2 Sep 2014, 01:36 AM
  2. v139h styling header sales text
    By charliepingpong in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 14 Mar 2012, 12:46 AM
  3. Header: Sales Text... Center?
    By Rizla in forum General Questions
    Replies: 3
    Last Post: 12 Feb 2011, 07:24 AM
  4. Removing Header Sales Text?
    By mgremillion09 in forum General Questions
    Replies: 1
    Last Post: 4 Feb 2011, 10:42 PM
  5. Header sales text
    By AHeartForTheEarth in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 6 Nov 2008, 10:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg