Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2009
    Posts
    206
    Plugin Contributions
    2

    Default Help with Previous Page Code

    I'm trying to alter product_info_display.php so that if the customer gets to that page from featured products, instead of seeing the prev and next buttons, they see a "back to featured products" button but am having trouble with the correct variable to use.

    I thought the easiest way to implement this change would be to use the zen_back_link() function so I've tried several variations such as

    PHP Code:
    <!--bof Top Navigation-->
    <?php if ($link == 'featured_products') { ?>
    <div class="backtoFeatured"><?php echo '<a href="' zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' zen_image_button(BUTTON_IMAGE_BACKBUTTON_BACK_ALT) . '</a>'?></div>
    <?php } else { ?>
    <!--bof Prev/Next top position -->
    <?php if (PRODUCT_INFO_PREVIOUS_NEXT == or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
    <?php
    /**
     * display the product previous/next helper
     */
    require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
    <?php 
    ?>
    <!--eof Prev/Next top position-->
    <?php ?>
    <!--eof Top Navigation-->
    and

    PHP Code:
    <!--bof Top Navigation-->
    <?php if (zen_back_link() == 'featured_products') { ?>
    <div class="backtoFeatured back"><?php echo '<a href="' zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' zen_image_button(BUTTON_IMAGE_BACKBUTTON_BACK_ALT) . '</a>'?></div>
    <?php } else { ?>
    <!--bof Prev/Next top position -->
    <?php if (PRODUCT_INFO_PREVIOUS_NEXT == or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
    <?php
    /**
     * display the product previous/next helper
     */
    require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
    <?php 
    ?>
    <!--eof Prev/Next top position-->
    <?php ?>
    <!--eof Top Navigation-->
    but I'm obviously oblivious as to what the correct variable is. Any assistance would be greatly appreciated.

  2. #2
    Join Date
    Jan 2010
    Location
    Australia
    Posts
    239
    Plugin Contributions
    1

    Default Re: Help with Previous Page Code

    ..you might wanna try
    use
    $backlink = zen_back_link();
    $page = featured_products

    if(preg_match($page,$backlink))

    I haven't tested it though. let us know

  3. #3
    Join Date
    Dec 2009
    Posts
    206
    Plugin Contributions
    2

    Default Re: Help with Previous Page Code

    I really appreciate your help! Unfortunately that code didn't work (I got the error PHP Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Delimiter must not be alphanumeric or backslash) but I am really, really grateful for you taking the time to look at it.

    I (finally) found that this bit of code worked:
    PHP Code:
    <!--bof Top Navigation-->
    <?php if ($_SERVER['HTTP_REFERER'] == 'http://www.theburningbutterfly.com/store/Snow_Angel'){ ?>
    <div class="backtoFeatured"><?php echo '<a href="' zen_href_link(FILENAME_FEATURED_PRODUCTS) . '">' zen_image_button(BUTTON_IMAGE_BACKBUTTON_BACK_ALT) . '</a>'?></div> 
    <?php } else { ?>
    <!--bof Prev/Next top position -->
    <?php if (PRODUCT_INFO_PREVIOUS_NEXT == or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
    <?php
    /**
     * display the product previous/next helper
     */
    require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
    <?php 
    ?>
    <!--eof Prev/Next top position-->
    <?php ?>
    <!--eof Top Navigation-->
    I'm a little nervous about having a full url in my code, but after literally hours of staring at (and searching for answers regarding) the zen_back_link function, I'm so sick of it and I'll just deal with the consequences.

    It doesn't mean, however, that I'm not open to more competent ways of accomplishing my goal if anyone has suggestions.

  4. #4
    Join Date
    Dec 2009
    Posts
    206
    Plugin Contributions
    2

    Default Re: Help with Previous Page Code

    Using

    PHP Code:
    <?php if ($_SERVER['HTTP_REFERER'] == zen_href_link(FILENAME_FEATURED_PRODUCTS)){ ?>
    works just as well.

 

 

Similar Threads

  1. v151 Code For Previous/Next Arrows on Product Page
    By riolas in forum General Questions
    Replies: 3
    Last Post: 14 Nov 2013, 12:37 AM
  2. v139h Help with this code for Main Page please
    By traytray in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 7 Jun 2013, 08:09 AM
  3. v139h Help with custom code on checkout success page (iDevAffiliate)
    By abcisme in forum All Other Contributions/Addons
    Replies: 13
    Last Post: 20 Jul 2012, 06:03 PM
  4. Help with unwanted code on product page
    By 808helmets in forum General Questions
    Replies: 4
    Last Post: 9 Dec 2009, 07:44 AM
  5. Help with code for bottom part of product info page please!
    By Decostyle in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 May 2008, 07:17 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