Results 1 to 4 of 4
  1. #1

    Default Adding a new radio button

    Hi,
    I have some products that can only be purchased online, not in store. As such I wanted to display an "Online Only" image on those product pages. Now, I have managed to add a (radio button) field to the database, get it to display in admin on the edit product page, get it to update the product and post it to the database, but I just can't get it to show on the product info page? It is a radio button selection, and you choose either yes or no for whether it is online only, it then posts 1 or 0 to the database. The code I have for the product_info template to display it is:
    <!--bof Product is Online -->
    <?php
    if ($product_is_online != '1') {
    ?>
    <div id="productOnlineOnly" class="productGeneral"><?php echo OTHER_IMAGE_ONLINE_ONLY; ?></div>
    <?php
    }
    ?>
    <!--eof Product is Online -->

    This displays the text OTHER_IMAGE_ONLINE_ONLY on all product pages regardless of the yes or no choice.
    What am I doing wrong? I don't know too much about coding, I sort of copied the Call for Price function in Zen Cart and adapted it.
    Any help would be greatly appreciated.

  2. #2

    Default Re: Adding a new radio button

    It's ok, I missed something. In includes/modules/pages/product_info/main_template_vars.php I forgot to put:

    $product_is_online = $product_info->fields['product_is_online'];

    it works now

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Adding a new radio button

    Quote Originally Posted by kitten091182 View Post
    It's ok, I missed something. In includes/modules/pages/product_info/main_template_vars.php I forgot to put:

    $product_is_online = $product_info->fields['product_is_online'];

    it works now
    Sometimes just helps to "talk" it out. :)

    Thing is though, are you still getting just a text of OTHER_IMAGE_ONLINE_ONLY when the image is supposed to be displayed? That is a define issue in that OTHER_IMAGE_ONLINE_ONLY was not set to anything before being displayed.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4

    Default Re: Adding a new radio button

    Quote Originally Posted by mc12345678 View Post
    Sometimes just helps to "talk" it out. :)

    Thing is though, are you still getting just a text of OTHER_IMAGE_ONLINE_ONLY when the image is supposed to be displayed? That is a define issue in that OTHER_IMAGE_ONLINE_ONLY was not set to anything before being displayed.
    Hi,
    I changed it to be:
    <!--bof Product Is Online -->
    <?php
    if ($product_is_online == '1') {
    ?>
    <div id="productOnlineOnly" class="productGeneral"><?php echo zen_image($template->get_template_dir(OTHER_IMAGE_ONLINE_ONLY, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . OTHER_IMAGE_ONLINE_ONLY, ICON_IMAGE_TEXT); ?></div>
    <?php
    }
    ?>

    And it works now.
    It does help to talk it out lol

 

 

Similar Threads

  1. adding title Mrs radio button to login page
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 12 Oct 2010, 04:48 PM
  2. adding additional payment radio button(s)
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 7 Sep 2010, 04:21 PM
  3. Adding in custom radio button on shipping page
    By JohneeMac in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 4 May 2007, 12:16 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